code: def test_fetch_atlas_schaefer_2018(tmp_path, request_mocker):
      labels_pattern = re.compile(
          r".*2018_(?P<n_rois>\d+)Parcels_(?P<network>\d+)Networks_order.txt"
      )
      img_pattern = re.compile(
          r".*_(?P<n_rois>\d+)Parcels_(?P<network>\d+)"
          r"Networks_order_FSLMNI152_(?P<res>\d)mm.nii.gz"
      )
      request_mocker.url_mapping[labels_pattern] = _schaefer_labels
      request_mocker.url_mapping[img_pattern] = _schaefer_img
      valid_n_rois = list(range(100, 1100, 100))
      valid_yeo_networks = [7, 17]
      valid_resolution_mm = [1, 2]
  
      with pytest.raises(ValueError):
          atlas.fetch_atlas_schaefer_2018(n_rois=44)
      with pytest.raises(ValueError):
          atlas.fetch_atlas_schaefer_2018(yeo_networks=10)
      with pytest.raises(ValueError):
          atlas.fetch_atlas_schaefer_2018(resolution_mm=3)
  
      for n_rois, yeo_networks, resolution_mm in itertools.product(
          valid_n_rois, valid_yeo_networks, valid_resolution_mm
      ):
          data = atlas.fetch_atlas_schaefer_2018(
              n_rois=n_rois,
              yeo_networks=yeo_networks,
              resolution_mm=resolution_mm,
              data_dir=tmp_path,
              verbose=0,
          )
  
          assert data.description != ""
          assert isinstance(data.maps, str)
          assert isinstance(data.labels, np.ndarray)
          assert len(data.labels) == n_rois
          assert (
              data.labels[0]
              .astype(str)
              .startswith(f"{yeo_networks}Networks")
          )
  
          img = nibabel.load(data.maps)
  
          assert img.header.get_zooms()[0] == resolution_mm
          assert np.array_equal(
              np.unique(img.dataobj), np.arange(n_rois + 1)
          )
  
imports: import itertools
  import os
  import re
  from pathlib import Path
  import nibabel
  import numpy
  import pandas
  import pytest
  from numpy.testing import assert_array_equal
  from nilearn._utils import data_gen
  from nilearn._utils.testing import serialize_niimg
  from nilearn.conftest import _rng
  from nilearn.datasets import atlas
  from nilearn.datasets._utils import fetch_files
  from nilearn.datasets.tests._testing import dict_to_archive
  from nilearn.image import get_data
label_desc: Use image node_id 32 for calling a global function with example usage: test_fetch_atlas_schaefer_2018(tmp_path, request_mocker) without return types