code: def test_mask_strategy_errors():
      # Error with unknown mask_strategy
      imgs = _get_random_imgs((9, 9, 5), 2)
      mask = MultiNiftiMasker(mask_strategy="foo")
      with pytest.raises(
          ValueError, match="Unknown value of mask_strategy 'foo'"
      ):
          mask.fit(imgs)
      # Warning with deprecated 'template' strategy,
      # plus an exception because there's no resulting mask
      mask = MultiNiftiMasker(mask_strategy="template")
      with pytest.warns(
          UserWarning,
          match="Masking strategy 'template' is deprecated.",
      ):
          mask.fit(imgs)
  
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 8 for calling a global function with example usage: test_mask_strategy_errors() without return types