code: def test_save_glm_to_bids_errors(
      tmp_path_factory, two_runs_model, nb_cols_design_matrix
  ):
      """Test errors of save_glm_to_bids."""
      tmpdir = tmp_path_factory.mktemp("test_save_glm_to_bids_errors")
  
      # Contrast names must be strings
      contrasts = {5: np.eye(nb_cols_design_matrix)}
      contrast_types = {5: "F"}
  
      with pytest.raises(ValueError):
          save_glm_to_bids(
              model=two_runs_model,
              contrasts=contrasts,
              contrast_types=contrast_types,
              out_dir=tmpdir,
              prefix="sub-01_ses-01_task-nback",
          )
  
      # Contrast definitions must be strings, numpy arrays, or lists
      contrasts = {"effects of interest": 5}
      contrast_types = {"effects of interest": "F"}
  
      with pytest.raises(ValueError):
          save_glm_to_bids(
              model=two_runs_model,
              contrasts=contrasts,
              contrast_types=contrast_types,
              out_dir=tmpdir,
              prefix="sub-01_ses-01_task-nback",
          )
  
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 12 for calling a global function with example usage: test_save_glm_to_bids_errors(tmp_path_factory, two_runs_model, nb_cols_design_matrix) without return types