code: def test_transformer_multi_series(self):
      ts1 = tg.linear_timeseries(
          start_value=1,
          end_value=2,
          length=21,
          freq="T",
          column_name="cov",
      )
      ts2 = tg.linear_timeseries(
          start=None,
          end=ts1.end_time(),
          start_value=1.5,
          end_value=2,
          length=11,
          freq="T",
          column_name="cov",
      )
      ts1_inf = ts1.drop_before(ts2.start_time() - ts1.freq)
      ts2_inf = ts2
      encoder_params = {
          "datetime_attribute": {
              "past": ["minute"],
              "future": ["minute"],
          },
          "position": {"future": ["relative"]},
          "transformer": Scaler(),
      }
  
      ocl = 6
      enc_base = SequentialEncoder(
          add_encoders=encoder_params,
          input_chunk_length=11,
          output_chunk_length=ocl,
          takes_past_covariates=True,
          takes_future_covariates=True,
      )
  
      # ====> TEST Transformation starting from multi-TimeSeries input: transformer is globally fit per encoded
      # component
      enc = copy.deepcopy(enc_base)
      pc, fc = enc.encode_train(
          [ts1, ts2], future_covariates=[ts1, ts2]
      )
      # user supplied covariates should not be transformed
      assert fc[0]["cov"] == ts1
      assert fc[1]["cov"] == ts2
      # check that first covariate series ranges from 0. to 1. and second from ~0.7 to 1.
      for covs, cov_name in zip(
          [pc, fc],
          ["darts_enc_pc_dta_minute", "darts_enc_fc_dta_minute"],
      ):
          assert (
              abs(covs[0][cov_name].values(copy=False).min() - 0.0)
              < 10e-9
          )
          assert (
              abs(covs[0][cov_name].values(copy=False).max() - 1.0)
              < 10e-9
          )
          assert (
              covs[0][cov_name].univariate_values(copy=False)[-4]
              == covs[1][cov_name].univariate_values(copy=False)[-4]
          )
          if "pc" in cov_name:
              assert (
                  abs(
                      covs[1][cov_name].values(copy=False).min() - 0.714
                  )
                  < 1e-2
              )
          else:
              assert (
                  abs(covs[1][cov_name].values(copy=False).min() - 0.5)
                  < 1e-2
              )
          assert (
              abs(covs[1][cov_name].values(copy=False).max() - 1.0)
              < 10e-9
          )
  
      # check the same for inference
      pc, fc = enc.encode_inference(
          n=6, target=[ts1, ts2], future_covariates=[ts1_inf, ts2_inf]
      )
      for covs, cov_name in zip(
          [pc, fc],
          ["darts_enc_pc_dta_minute", "darts_enc_fc_dta_minute"],
      ):
          for cov in covs:
              if "pc" in cov_name:
                  assert (
                      cov[cov_name][-(ocl + 1)].univariate_values()[0]
                      == 1.0
                  )
              else:
                  assert (
                      cov[cov_name][ts1.end_time()].univariate_values()[
                          0
                      ]
                      == 1.0
                  )
  
      # check the same for only supplying single series as input
      pc, fc = enc.encode_inference(
          n=6, target=ts2, future_covariates=ts2_inf
      )
      for cov, cov_name in zip(
          [pc, fc],
          ["darts_enc_pc_dta_minute", "darts_enc_fc_dta_minute"],
      ):
          if "pc" in cov_name:
              assert (
                  cov[cov_name][-(ocl + 1)].univariate_values()[0]
                  == 1.0
              )
          else:
              assert (
                  cov[cov_name][ts1.end_time()].univariate_values()[0]
                  == 1.0
              )
  
      # ====> TEST Transformation starting from single-TimeSeries input: transformer is fit per component of a single
      # encoded series
      enc = copy.deepcopy(enc_base)
      pc, fc = enc.encode_train(ts2, future_covariates=ts2)
      # user supplied covariates should not be transformed
      assert fc["cov"] == ts2
      for covs, cov_name in zip(
          [pc, fc],
          ["darts_enc_pc_dta_minute", "darts_enc_fc_dta_minute"],
      ):
          assert (
              abs(covs[cov_name].values(copy=False).min() - 0.0) < 10e-9
          )
          assert (
              abs(covs[cov_name].values(copy=False).max() - 1.0) < 10e-9
          )
  
      # second time fitting will not fit transformers again
      pc, fc = enc.encode_train(
          [ts1, ts2], future_covariates=[ts1, ts2]
      )
      for covs, cov_name in zip(
          [pc, fc],
          ["darts_enc_pc_dta_minute", "darts_enc_fc_dta_minute"],
      ):
          if "pc" in cov_name:
              assert (
                  abs(covs[0][cov_name].values(copy=False).min() + 2.5)
                  < 10e-9
              )
          else:
              assert (
                  abs(covs[0][cov_name].values(copy=False).min() + 1.0)
                  < 10e-9
              )
          assert (
              abs(covs[0][cov_name].values(copy=False).max() - 1.0)
              < 10e-9
          )
          assert (
              abs(covs[1][cov_name].values(copy=False).min() - 0.0)
              < 10e-9
          )
          assert (
              abs(covs[1][cov_name].values(copy=False).max() - 1.0)
              < 10e-9
          )
  
      # check inference with single series
      pc, fc = enc.encode_inference(
          n=6, target=ts2, future_covariates=ts2_inf
      )
      for cov, cov_name in zip(
          [pc, fc],
          ["darts_enc_pc_dta_minute", "darts_enc_fc_dta_minute"],
      ):
          assert (
              abs(cov[cov_name].values(copy=False).min() - 0.0) < 10e-9
          )
          if "pc" in cov_name:
              assert (
                  abs(cov[cov_name].values(copy=False).max() - 2.5)
                  < 10e-9
              )
          else:
              assert (
                  abs(cov[cov_name].values(copy=False).max() - 1.0)
                  < 10e-9
              )
  
      # check the same for supplying multiple series as input
      pc, fc = enc.encode_inference(
          n=6, target=[ts1, ts2], future_covariates=[ts1_inf, ts2_inf]
      )
      for covs, cov_name in zip(
          [pc, fc],
          ["darts_enc_pc_dta_minute", "darts_enc_fc_dta_minute"],
      ):
          for cov in covs:
              assert (
                  abs(cov[cov_name].values(copy=False).min() - 0.0)
                  < 10e-9
              )
              if "pc" in cov_name:
                  assert (
                      abs(cov[cov_name].values(copy=False).max() - 2.5)
                      < 10e-9
                  )
              else:
                  assert (
                      abs(cov[cov_name].values(copy=False).max() - 1.0)
                      < 10e-9
                  )
  
imports: import copy
  from typing import Optional, Sequence
  import numpy
  import pandas
  import pytest
  from darts import TimeSeries
  from darts.dataprocessing.encoders import FutureCallableIndexEncoder, FutureCyclicEncoder, FutureDatetimeAttributeEncoder, FutureIntegerIndexEncoder, PastCallableIndexEncoder, PastCyclicEncoder, PastDatetimeAttributeEncoder, PastIntegerIndexEncoder, SequentialEncoder
  from darts.dataprocessing.encoders.encoder_base import PastCovariatesIndexGenerator, SingleEncoder
  from darts.dataprocessing.encoders.encoders import CallableIndexEncoder, CyclicTemporalEncoder, DatetimeAttributeEncoder, IntegerIndexEncoder
  from darts.dataprocessing.transformers import Scaler
  from darts.logging import get_logger, raise_log
  from darts.utils import timeseries_generation
label_desc: Use image node_id 13 for calling the TestEncoder obj's underlying member method code with example usage: obj.test_transformer_multi_series() without return types