code: def test_classifier(n_classes, classif, get_mats, get_labels):
      if n_classes == 2:
          n_matrices, n_channels = 6, 3
      else:
          assert n_classes == 3
          n_matrices, n_channels = 9, 3
      covmats = get_mats(n_matrices, n_channels, "spd")
      labels = get_labels(n_matrices, n_classes)
  
      clf_predict(classif, covmats, labels)
      clf_fit_independence(classif, covmats, labels)
      clf_predict_proba(classif, covmats, labels)
      clf_score(classif, covmats, labels)
      clf_populate_classes(classif, covmats, labels)
      if classif in (MDM, KNearestNeighbor, MeanField):
          clf_fitpredict(classif, covmats, labels)
      if classif in (MDM, FgMDM):
          clf_transform(classif, covmats, labels)
      if hasattr(classif(), "n_jobs"):
          clf_jobs(classif, covmats, labels)
      if hasattr(classif(), "tsupdate"):
          clf_tsupdate(classif, covmats, labels)
  
imports: import pickle
  import numpy
  from numpy.testing import assert_array_equal
  import pytest
  from pytest import approx
  from scipy.stats import mode
  from sklearn.dummy import DummyClassifier
  from conftest import get_distances, get_means, get_metrics
  from pyriemann.estimation import Covariances
  from pyriemann.utils.kernel import kernel
  from pyriemann.utils.mean import mean_covariance
  from pyriemann.classification import _mode_2d, MDM, FgMDM, KNearestNeighbor, TSclassifier, SVC, MeanField, class_distinctiveness
label_desc: Use image node_id 2 for calling a global function with example usage: test_classifier(n_classes, classif, get_mats, get_labels) without return types