code: def test_fit(self, config):
      # test fitting both on univariate and multivariate timeseries
      model, mode, series = config
      # auto-regression but past_covariates does not extend enough in the future
      with pytest.raises(ValueError):
          model_instance = model(
              lags=4, lags_past_covariates=4, multi_models=mode
          )
          model_instance.fit(
              series=series, past_covariates=self.sine_multivariate1
          )
          model_instance.predict(n=10)
  
      # inconsistent number of components in series Sequence[TimeSeries]
      training_series = [series.stack(series + 10), series]
      with pytest.raises(ValueError) as err:
          model_instance = model(lags=4, multi_models=mode)
          model_instance.fit(series=training_series)
      assert (
          str(err.value)
          == f"Expected {training_series[0].width} components but received {training_series[1].width} "
          f"components at index 1 of `series`."
      )
  
      # inconsistent number of components in past_covariates Sequence[TimeSeries]
      training_past_covs = [series, series.stack(series * 2)]
      with pytest.raises(ValueError) as err:
          model_instance = model(
              lags=4, lags_past_covariates=2, multi_models=mode
          )
          model_instance.fit(
              series=[series, series + 10],
              past_covariates=training_past_covs,
          )
      assert (
          str(err.value)
          == f"Expected {training_past_covs[0].width} components but received {training_past_covs[1].width} "
          f"components at index 1 of `past_covariates`."
      )
  
      model_instance = model(lags=12, multi_models=mode)
      model_instance.fit(series=series)
      assert model_instance.lags.get("past") is None
  
      model_instance = model(
          lags=12, lags_past_covariates=12, multi_models=mode
      )
      model_instance.fit(
          series=series, past_covariates=self.sine_multivariate1
      )
      assert len(model_instance.lags.get("past")) == 12
  
      model_instance = model(
          lags=12, lags_future_covariates=(0, 1), multi_models=mode
      )
      model_instance.fit(
          series=series, future_covariates=self.sine_multivariate1
      )
      assert len(model_instance.lags.get("future")) == 1
  
      model_instance = model(
          lags=12, lags_past_covariates=[-1, -4, -6], multi_models=mode
      )
      model_instance.fit(
          series=series, past_covariates=self.sine_multivariate1
      )
      assert len(model_instance.lags.get("past")) == 3
  
      model_instance = model(
          lags=12,
          lags_past_covariates=[-1, -4, -6],
          lags_future_covariates=[-2, 0],
          multi_models=mode,
      )
      model_instance.fit(
          series=series,
          past_covariates=self.sine_multivariate1,
          future_covariates=self.sine_multivariate1,
      )
      assert len(model_instance.lags.get("past")) == 3
  
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 8 for calling the TestRegressionModels obj's underlying member method code with example usage: obj.test_fit(config) without return types