code: def test_csp_component_ordering():
      """Test that CSP component ordering works as expected."""
      x, y = deterministic_toy_data(["class_a", "class_b"])
  
      pytest.raises(ValueError, CSP, component_order="invalid")
  
      # component_order='alternate' only works with two classes
      csp = CSP(component_order="alternate")
      with pytest.raises(ValueError):
          csp.fit(np.zeros((3, 0, 0)), ["a", "b", "c"])
  
      p_alt = CSP(component_order="alternate").fit(x, y).patterns_
      p_mut = CSP(component_order="mutual_info").fit(x, y).patterns_
  
      # This permutation of p_alt and p_mut is explained by the particular
      # eigenvalues of the toy data: [0.06, 0.1,   0.5,  0.8].
      # p_alt arranges them to [0.8, 0.06, 0.5, 0.1]
      # p_mut arranges them to [0.06, 0.1, 0.8, 0.5]
      assert_array_almost_equal(p_alt, p_mut[[2, 0, 3, 1]])
  
file_path: mne-python/mne/decoding/tests/test_csp.py
imports: from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal, assert_array_equal, assert_equal
  from mne import Epochs, io, pick_types, read_events
  from mne.decoding.csp import CSP, SPoC, _ajd_pham
label_desc: Use image node_id 9 for calling a global function with example usage: test_csp_component_ordering() without return types