code: def test_info_bad():
      """Test our info sanity checkers."""
      info = create_info(5, 1000.0, "eeg")
      info["description"] = "foo"
      info["experimenter"] = "bar"
      info["line_freq"] = 50.0
      info["bads"] = info["ch_names"][:1]
      info["temp"] = ("whatever", 1.0)
      with pytest.raises(RuntimeError, match=r"info\['temp'\]"):
          info["bad_key"] = 1.0
      for key, match in [
          ("sfreq", r"inst\.resample"),
          ("chs", r"inst\.add_channels"),
      ]:
          with pytest.raises(RuntimeError, match=match):
              info[key] = info[key]
      with pytest.raises(ValueError, match="between meg<->head"):
          info["dev_head_t"] = Transform("mri", "head", np.eye(4))
      assert isinstance(info["bads"], MNEBadsList)
      with pytest.raises(ValueError, match="do not exist in info"):
          info["bads"] = ["foo"]
      assert isinstance(info["bads"], MNEBadsList)
      with pytest.raises(ValueError, match="do not exist in info"):
          info["bads"] += ["foo"]
      assert isinstance(info["bads"], MNEBadsList)
      with pytest.raises(ValueError, match="do not exist in info"):
          info["bads"].append("foo")
      assert isinstance(info["bads"], MNEBadsList)
      with pytest.raises(ValueError, match="do not exist in info"):
          info["bads"].extend(["foo"])
      assert isinstance(info["bads"], MNEBadsList)
      x = info["bads"]
      with pytest.raises(ValueError, match="do not exist in info"):
          x.append("foo")
      assert info["bads"] == info["ch_names"][:1]  # unchonged
      x = info["bads"] + info["ch_names"][1:2]
      assert x == info["ch_names"][:2]
      assert not isinstance(x, MNEBadsList)  # plain list
      x = info["ch_names"][1:2] + info["bads"]
      assert (
          x == info["ch_names"][1::-1]
      )  # like [1, 0] in fancy indexing
      assert not isinstance(x, MNEBadsList)
  
imports: import pickle
  import string
  from datetime import date, datetime, timedelta, timezone
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal
  from scipy import sparse
  from mne import Annotations, Epochs, compute_covariance, make_forward_solution, make_sphere_model, pick_info, pick_types, read_cov, read_epochs, read_events, read_evokeds, read_forward_solution, setup_volume_source_space, write_cov, write_forward_solution
  from mne._fiff import meas_info
  from mne._fiff._digitization import DigPoint, _make_dig_points
  from mne._fiff.constants import FIFF
  from mne._fiff.meas_info import RAW_INFO_FIELDS, Info, MNEBadsList, _add_timedelta_to_stamp, _bad_chans_comp, _dt_to_stamp, _force_update_info, _get_valid_units, _merge_info, _read_extended_ch_info, _stamp_to_dt, anonymize_info, create_info, read_fiducials, read_info, write_fiducials, write_info
  from mne._fiff.proj import Projection
  from mne._fiff.tag import _coil_trans_to_loc, _loc_to_coil_trans
  from mne._fiff.write import DATE_NONE, _generate_meas_id
  from mne.channels import equalize_channels, make_standard_montage, read_polhemus_fastscan
  from mne.datasets import testing
  from mne.event import make_fixed_length_events
  from mne.io import BaseRaw, RawArray, read_raw_ctf, read_raw_fif
  from mne.minimum_norm import apply_inverse, make_inverse_operator, read_inverse_operator, write_inverse_operator
  from mne.transforms import Transform
  from mne.utils import _empty_hash, _record_warnings, assert_object_equal, catch_logging
label_desc: Use image node_id 29 for calling a global function with example usage: test_info_bad() without return types