code: def test_parcellations_fit_on_single_nifti_image(
      method, n_parcel, test_image
  ):
      """Test return attributes for each method."""
      parcellator = Parcellations(
          method=method, n_parcels=n_parcel, verbose=0
      )
      parcellator.fit(test_image)
  
      labels_img = parcellator.labels_img_
      # Test that object returns attribute labels_img_
      assert labels_img is not None
      # After inverse_transform, shape must match with
      # original input data
      assert labels_img.shape == test_image.shape[:3]
      # Test object returns attribute masker_
      assert parcellator.masker_ is not None
      assert parcellator.mask_img_ is not None
      if method not in ["kmeans", "rena", "hierarchical_kmeans"]:
          # Test that object returns attribute connectivity_
          # only for AgglomerativeClustering methods
          assert parcellator.connectivity_ is not None
  
imports: import warnings
  import numpy
  import pandas
  import pytest
  from nibabel import Nifti1Image
  from nilearn.conftest import _affine_eye
  from nilearn.regions.parcellations import Parcellations, _check_parameters_transform
label_desc: Use image node_id 5 for calling a global function with example usage: test_parcellations_fit_on_single_nifti_image(method, n_parcel, test_image) without return types