code: def test_compute_background_mask(affine_eye):
      for value in (0, np.nan):
          mean_image = value * np.ones((9, 9, 9))
          mean_image[3:-3, 3:-3, 3:-3] = 1
          mask = mean_image == 1
          mean_image = Nifti1Image(mean_image, affine_eye)
          mask1 = compute_background_mask(mean_image, opening=False)
          np.testing.assert_array_equal(
              get_data(mask1), mask.astype(np.int8)
          )
  
      # Check that we get a ValueError for incorrect shape
      mean_image = np.ones((9, 9))
      mean_image[3:-3, 3:-3] = 10
      mean_image[5, 5] = 100
      mean_image = Nifti1Image(mean_image, affine_eye)
      with pytest.raises(ValueError):
          compute_background_mask(mean_image)
  
      # Check that we get a useful warning for empty masks
      mean_image = np.zeros((9, 9, 9))
      mean_image = Nifti1Image(mean_image, affine_eye)
      with pytest.warns(_MaskWarning, match="Computed an empty mask"):
          compute_background_mask(mean_image)
  
imports: import warnings
  import numpy
  import pytest
  from nibabel import Nifti1Image
  from numpy.testing import assert_array_equal
  from sklearn.preprocessing import StandardScaler
  from nilearn import masking
  from nilearn._utils import data_gen
  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, high_variance_confounds
  from nilearn.maskers import NiftiMasker
  from nilearn.masking import _MaskWarning, _unmask_3d, _unmask_4d, compute_background_mask, compute_brain_mask, compute_epi_mask, compute_multi_brain_mask, compute_multi_epi_mask, extrapolate_out_mask, intersect_masks, unmask, unmask_from_to_3d_array
label_desc: Use image node_id 7 for calling a global function with example usage: test_compute_background_mask(affine_eye) without return types