code: def test_warn_inverse_operator(evoked, noise_cov):
      """Test MNE inverse warning without average EEG projection."""
      bad_info = evoked.info
      data = evoked.data
      tmax = evoked.tmax
      del evoked
      with bad_info._unlock():
          bad_info["projs"] = list()
      assert bad_info["bads"] == ["MEG 2443", "EEG 053"]
      fwd_op = convert_forward_solution(
          read_forward_solution(fname_fwd), surf_ori=True, copy=False
      )
      with pytest.raises(ValueError, match="greater than or"):
          make_inverse_operator(bad_info, fwd_op, noise_cov, depth=-0.1)
      noise_cov["projs"].pop(-1)  # get rid of avg EEG ref proj
      with pytest.warns(RuntimeWarning, match="reference"):
          inv = make_inverse_operator(bad_info, fwd_op, noise_cov)
      # Create MEG-only forward, create inverse (should not warn)
      fwd_meg = pick_channels_forward(
          fwd_op, bad_info["ch_names"][:306]
      )
      inv_meg = make_inverse_operator(bad_info, fwd_meg, noise_cov)
      # Create MEG-only inverse, apply to M/EEG data (raw, epochs, evoked)
      raw = mne.io.RawArray(data, bad_info)
      epochs = make_fixed_length_epochs(raw, duration=tmax).load_data()
      assert len(epochs) == 1
      evoked = epochs.average()
      evoked_cust = epochs.average().set_eeg_reference()
      assert evoked_cust.info["custom_ref_applied"]
      assert "eeg" in raw
      assert "meg" in raw
      for func, inst in (
          (apply_inverse_raw, raw),
          (apply_inverse_epochs, epochs),
          (apply_inverse, evoked),
          (apply_inverse, evoked_cust),
      ):
          with pytest.raises(ValueError, match="reference"):
              func(inst, inv, 1.0 / 9.0)
          func(inst, inv_meg, 1.0 / 9.0)
  
imports: import copy
  import re
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal, assert_array_less, assert_equal
  from scipy import sparse
  import mne
  from mne import Covariance, EvokedArray, SourceEstimate, combine_evoked, compute_raw_covariance, convert_forward_solution, make_ad_hoc_cov, make_forward_solution, make_sphere_model, pick_channels_forward, pick_types, pick_types_forward, read_cov, read_evokeds, read_forward_solution
  from mne.datasets import testing
  from mne.epochs import Epochs, EpochsArray, make_fixed_length_epochs
  from mne.event import read_events
  from mne.forward import apply_forward, is_fixed_orient, restrict_forward_to_stc
  from mne.io import read_info, read_raw_fif
  from mne.label import label_sign_flip, read_label
  from mne.minimum_norm import INVERSE_METHODS, apply_inverse, apply_inverse_cov, apply_inverse_epochs, apply_inverse_raw, apply_inverse_tfr_epochs, compute_rank_inverse, make_inverse_operator, prepare_inverse_operator, read_inverse_operator, write_inverse_operator
  from mne.source_estimate import VolSourceEstimate, read_source_estimate
  from mne.source_space._source_space import _get_src_nn
  from mne.surface import _normal_orth
  from mne.time_frequency import EpochsTFR
  from mne.utils import _record_warnings, catch_logging
label_desc: Use image node_id 6 for calling a global function with example usage: test_warn_inverse_operator(evoked, noise_cov) without return types