code: def test_needs_eeg_average_ref_proj():
      """Test checking whether a recording needs an EEG average reference."""
      raw = read_raw_fif(raw_fname)
      assert _needs_eeg_average_ref_proj(raw.info)
  
      raw.set_eeg_reference(projection=True)
      assert not _needs_eeg_average_ref_proj(raw.info)
  
      # No EEG channels
      raw = read_raw_fif(raw_fname, preload=True)
      eeg = [
          raw.ch_names[c]
          for c in pick_types(raw.info, meg=False, eeg=True)
      ]
      raw.drop_channels(eeg)
      assert not _needs_eeg_average_ref_proj(raw.info)
  
      # Custom ref flag set
      raw = read_raw_fif(raw_fname)
      with raw.info._unlock():
          raw.info["custom_ref_applied"] = True
      assert not _needs_eeg_average_ref_proj(raw.info)
  
imports: import copy
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_equal
  from scipy import linalg
  from mne import Epochs, compute_proj_epochs, compute_proj_evoked, compute_proj_raw, compute_raw_covariance, convert_forward_solution, create_info, pick_types, read_events, read_forward_solution, read_source_estimate, sensitivity_map
  from mne._fiff.proj import _EEG_AVREF_PICK_DICT, _needs_eeg_average_ref_proj, activate_proj, make_projector, setup_proj
  from mne.cov import compute_whitener, regularize
  from mne.datasets import testing
  from mne.io import RawArray, read_raw_fif
  from mne.preprocessing import maxwell_filter
  from mne.proj import _has_eeg_average_ref_proj, make_eeg_average_ref_proj, read_proj, write_proj
  from mne.rank import _compute_rank_int
  from mne.utils import _record_warnings
label_desc: Use image node_id 9 for calling a global function with example usage: test_needs_eeg_average_ref_proj() without return types