code: def test_fake_bids_raw_with_session_and_runs(
      tmp_path, n_sub, n_ses, tasks, n_runs
  ):
      """Check number of each file 'type' created in raw."""
      bids_path = create_fake_bids_dataset(
          base_dir=tmp_path,
          n_sub=n_sub,
          n_ses=n_ses,
          tasks=tasks,
          n_runs=n_runs,
      )
  
      # raw
      file_pattern = "sub-*/ses-*/anat/sub-*ses-*T1w.nii.gz"
      raw_anat_files = list(bids_path.glob(file_pattern))
      assert len(raw_anat_files) == n_sub
  
      for i, task in enumerate(tasks):
          for suffix in ["bold.nii.gz", "bold.json", "events.tsv"]:
              file_pattern = _bids_path_template(
                  task=task, suffix=suffix, n_runs=n_runs[i]
              )
              files = list(bids_path.glob(file_pattern))
              assert len(files) == n_sub * n_ses * n_runs[i]
  
      all_files = list(bids_path.glob("sub-*/ses-*/*/*"))
      # per subject: 1 anat + (1 event + 1 json + 1 bold) per run per session
      n_raw_files_expected = n_sub * (1 + 3 * sum(n_runs) * n_ses)
      assert len(all_files) == n_raw_files_expected
  
imports: from __future__ import annotations
  import json
  import numpy
  import pytest
  from nilearn._utils.data_gen import add_metadata_to_bids_dataset, create_fake_bids_dataset, generate_fake_fmri, generate_labeled_regions, generate_maps, generate_regions_ts
  from nilearn.image import get_data
label_desc: Use image node_id 4 for calling a global function with example usage: test_fake_bids_raw_with_session_and_runs(tmp_path, n_sub, n_ses, tasks, n_runs) without return types