code: def test_csp_init(n_filters, metric, log, get_mats, get_labels):
      n_classes, n_matrices, n_channels = 2, 6, 4
      covmats = get_mats(n_matrices, n_channels, "spd")
      labels = get_labels(n_matrices, n_classes)
      csp = CSP(nfilter=n_filters, metric=metric, log=log)
      Xtr = csp.fit(covmats, labels).transform(covmats)
      n_components = min(n_channels, n_filters)
      if log:
          assert Xtr.shape == (n_matrices, n_components)
      else:
          assert Xtr.shape == (n_matrices, n_components, n_components)
      assert csp.filters_.shape == (n_components, n_channels)
      assert csp.patterns_.shape == (n_components, n_channels)
  
imports: from conftest import get_metrics
  import pytest
  import numpy
  from numpy.testing import assert_array_equal
  from pyriemann.spatialfilters import Xdawn, CSP, SPoC, BilinearFilter, AJDC
label_desc: Use image node_id 8 for calling a global function with example usage: test_csp_init(n_filters, metric, log, get_mats, get_labels) without return types