code: def test_check_niimg_4d_errors(
      affine_eye, img_3d_zeros_eye, shape_3d_default
  ):
      with pytest.raises(TypeError, match="nibabel format"):
          _utils.check_niimg_4d(0)
  
      with pytest.raises(TypeError, match="empty object"):
          _utils.check_niimg_4d([])
  
      # This should raise an error: a 3D img is given and we want a 4D
      with pytest.raises(
          DimensionError,
          match="Input data has incompatible dimensionality: "
          "Expected dimension is 4D and you provided a 3D image.",
      ):
          _utils.check_niimg_4d(img_3d_zeros_eye)
  
      a = img_3d_zeros_eye
      b = np.zeros(shape_3d_default)
      c = _utils.check_niimg_4d([a, b], return_iterator=True)
      with pytest.raises(
          TypeError, match="Error encountered while loading image #1"
      ):
          list(c)
  
      b = Nifti1Image(np.zeros((10, 20, 10)), affine_eye)
      c = _utils.check_niimg_4d([a, b], return_iterator=True)
      with pytest.raises(
          ValueError,
          match="Field of view of image #1 is different from reference FOV",
      ):
          list(c)
  
imports: import os
  import re
  import tempfile
  from pathlib import Path
  import nibabel
  import numpy
  import pytest
  from nibabel import Nifti1Image
  from numpy.testing import assert_array_equal
  import nilearn
  from nilearn import _utils
  from nilearn._utils import niimg_conversions, testing
  from nilearn._utils.exceptions import DimensionError
  from nilearn._utils.niimg_conversions import iter_check_niimg
  from nilearn._utils.testing import assert_memory_less_than, with_memory_profiler
  from nilearn.image import get_data
label_desc: Use image node_id 3 for calling a global function with example usage: test_check_niimg_4d_errors(affine_eye, img_3d_zeros_eye, shape_3d_default) without return types