code: def test_tlclassifier_mdm(
      rndstate, clf, source_domain, target_domain
  ):
      """Test wrapper for MDM classifier in transfer learning"""
      n_matrices = 40
      X, y_enc = make_classification_transfer(
          n_matrices=n_matrices // 4,
          class_sep=5,
          class_disp=1.0,
          random_state=rndstate,
      )
  
      tlclf = TLClassifier(target_domain="target_domain", estimator=clf)
      tlclf.domain_weight = {
          "source_domain": source_domain,
          "target_domain": target_domain,
      }
      tlclf.fit(X, y_enc)
  
      X, y, domain = decode_domains(X, y_enc)
      X_source = X[domain == "source_domain"]
      y_source = y[domain == "source_domain"]
      X_target = X[domain == "target_domain"]
      y_target = y[domain == "target_domain"]
  
      if source_domain == 1.0 and target_domain == 0.0:
          X_0 = X_source[y_source == tlclf.estimator.classes_[0]]
          X_1 = X_source[y_source == tlclf.estimator.classes_[1]]
      elif source_domain == 0.0 and target_domain == 1.0:
          X_0 = X_target[y_target == tlclf.estimator.classes_[0]]
          X_1 = X_target[y_target == tlclf.estimator.classes_[1]]
      elif source_domain == 1.0 and target_domain == 1.0:
          X_0 = X[y == tlclf.estimator.classes_[0]]
          X_1 = X[y == tlclf.estimator.classes_[1]]
  
      if isinstance(clf, MDM):
          est = tlclf.estimator
      elif isinstance(clf, Pipeline):
          est = tlclf.estimator.steps[0][1]
  
      # test class centroids
      assert est.covmeans_[0] == pytest.approx(mean_riemann(X_0))
      assert est.covmeans_[1] == pytest.approx(mean_riemann(X_1))
  
imports: import pytest
  from pytest import approx
  import numpy
  from numpy.testing import assert_array_equal
  from sklearn.model_selection import KFold, StratifiedShuffleSplit
  from sklearn.pipeline import make_pipeline, Pipeline
  from pyriemann.datasets.simulated import make_classification_transfer, make_matrices
  from pyriemann.classification import MDM, FgMDM, KNearestNeighbor, TSclassifier, SVC, MeanField
  from pyriemann.regression import KNearestNeighborRegressor, SVR
  from pyriemann.transfer import decode_domains, encode_domains, TLCenter, TLStretch, TLRotate, TLSplitter, TLClassifier, TLRegressor, MDWM
  from pyriemann.utils.distance import distance, distance_riemann
  from pyriemann.utils.mean import mean_covariance, mean_riemann
  from pyriemann.utils.utils import check_weights
label_desc: Use image node_id 6 for calling a global function with example usage: test_tlclassifier_mdm(rndstate, clf, source_domain, target_domain) without return types