code: def test_fake_bids_derivatives_with_session_and_runs(
      tmp_path, n_sub, n_ses, tasks, n_runs
  ):
      """Check number of each file 'type' created in derivatives."""
      bids_path = create_fake_bids_dataset(
          base_dir=tmp_path,
          n_sub=n_sub,
          n_ses=n_ses,
          tasks=tasks,
          n_runs=n_runs,
      )
  
      # derivatives
      for task, n_run in zip(tasks, n_runs):
          _check_nb_files_derivatives_for_task(
              bids_path=bids_path,
              n_sub=n_sub,
              n_ses=n_ses,
              task=task,
              n_run=n_run,
          )
  
      all_files = list(bids_path.glob("derivatives/sub-*/ses-*/*/*"))
      # per subject: (2 confound + 3 bold + 2 gifti) per run per session
      n_derivatives_files_expected = n_sub * (7 * sum(n_runs) * n_ses)
      assert len(all_files) == n_derivatives_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 6 for calling a global function with example usage: test_fake_bids_derivatives_with_session_and_runs(tmp_path, n_sub, n_ses, tasks, n_runs) without return types