code: def test_check_mesh_and_data(rng):
      coords, faces = generate_surf()
      mesh = Mesh(coords, faces)
      data = mesh[0][:, 0]
      m, d = surface.check_mesh_and_data(mesh, data)
      assert (m[0] == mesh[0]).all()
      assert (m[1] == mesh[1]).all()
      assert (d == data).all()
      # Generate faces such that max index is larger than
      # the length of coordinates array.
      wrong_faces = rng.integers(coords.shape[0] + 1, size=(30, 3))
      wrong_mesh = Mesh(coords, wrong_faces)
      # Check that check_mesh_and_data raises an error
      # with the resulting wrong mesh
      with pytest.raises(
          ValueError,
          match="Mismatch between .* indices of faces .* number of nodes.",
      ):
          surface.check_mesh_and_data(wrong_mesh, data)
      # Alter the data and check that an error is raised
      data = mesh[0][::2, 0]
      with pytest.raises(
          ValueError, match="Mismatch between number of nodes in mesh"
      ):
          surface.check_mesh_and_data(mesh, data)
  
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 33 for calling a global function with example usage: test_check_mesh_and_data(rng) without return types