code: def test_load_surface():
      coords, faces = generate_surf()
      mesh = Mesh(coords, faces)
      data = mesh[0][:, 0]
      surf = Surface(mesh, data)
      surf_like_obj = SurfaceLikeObject(mesh, data)
      # Load the surface from:
      #   - Surface-like objects having the right attributes
      #   - a list of length 2 (mesh, data)
      for loadings in [surf, surf_like_obj, [mesh, data]]:
          s = surface.load_surface(loadings)
          assert_array_equal(s.data, data)
          assert_array_equal(s.data, surf.data)
          assert_array_equal(s.mesh.coordinates, coords)
          assert_array_equal(s.mesh.coordinates, surf.mesh.coordinates)
          assert_array_equal(s.mesh.faces, surf.mesh.faces)
      # Giving an iterable of length other than 2 will raise an error
      # Length 3
      with pytest.raises(
          ValueError,
          match="`load_surface` accepts iterables of length 2",
      ):
          s = surface.load_surface([coords, faces, data])
      # Length 1
      with pytest.raises(
          ValueError,
          match="`load_surface` accepts iterables of length 2",
      ):
          s = surface.load_surface([coords])
      # Giving other objects will raise an error
      with pytest.raises(
          ValueError,
          match="Wrong parameter `surface` in `load_surface`",
      ):
          s = surface.load_surface("foo")
  
imports: import os
  import tempfile
  import warnings
  import nibabel
  import numpy
  import pytest
  from nibabel import gifti
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  from scipy.spatial import Delaunay
  from scipy.stats import pearsonr
  from nilearn import datasets, image
  from nilearn._utils import data_gen
  from nilearn.image import resampling
  from nilearn.surface import Mesh, Surface, load_surf_data, load_surf_mesh, surface
  from nilearn.surface.surface import _gifti_img_to_mesh, _load_surf_files_gifti_gzip
  from nilearn.surface.tests._testing import flat_mesh, generate_surf, z_const_img
label_desc: Use image node_id 8 for calling a global function with example usage: test_load_surface() without return types