code: def test_tlrotate(rndstate, metric, sample_weight):
      """Test fit_transform method for rotating the datasets"""
      # check if the distance between the classes of each domain is reduced
      X, y_enc = make_classification_transfer(
          n_matrices=50,
          class_sep=3,
          class_disp=1.0,
          theta=np.pi / 2,
          random_state=rndstate,
      )
  
      if sample_weight:
          sample_weight_ = rndstate.rand(len(y_enc))
      else:
          sample_weight_ = None
      sample_weight_ = check_weights(sample_weight_, len(y_enc))
  
      rct = TLCenter(target_domain="target_domain", metric=metric)
      X_rct = rct.fit_transform(X, y_enc, sample_weight=sample_weight_)
      rot = TLRotate(target_domain="target_domain", metric=metric)
      X_rot = rot.fit_transform(
          X_rct, y_enc, sample_weight=sample_weight_
      )
  
      _, y, domain = decode_domains(X_rot, y_enc)
      for label in np.unique(y):
          d = "source_domain"
          M_rct_label_source = mean_riemann(
              X_rct[domain == d][y[domain == d] == label],
              sample_weight=sample_weight_[domain == d][
                  y[domain == d] == label
              ],
          )
          M_rot_label_source = mean_riemann(
              X_rot[domain == d][y[domain == d] == label],
              sample_weight=sample_weight_[domain == d][
                  y[domain == d] == label
              ],
          )
          d = "target_domain"
          M_rct_label_target = mean_riemann(
              X_rct[domain == d][y[domain == d] == label],
              sample_weight=sample_weight_[domain == d][
                  y[domain == d] == label
              ],
          )
          M_rot_label_target = mean_riemann(
              X_rot[domain == d][y[domain == d] == label],
              sample_weight=sample_weight_[domain == d][
                  y[domain == d] == label
              ],
          )
          d_rct = distance_riemann(
              M_rct_label_source, M_rct_label_target
          )
          d_rot = distance_riemann(
              M_rot_label_source, M_rot_label_target
          )
          assert d_rot <= d_rct
  
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 4 for calling a global function with example usage: test_tlrotate(rndstate, metric, sample_weight) without return types