code: def test_with_globbing_patterns(mask_img, n_subjects, tmp_path):
      data, *_ = _make_canica_test_data(n_subjects=n_subjects)
  
      n_components = 3
      dict_learning = DictLearning(
          n_components=n_components, mask=mask_img
      )
  
      # just for test readability
      if n_subjects == 1:
          data = [data[0]]
      elif n_subjects == 3:
          data = [data[0], data[1], data[2]]
  
      img = write_imgs_to_path(
          *data,
          file_path=tmp_path,
          create_files=True,
          use_wildcards=True,
      )
  
      dict_learning.fit(img)
      components_img = dict_learning.components_img_
  
      assert isinstance(components_img, Nifti1Image)
  
      check_shape = data[0].shape[:3] + (n_components,)
  
      assert components_img.shape, check_shape
  
imports: import numpy
  import pytest
  from nibabel import Nifti1Image
  from nilearn._utils.testing import write_imgs_to_path
  from nilearn.conftest import _affine_eye
  from nilearn.decomposition.dict_learning import DictLearning
  from nilearn.decomposition.tests.test_canica import _make_canica_test_data
  from nilearn.image import get_data, iter_img
  from nilearn.maskers import NiftiMasker
label_desc: Use image node_id 11 for calling a global function with example usage: test_with_globbing_patterns(mask_img, n_subjects, tmp_path) without return types