code: def test_resampling_error_checks(tmp_path):
      img, affine, _ = _make_resampling_test_data()
      target_shape = (5, 3, 2)
  
      # Correct parameters: no exception
      resample_img(img, target_shape=target_shape, target_affine=affine)
      resample_img(img, target_affine=affine)
  
      filename = testing.write_imgs_to_path(img, file_path=tmp_path)
      resample_img(
          filename, target_shape=target_shape, target_affine=affine
      )
  
      # Missing parameter
      with pytest.raises(
          ValueError, match="target_affine should be specified"
      ):
          resample_img(img, target_shape=target_shape)
  
      # Invalid shape
      with pytest.raises(
          ValueError, match="shape .* should be .* 3D grid"
      ):
          resample_img(
              img,
              target_shape=(2, 3),
              target_affine=affine,
          )
  
      # Invalid interpolation
      with pytest.raises(
          ValueError, match="interpolation must be one of"
      ):
          resample_img(
              img,
              target_shape=target_shape,
              target_affine=affine,
              interpolation="an_invalid_interpolation",
          )
  
imports: import copy
  import math
  import os
  from pathlib import Path
  import numpy
  import pytest
  from nibabel import Nifti1Header, Nifti1Image
  from nibabel.freesurfer import MGHImage
  from numpy.testing import assert_allclose, assert_almost_equal, assert_array_almost_equal, assert_array_equal, assert_equal
  from nilearn import _utils
  from nilearn._utils import testing
  from nilearn.conftest import _affine_eye, _rng
  from nilearn.image import get_data
  from nilearn.image.image import _pad_array, crop_img
  from nilearn.image.resampling import BoundingBoxError, coord_transform, from_matrix_vector, get_bounds, reorder_img, resample_img, resample_to_img
label_desc: Use image node_id 11 for calling a global function with example usage: test_resampling_error_checks(tmp_path) without return types