code: def test_shelving():
      mask_img = Nifti1Image(
          np.ones((2, 2, 2), dtype=np.int8),
          affine=np.diag((4, 4, 4, 1)),
      )
      epi_img1 = Nifti1Image(
          np.ones((2, 2, 2)), affine=np.diag((4, 4, 4, 1))
      )
      epi_img2 = Nifti1Image(
          np.ones((2, 2, 2)), affine=np.diag((2, 2, 2, 1))
      )
      cachedir = mkdtemp()
      try:
          masker_shelved = MultiNiftiMasker(
              mask_img=mask_img,
              memory=Memory(
                  location=cachedir, mmap_mode="r", verbose=0
              ),
          )
          masker_shelved._shelving = True
          masker = MultiNiftiMasker(mask_img=mask_img)
          epis_shelved = masker_shelved.fit_transform(
              [epi_img1, epi_img2]
          )
          epis = masker.fit_transform([epi_img1, epi_img2])
          for epi_shelved, epi in zip(epis_shelved, epis):
              epi_shelved = epi_shelved.get()
              assert_array_equal(epi_shelved, epi)
  
          epi = masker.fit_transform(epi_img1)
          epi_shelved = masker_shelved.fit_transform(epi_img1)
          epi_shelved = epi_shelved.get()
          assert_array_equal(epi_shelved, epi)
      finally:
          # enables to delete "filename" on windows
          del masker
          shutil.rmtree(cachedir, ignore_errors=True)
  
imports: import shutil
  from tempfile import mkdtemp
  import numpy
  import pytest
  from joblib import Memory
  from nibabel import Nifti1Image
  from numpy.testing import assert_array_equal
  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
  from nilearn.maskers import MultiNiftiMasker
label_desc: Use image node_id 6 for calling a global function with example usage: test_shelving() without return types