code: def test_xdawn_apply_transform():
      """Test Xdawn apply and transform."""
      # Get data
      raw, events, picks = _get_data()
      raw.pick(picks="eeg")
      epochs = Epochs(
          raw,
          events,
          event_id,
          tmin,
          tmax,
          proj=False,
          preload=True,
          baseline=None,
          verbose=False,
      )
      n_components = 2
      # Fit Xdawn
      xd = Xdawn(n_components=n_components, correct_overlap=False)
      xd.fit(epochs)
  
      # Apply on different types of instances
      for inst in [raw, epochs.average(), epochs]:
          denoise = xd.apply(inst)
      # Apply on other thing should raise an error
      pytest.raises(ValueError, xd.apply, 42)
  
      # Transform on Epochs
      xd.transform(epochs)
      # Transform on Evoked
      xd.transform(epochs.average())
      # Transform on ndarray
      xd.transform(epochs._data)
      xd.transform(epochs._data[0])
      # Transform on something else
      pytest.raises(ValueError, xd.transform, 42)
  
      # Check numerical results with shuffled epochs
      np.random.seed(0)  # random makes unstable linalg
      idx = np.arange(len(epochs))
      np.random.shuffle(idx)
      xd.fit(epochs[idx])
      denoise_shfl = xd.apply(epochs)
      assert_array_almost_equal(
          denoise["cond2"]._data, denoise_shfl["cond2"]._data
      )
  
file_path: mne-python/mne/preprocessing/tests/test_xdawn.py
imports: from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal
  from scipy import stats
  from mne import Epochs, EpochsArray, compute_raw_covariance, create_info, pick_types, read_events
  from mne.decoding import Vectorizer
  from mne.fixes import _safe_svd
  from mne.io import read_raw_fif
  from mne.preprocessing.xdawn import Xdawn, _XdawnTransformer
label_desc: Use image node_id 5 for calling a global function with example usage: test_xdawn_apply_transform() without return types