code: def test_encoders(self, config):
      model_cls, mode, ocl = config
      max_past_lag = -4
      max_future_lag = 4
      # target
      t1 = tg.linear_timeseries(
          start=pd.Timestamp("2000-01-01"),
          end=pd.Timestamp("2000-12-01"),
          freq="MS",
      )
      t2 = tg.linear_timeseries(
          start=pd.Timestamp("2001-01-01"),
          end=pd.Timestamp("2001-12-01"),
          freq="MS",
      )
      ts = [t1, t2]
  
      # past and future covariates longer than target
      n_comp = 2
      covs = TimeSeries.from_times_and_values(
          tg.generate_index(
              start=pd.Timestamp("1999-01-01"),
              end=pd.Timestamp("2002-12-01"),
              freq="MS",
          ),
          values=np.random.randn(48, n_comp),
      )
      pc = [covs, covs]
      fc = [covs, covs]
      examples = ["past", "future", "mixed"]
      covariates_examples = {
          "past": {"past_covariates": pc},
          "future": {"future_covariates": fc},
          "mixed": {"past_covariates": pc, "future_covariates": fc},
      }
      encoder_examples = {
          "past": {"datetime_attribute": {"past": ["hour"]}},
          "future": {"cyclic": {"future": ["hour"]}},
          "mixed": {
              "datetime_attribute": {"past": ["hour"]},
              "cyclic": {"future": ["hour"]},
          },
      }
      model_pc_valid0 = model_cls(
          lags=2,
          add_encoders=encoder_examples["past"],
          multi_models=mode,
          output_chunk_length=ocl,
      )
      model_fc_valid0 = model_cls(
          lags=2,
          add_encoders=encoder_examples["future"],
          multi_models=mode,
          output_chunk_length=ocl,
      )
      model_mixed_valid0 = model_cls(
          lags=2,
          add_encoders=encoder_examples["mixed"],
          multi_models=mode,
          output_chunk_length=ocl,
      )
  
      # encoders will not generate covariates without lags
      for model in [
          model_pc_valid0,
          model_fc_valid0,
          model_mixed_valid0,
      ]:
          model.fit(ts)
          assert not model.encoders.encoding_available
          _ = model.predict(n=1, series=ts)
          _ = model.predict(n=3, series=ts)
  
      model_pc_valid0 = model_cls(
          lags_past_covariates=[-2],
          add_encoders=encoder_examples["past"],
          multi_models=mode,
          output_chunk_length=ocl,
      )
      model_fc_valid0 = model_cls(
          lags_future_covariates=[-1, 0],
          add_encoders=encoder_examples["future"],
          multi_models=mode,
          output_chunk_length=ocl,
      )
      model_mixed_valid0 = model_cls(
          lags_past_covariates=[-2, -1],
          lags_future_covariates=[-3, 3],
          add_encoders=encoder_examples["mixed"],
          multi_models=mode,
          output_chunk_length=ocl,
      )
      # check that fit/predict works with model internal covariate requirement checks
      for model in [
          model_pc_valid0,
          model_fc_valid0,
          model_mixed_valid0,
      ]:
          model.fit(ts)
          assert model.encoders.encoding_available
          _ = model.predict(n=1, series=ts)
          _ = model.predict(n=3, series=ts)
  
      model_pc_valid1 = model_cls(
          lags=2,
          lags_past_covariates=[max_past_lag, -1],
          add_encoders=encoder_examples["past"],
          multi_models=mode,
          output_chunk_length=ocl,
      )
      model_fc_valid1 = model_cls(
          lags=2,
          lags_future_covariates=[0, max_future_lag],
          add_encoders=encoder_examples["future"],
          multi_models=mode,
          output_chunk_length=ocl,
      )
      model_mixed_valid1 = model_cls(
          lags=2,
          lags_past_covariates=[max_past_lag, -1],
          lags_future_covariates=[0, max_future_lag],
          add_encoders=encoder_examples["mixed"],
          multi_models=mode,
          output_chunk_length=ocl,
      )
  
      for model, ex in zip(
          [model_pc_valid1, model_fc_valid1, model_mixed_valid1],
          examples,
      ):
          covariates = covariates_examples[ex]
          # don't pass covariates, let them be generated by encoders. Test single target series input
          model_copy = copy.deepcopy(model)
          model_copy.fit(ts[0])
          assert model_copy.encoders.encoding_available
          self.helper_test_encoders_settings(model_copy, ex)
          _ = model_copy.predict(n=1, series=ts)
          self.helper_compare_encoded_covs_with_ref(
              model_copy, ts, covariates, n=1, ocl=ocl, multi_model=mode
          )
  
          _ = model_copy.predict(n=3, series=ts)
          self.helper_compare_encoded_covs_with_ref(
              model_copy, ts, covariates, n=3, ocl=ocl, multi_model=mode
          )
  
          _ = model_copy.predict(n=8, series=ts)
          self.helper_compare_encoded_covs_with_ref(
              model_copy, ts, covariates, n=8, ocl=ocl, multi_model=mode
          )
  
          # manually pass covariates, let encoders add more
          model.fit(ts, **covariates)
          assert model.encoders.encoding_available
          self.helper_test_encoders_settings(model, ex)
          _ = model.predict(n=1, series=ts, **covariates)
          _ = model.predict(n=3, series=ts, **covariates)
          _ = model.predict(n=8, series=ts, **covariates)
  
imports: import copy
  import functools
  import itertools
  import math
  from unittest.mock import patch
  import numpy
  import pandas
  import pytest
  from sklearn.ensemble import HistGradientBoostingRegressor, RandomForestRegressor
  from sklearn.linear_model import LinearRegression
  import darts
  from darts import TimeSeries
  from darts.dataprocessing.encoders import FutureCyclicEncoder, PastDatetimeAttributeEncoder
  from darts.logging import get_logger
  from darts.metrics import mae, rmse
  from darts.models import CatBoostModel, LightGBMModel, LinearRegressionModel, NotImportedModule, RandomForest, RegressionModel, XGBModel
  from darts.utils import timeseries_generation
  from darts.utils.multioutput import MultiOutputRegressor
label_desc: Use image node_id 26 for calling the TestRegressionModels obj's underlying member method code with example usage: obj.test_encoders(config) without return types