code: def test_spectrum_reject_by_annot(raw):
      """Test rejecting by annotation.
  
      Cannot use raw_spectrum fixture here because we're testing reject_by_annotation in
      .compute_psd() method.
      """
      spect_no_annot = raw.compute_psd()
      raw.set_annotations(Annotations([1, 5], [3, 3], ["test", "test"]))
      spect_benign_annot = raw.compute_psd()
      raw.annotations.description = np.array(["bad_test", "bad_test"])
      spect_reject_annot = raw.compute_psd()
      spect_ignored_annot = raw.compute_psd(reject_by_annotation=False)
      # the only one that should be different is `spect_reject_annot`
      assert spect_no_annot == spect_benign_annot
      assert spect_no_annot == spect_ignored_annot
      assert spect_no_annot != spect_reject_annot
  
imports: from functools import partial
  import numpy
  import pytest
  from matplotlib.colors import same_color
  from numpy.testing import assert_array_equal
  from mne import Annotations
  from mne.time_frequency import read_spectrum
  from mne.time_frequency.spectrum import EpochsSpectrumArray, SpectrumArray
label_desc: Use image node_id 7 for calling a global function with example usage: test_spectrum_reject_by_annot(raw) without return types