code: def test_spectrum_bads_exclude(raw):
      """Test bads are not removed unless exclude="bads"."""
      raw.pick("mag")  # get rid of IAS channel
      spect_no_excld = raw.compute_psd()
      spect_with_excld = raw.compute_psd(exclude="bads")
      assert raw.info["bads"] == spect_no_excld.info["bads"]
      assert spect_with_excld.info["bads"] == []
      assert set(raw.ch_names) - set(spect_with_excld.ch_names) == set(
          raw.info["bads"]
      )
  
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 8 for calling a global function with example usage: test_spectrum_bads_exclude(raw) without return types