code: def test_multi_pca_errors(multi_pca_data, mask_img):
      """Fit and transform fail without the proper arguments."""
      multi_pca = _MultiPCA(mask=mask_img)
  
      # Smoke test to fit with no img
      with pytest.raises(
          TypeError, match="missing 1 required positional"
      ):
          multi_pca.fit()
  
      # transform before fit raises an error
      with pytest.raises(
          ValueError,
          match="Object has no components_ attribute. This is "
          "probably because fit has not been called",
      ):
          multi_pca.transform(multi_pca_data)
  
      # Test if raises an error when empty list of provided.
      with pytest.raises(
          ValueError,
          match="Need one or more Niimg-like objects as input, "
          "an empty list was given.",
      ):
          multi_pca.fit([])
  
      # No mask provided
      multi_pca = _MultiPCA()
      with pytest.raises(
          ValueError, match="The mask is invalid as it is empty"
      ):
          multi_pca.fit(multi_pca_data)
  
imports: import numpy
  import pytest
  from nibabel import Nifti1Image
  from numpy.testing import assert_almost_equal
  from nilearn._utils.testing import write_imgs_to_path
  from nilearn.conftest import _affine_eye, _rng
  from nilearn.decomposition._multi_pca import _MultiPCA
  from nilearn.maskers import MultiNiftiMasker, NiftiMasker
label_desc: Use image node_id 9 for calling a global function with example usage: test_multi_pca_errors(multi_pca_data, mask_img) without return types