code: def test_mask_strategy_errors(rng):
      """Check that mask_strategy errors are raised."""
      # Error with unknown mask_strategy
      img = rng.uniform(size=(9, 9, 5))
      img = nibabel.Nifti1Image(img, np.eye(4))
      mask = NiftiMasker(mask_strategy="oops")
      with pytest.raises(
          ValueError, match="Unknown value of mask_strategy 'oops'"
      ):
          mask.fit(img)
      # Warning with deprecated 'template' strategy,
      # plus an exception because there's no resulting mask
      mask = NiftiMasker(mask_strategy="template")
      with pytest.warns(
          UserWarning,
          match="Masking strategy 'template' is deprecated.",
      ):
          mask.fit(img)
  
imports: import os
  import shutil
  import warnings
  from tempfile import mkdtemp
  import nibabel
  import numpy
  import pytest
  from numpy.testing import assert_array_equal
  from nilearn._utils import data_gen, exceptions, testing
  from nilearn._utils.class_inspect import get_params
  from nilearn.image import get_data, index_img
  from nilearn.maskers import NiftiMasker
  from nilearn.maskers.nifti_masker import _filter_and_mask
label_desc: Use image node_id 17 for calling a global function with example usage: test_mask_strategy_errors(rng) without return types