code: def test_degenerate(raw_data):
      """Test degenerate conditions."""
      raw, src, stc, trans, sphere = raw_data
      info = raw.info
      # Make impossible transform (translate up into helmet) and ensure failure
      hp_err = _get_head_pos_sim(raw)
      hp_err[1.0][2, 3] -= 0.1  # z trans upward 10cm
      with pytest.raises(
          RuntimeError, match="collided with inner skull"
      ):
          simulate_raw(info, stc, trans, src, sphere, head_pos=hp_err)
      # other degenerate conditions
      with pytest.raises(
          TypeError, match="info must be an instance of"
      ):
          simulate_raw("foo", stc, trans, src, sphere)
      with pytest.raises(TypeError, match="stc must be an instance of"):
          simulate_raw(info, "foo", trans, src, sphere)
      with pytest.raises(
          ValueError, match="stc must have at least three time"
      ):
          simulate_raw(info, stc.copy().crop(0, 0), trans, src, sphere)
      with pytest.raises(
          TypeError, match="must be an instance of Info"
      ):
          simulate_raw(0, stc, trans, src, sphere)
      stc_bad = stc.copy()
      stc_bad.tstep += 0.1
      with pytest.raises(ValueError, match="same sample rate"):
          simulate_raw(info, stc_bad, trans, src, sphere)
      with pytest.raises(ValueError, match="interp must be one of"):
          simulate_raw(info, stc, trans, src, sphere, interp="foo")
      with pytest.raises(TypeError, match="unknown head_pos type"):
          simulate_raw(info, stc, trans, src, sphere, head_pos=1.0)
      head_pos_sim_err = _get_head_pos_sim(raw)
      head_pos_sim_err[-1.0] = head_pos_sim_err[1.0]  # negative time
      with pytest.raises(RuntimeError, match="All position times"):
          simulate_raw(
              info, stc, trans, src, sphere, head_pos=head_pos_sim_err
          )
      raw_bad = raw.copy()
      with raw_bad.info._unlock():
          raw_bad.info["dig"] = None
      with pytest.raises(RuntimeError, match="Cannot fit headshape"):
          add_eog(raw_bad)
  
imports: from copy import deepcopy
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal
  from mne import Epochs, SourceEstimate, VolSourceEstimate, convert_forward_solution, create_info, find_events, fit_dipole, make_ad_hoc_cov, make_bem_solution, make_forward_solution, make_sphere_model, pick_types, read_bem_solution, read_cov, read_source_spaces, read_trans, setup_source_space, setup_volume_source_space, transform_surface_to
  from mne._fiff.constants import FIFF
  from mne.bem import _surfaces_to_bem
  from mne.chpi import compute_chpi_amplitudes, compute_chpi_locs, compute_head_pos, get_chpi_info, read_head_pos
  from mne.datasets import testing
  from mne.io import RawArray, read_raw_fif
  from mne.label import Label
  from mne.simulation import add_chpi, add_ecg, add_eog, add_noise, simulate_raw, simulate_sparse_stc
  from mne.simulation.source import SourceSimulator
  from mne.source_space._source_space import _compare_source_spaces
  from mne.surface import _get_ico_surface
  from mne.tests.test_chpi import _assert_quats
  from mne.utils import catch_logging
label_desc: Use image node_id 7 for calling a global function with example usage: test_degenerate(raw_data) without return types