code: def test_multi_nifti_labels_masker_reduction_strategies():
      """Tests:
      1. whether the usage of different reduction strategies work.
      2. whether unrecognised strategies raise a ValueError
      3. whether the default option is backwards compatible (calls "mean")
      """
      test_values = [-2.0, -1.0, 0.0, 1.0, 2]
  
      img_data = np.array([[test_values, test_values]])
  
      labels_data = np.array(
          [[[0, 0, 0, 0, 0], [1, 1, 1, 1, 1]]], dtype=np.int8
      )
  
      affine = np.eye(4)
      img = nibabel.Nifti1Image(img_data, affine)
      labels = nibabel.Nifti1Image(labels_data, affine)
  
      # What MultiNiftiLabelsMasker should return for each reduction strategy?
      expected_results = {
          "mean": np.mean(test_values),
          "median": np.median(test_values),
          "sum": np.sum(test_values),
          "minimum": np.min(test_values),
          "maximum": np.max(test_values),
          "standard_deviation": np.std(test_values),
          "variance": np.var(test_values),
      }
  
      for strategy, expected_result in expected_results.items():
          masker = MultiNiftiLabelsMasker(labels, strategy=strategy)
          # Here passing [img, img] within a list because it is multiple subjects
          # with a 3D object.
          results = masker.fit_transform([img, img])
          for result in results:
              assert result.squeeze() == expected_result
  
      with pytest.raises(
          ValueError, match="Invalid strategy 'TESTRAISE'"
      ):
          MultiNiftiLabelsMasker(labels, strategy="TESTRAISE")
  
      default_masker = MultiNiftiLabelsMasker(labels)
      assert default_masker.strategy == "mean"
  
file_path: nilearn/nilearn/maskers/tests/test_multi_nifti_labels_masker.py
imports: import nibabel
  import numpy
  import pytest
  from nilearn._utils import data_gen, testing
  from nilearn._utils.exceptions import DimensionError
  from nilearn.image import get_data
  from nilearn.maskers import MultiNiftiLabelsMasker, NiftiLabelsMasker
label_desc: Use image node_id 2 for calling a global function with example usage: test_multi_nifti_labels_masker_reduction_strategies() without return types