code: def test_files_spatialimages():
      # test files creation in image classes
      arr = np.zeros((2, 3, 4))
      aff = np.eye(4)
      klasses = [
          klass
          for klass in all_image_classes
          if klass.rw and issubclass(klass, SpatialImage)
      ]
      for klass in klasses:
          file_map = klass.make_file_map()
          for key, value in file_map.items():
              assert value.filename is None
              assert value.fileobj is None
              assert value.pos == 0
          # If we can't create new images in memory without loading, bail here
          if not klass.makeable:
              continue
          # MGHImage accepts only a few datatypes
          # so we force a type change to float32
          if klass == MGHImage:
              img = klass(arr.astype(np.float32), aff)
          else:
              img = klass(arr, aff)
          for key, value in img.file_map.items():
              assert value.filename is None
              assert value.fileobj is None
              assert value.pos == 0
  
file_path: nibabel/nibabel/tests/test_files_interface.py
imports: from io import BytesIO
  import numpy
  import pytest
  from numpy.testing import assert_array_equal
  from ..None import MGHImage, Nifti1Image, Nifti1Pair, all_image_classes
  from ..fileholders import FileHolderError
  from ..spatialimages import SpatialImage
label_desc: Use image node_id 1 for calling a global function with example usage: test_files_spatialimages() without return types