code: def test_transformer_single_series(self):
      def test_routine_cyclic(past_covs):
          for curve in ["sin", "cos"]:
              assert (
                  abs(
                      past_covs[f"darts_enc_pc_cyc_minute_{curve}"]
                      .all_values(copy=False)
                      .min()
                      + 1.0
                  )
                  < 1e-9
              )
              assert (
                  abs(
                      past_covs[f"darts_enc_pc_cyc_minute_{curve}"]
                      .values(copy=False)
                      .max()
                      - 1.0
                  )
                  < 0.1e-9
              )
  
      ts1 = tg.linear_timeseries(
          start_value=1,
          end_value=2,
          length=60,
          freq="T",
          column_name="cov_in",
      )
      encoder_params = {
          "position": {"future": ["relative"]},
          "cyclic": {"past": ["minute"]},
          "transformer": Scaler(),
      }
  
      encs = SequentialEncoder(
          add_encoders=encoder_params,
          input_chunk_length=12,
          output_chunk_length=6,
          takes_past_covariates=True,
          takes_future_covariates=True,
      )
  
      pc1, fc1 = encs.encode_train(ts1, future_covariates=ts1)
  
      # ===> train set test <===
      # user supplied covariates should not be transformed
      assert fc1["cov_in"] == ts1
      # cyclic encodings should not be transformed
      test_routine_cyclic(pc1)
      # all others should be transformed to values between 0 and 1
      assert (
          abs(
              fc1["darts_enc_fc_pos_relative"].values(copy=False).min()
              - 0.0
          )
          < 10e-9
      )
      assert (
          abs(
              fc1["darts_enc_fc_pos_relative"].values(copy=False).max()
              - 1.0
          )
          < 10e-9
      )
  
      # ===> validation set test <===
      ts2 = tg.linear_timeseries(
          start_value=1,
          end_value=2,
          start=ts1.end_time(),
          length=60,
          freq=ts1.freq,
          column_name="cov_in",
      )
      pc2, fc2 = encs.encode_train(ts2, future_covariates=ts2)
      # cyclic encodings should not be transformed
      test_routine_cyclic(pc2)
      # make sure that when calling encoders the second time, scalers are not fit again (for validation and inference)
      assert (
          abs(
              fc2["darts_enc_fc_pos_relative"].values(copy=False).min()
              - 0.0
          )
          < 10e-9
      )
      assert (
          abs(
              fc2["darts_enc_fc_pos_relative"].values(copy=False).max()
              - 1.0
          )
          < 10e-9
      )
  
      fc_inf = tg.linear_timeseries(
          start_value=1,
          end_value=3,
          length=80,
          freq="T",
          column_name="cov_in",
      )
      pc3, fc3 = encs.encode_inference(
          n=60, target=ts1, future_covariates=fc_inf
      )
  
      # cyclic encodings should not be transformed
      test_routine_cyclic(pc3)
      # index 0 is also start of train target series and value should be 0
      assert (
          round(
              abs(
                  fc3["darts_enc_fc_pos_relative"][0].values()[0, 0]
                  - 0.0
              ),
              7,
          )
          == 0
      )
      # index len(ts1) - 1 is the prediction point and value should be 0
      assert (
          round(
              abs(
                  fc3["darts_enc_fc_pos_relative"][
                      len(ts1) - 1
                  ].values()[0, 0]
                  - 1.0
              ),
              7,
          )
          == 0
      )
      # the future should scale proportional to distance to prediction point
      assert (
          abs(
              fc3["darts_enc_fc_pos_relative"][80 - 1].values()[0, 0]
              - 80 / 60
          )
          < 0.01
      )
  
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 12 for calling the TestEncoder obj's underlying member method code with example usage: obj.test_transformer_single_series() without return types