code: def test_fake_bids_extra_raw_entity(tmp_path):
      """Check files with extra entity are created appropriately."""
      n_sub = 2
      n_ses = 2
      tasks = ["main"]
      n_runs = [2]
      entities = {"acq": ["foo", "bar"]}
      bids_path = create_fake_bids_dataset(
          base_dir=tmp_path,
          n_sub=n_sub,
          n_ses=n_ses,
          tasks=tasks,
          n_runs=n_runs,
          entities=entities,
      )
  
      # raw
      for i, task in enumerate(tasks):
          for suffix in ["bold.nii.gz", "bold.json", "events.tsv"]:
              for label in entities["acq"]:
                  file_pattern = _bids_path_template(
                      task=task,
                      suffix=suffix,
                      n_runs=n_runs[i],
                      extra_entity={"acq": label},
                  )
                  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 entity per run per session
      n_raw_files_expected = n_sub * (
          1 + 3 * sum(n_runs) * n_ses * len(entities["acq"])
      )
      assert len(all_files) == n_raw_files_expected
  
      # derivatives
      for label in entities["acq"]:
          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,
                  extra_entity={"acq": label},
              )
  
      all_files = list(bids_path.glob("derivatives/sub-*/ses-*/*/*"))
      # per subject: (2 confound + 3 bold + 2 gifti)
      #              per run per session per entity
      n_derivatives_files_expected = (
          n_sub * (7 * sum(n_runs) * n_ses) * len(entities["acq"])
      )
      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 12 for calling a global function with example usage: test_fake_bids_extra_raw_entity(tmp_path) without return types