code: def test_error_shape(rng, affine_eye, shape=(3, 5, 7, 11)):
      # open-ended `if .. elif` in masking.unmask
  
      # setup
      X = rng.standard_normal()
      mask_img = np.zeros(shape, dtype=np.uint8)
      mask_img[rng.standard_normal(size=shape) > 0.4] = 1
      n_features = (mask_img > 0).sum()
      mask_img = Nifti1Image(mask_img, affine_eye)
      n_samples = shape[0]
  
      X = rng.standard_normal(size=(n_samples, n_features, 2))
      # 3D X (unmask should raise a TypeError)
      with pytest.raises(TypeError):
          unmask(X, mask_img)
  
      X = rng.standard_normal(size=(n_samples, n_features))
      # Raises an error because the mask is 4D
      with pytest.raises(TypeError):
          unmask(X, mask_img)
  
imports: import warnings
  import numpy
  import pytest
  from nibabel import Nifti1Image
  from numpy.testing import assert_array_equal
  from sklearn.preprocessing import StandardScaler
  from nilearn import masking
  from nilearn._utils import data_gen
  from nilearn._utils.exceptions import DimensionError
  from nilearn._utils.testing import write_imgs_to_path
  from nilearn.conftest import _rng
  from nilearn.image import get_data, high_variance_confounds
  from nilearn.maskers import NiftiMasker
  from nilearn.masking import _MaskWarning, _unmask_3d, _unmask_4d, compute_background_mask, compute_brain_mask, compute_epi_mask, compute_multi_brain_mask, compute_multi_epi_mask, extrapolate_out_mask, intersect_masks, unmask, unmask_from_to_3d_array
label_desc: Use image node_id 15 for calling a global function with example usage: test_error_shape(rng, affine_eye, shape) without return types