code: def test_save_glm_to_bids(tmp_path_factory):
      """Test that save_glm_to_bids saves the appropriate files.
  
      This test reuses code from
      nilearn.glm.tests.test_first_level.test_high_level_glm_one_session.
      """
      tmpdir = tmp_path_factory.mktemp("test_save_glm_results")
  
      EXPECTED_FILENAMES = [
          "dataset_description.json",
          "sub-01_ses-01_task-nback_contrast-effectsOfInterest_design.svg",
          (
              "sub-01_ses-01_task-nback_contrast-effectsOfInterest_"
              "stat-F_statmap.nii.gz"
          ),
          (
              "sub-01_ses-01_task-nback_contrast-effectsOfInterest_"
              "stat-effect_statmap.nii.gz"
          ),
          (
              "sub-01_ses-01_task-nback_contrast-effectsOfInterest_"
              "stat-p_statmap.nii.gz"
          ),
          (
              "sub-01_ses-01_task-nback_contrast-effectsOfInterest_"
              "stat-variance_statmap.nii.gz"
          ),
          (
              "sub-01_ses-01_task-nback_contrast-effectsOfInterest_"
              "stat-z_statmap.nii.gz"
          ),
          "sub-01_ses-01_task-nback_design.svg",
          "sub-01_ses-01_task-nback_design.tsv",
          "sub-01_ses-01_task-nback_stat-errorts_statmap.nii.gz",
          "sub-01_ses-01_task-nback_stat-rSquare_statmap.nii.gz",
          "sub-01_ses-01_task-nback_statmap.json",
      ]
  
      shapes, rk = [(7, 8, 9, 15)], 3
      (
          mask,
          fmri_data,
          design_matrices,
      ) = generate_fake_fmri_data_and_design(
          shapes,
          rk,
      )
  
      masker = NiftiMasker(mask)
      masker.fit()
  
      # Call with verbose (improve coverage)
      single_run_model = FirstLevelModel(
          mask_img=None,
          minimize_memory=False,
      ).fit(
          fmri_data[0],
          design_matrices=design_matrices[0],
      )
  
      contrasts = {
          "effects of interest": np.eye(rk),
      }
      contrast_types = {
          "effects of interest": "F",
      }
      save_glm_to_bids(
          model=single_run_model,
          contrasts=contrasts,
          contrast_types=contrast_types,
          out_dir=tmpdir,
          prefix="sub-01_ses-01_task-nback",
      )
  
      for fname in EXPECTED_FILENAMES:
          full_filename = os.path.join(tmpdir, fname)
          assert os.path.isfile(full_filename)
  
imports: import json
  import os
  import numpy
  import pandas
  import pytest
  from nilearn._utils.data_gen import add_metadata_to_bids_dataset, create_fake_bids_dataset, generate_fake_fmri_data_and_design
  from nilearn.glm.first_level import FirstLevelModel
  from nilearn.glm.second_level import SecondLevelModel
  from nilearn.interfaces.bids import get_bids_files, parse_bids_filename, save_glm_to_bids
  from nilearn.interfaces.bids.query import _get_metadata_from_bids, infer_repetition_time_from_dataset, infer_slice_timing_start_time_from_dataset
  from nilearn.maskers import NiftiMasker
label_desc: Use image node_id 9 for calling a global function with example usage: test_save_glm_to_bids(tmp_path_factory) without return types