code: def test_csd():
      """Test constructing a CrossSpectralDensity."""
      csd = CrossSpectralDensity(
          [1, 2, 3],
          ["CH1", "CH2"],
          frequencies=1,
          n_fft=1,
          tmin=0,
          tmax=1,
      )
      assert_array_equal(
          csd._data, [[1], [2], [3]]
      )  # Conversion to 2D array
      assert_array_equal(csd.frequencies, [1])  # Conversion to 1D array
  
      # Channels don't match
      raises(
          ValueError,
          CrossSpectralDensity,
          [1, 2, 3],
          ["CH1", "CH2", "Too many!"],
          tmin=0,
          tmax=1,
          frequencies=1,
          n_fft=1,
      )
      raises(
          ValueError,
          CrossSpectralDensity,
          [1, 2, 3],
          ["too little"],
          tmin=0,
          tmax=1,
          frequencies=1,
          n_fft=1,
      )
  
      # Frequencies don't match
      raises(
          ValueError,
          CrossSpectralDensity,
          [[1, 2], [3, 4], [5, 6]],
          ["CH1", "CH2"],
          tmin=0,
          tmax=1,
          frequencies=1,
          n_fft=1,
      )
  
      # Invalid dims
      raises(
          ValueError,
          CrossSpectralDensity,
          [[[1]]],
          ["CH1"],
          frequencies=1,
          n_fft=1,
          tmin=0,
          tmax=1,
      )
  
imports: import pickle
  from itertools import product
  from os import path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal
  from pytest import raises
  import mne
  from mne.channels import equalize_channels
  from mne.proj import Projection
  from mne.time_frequency import CrossSpectralDensity, csd_array_fourier, csd_array_morlet, csd_array_multitaper, csd_fourier, csd_morlet, csd_multitaper, csd_tfr, pick_channels_csd, read_csd, tfr_morlet
  from mne.time_frequency.csd import _sym_mat_to_vector, _vector_to_sym_mat
  from mne.utils import sum_squared
label_desc: Use image node_id 2 for calling a global function with example usage: test_csd() without return types