docstr: Test `SingleEncoder.encode_train()`
docstr_tok: ["Test","`","SingleEncoder.encode_train","(",")","`"]
code: def helper_test_encoder_single_train(
      self,
      encoder: SingleEncoder,
      target: Sequence[TimeSeries],
      covariates: Sequence[Optional[TimeSeries]],
      result: Sequence[TimeSeries],
      merge_covariates: bool = True,
  ):
      """Test `SingleEncoder.encode_train()`"""
  
      encoded, encoded_train_inf = [], []
      for ts, cov in zip(target, covariates):
          encoded.append(
              encoder.encode_train(
                  ts, cov, merge_covariates=merge_covariates
              )
          )
          encoded_train_inf.append(
              encoder.encode_train_inference(
                  1, ts, cov, merge_covariates=merge_covariates
              )
          )
  
      expected_result = result
      # when user does not give covariates, and a past covariate encoder is used, the generate train covariates are
      # `output_chunk_length` steps shorter than the target series
      if covariates[0] is None and isinstance(
          encoder.index_generator, PastCovariatesIndexGenerator
      ):
          expected_result = [
              res[: -self.output_chunk_length] for res in result
          ]
  
      assert encoded == expected_result
      for enc, enc_train_inf in zip(encoded, encoded_train_inf):
          assert enc == enc_train_inf[enc.time_index]
  
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 15 for calling the TestEncoder obj's underlying member method code with example usage: obj.helper_test_encoder_single_train(encoder, target, covariates, result, merge_covariates) without return types