code: def test_bids_dataset_no_session(tmp_path):
      """n_ses = 0 prevent creation of a session folder."""
      bids_path = create_fake_bids_dataset(
          base_dir=tmp_path,
          n_sub=1,
          n_ses=0,
          tasks=["main"],
          n_runs=[1],
          with_derivatives=True,
      )
  
      files = list(bids_path.glob("**/*ses-*"))
      assert not files
  
      # nifti: 1 anat + 1 raw bold + 3 derivatives bold
      files = list(bids_path.glob("**/*.nii.gz"))
      assert len(files) == 5
  
      # events or json or confounds: 1
      for suffix in ["events.tsv", "timeseries.tsv", "bold.json"]:
          files = list(bids_path.glob(f"**/*{suffix}"))
          assert len(files) == 1
  
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 8 for calling a global function with example usage: test_bids_dataset_no_session(tmp_path) without return types