code: def test_forecasting_residuals_cov_output(self):
      # if covariates are constant and the target is constant/linear,
      # residuals should be zero (for a LinearRegression model)
  
      target_series_1 = ct(value=0.5, length=10)
      target_series_2 = lt(length=10)
      past_covariates = ct(value=0.2, length=10)
      future_covariates = ct(value=0.1, length=10)
  
      model_1 = LinearRegressionModel(
          lags=1, lags_past_covariates=1, lags_future_covariates=(1, 1)
      )
      model_2 = LinearRegressionModel(
          lags=1, lags_past_covariates=1, lags_future_covariates=(1, 1)
      )
      model_1.fit(
          target_series_1,
          past_covariates=past_covariates,
          future_covariates=future_covariates,
      )
      residuals_1 = model_1.residuals(
          target_series_1,
          past_covariates=past_covariates,
          future_covariates=future_covariates,
      )
  
      model_2.fit(
          target_series_2,
          past_covariates=past_covariates,
          future_covariates=future_covariates,
      )
      residuals_2 = model_2.residuals(
          target_series_2,
          past_covariates=past_covariates,
          future_covariates=future_covariates,
      )
  
      # residuals zero
      np.testing.assert_almost_equal(
          residuals_1.univariate_values(), np.zeros(len(residuals_1))
      )
  
      np.testing.assert_almost_equal(
          residuals_2.univariate_values(), np.zeros(len(residuals_2))
      )
  
      # if model is trained with covariates, should raise error when covariates are missing in residuals()
      with pytest.raises(ValueError):
          model_1.residuals(target_series_1)
  
      with pytest.raises(ValueError):
          model_1.residuals(
              target_series_1, past_covariates=past_covariates
          )
  
      with pytest.raises(ValueError):
          model_1.residuals(
              target_series_1, future_covariates=future_covariates
          )
  
file_path: darts/darts/tests/utils/test_residuals.py
imports: import numpy
  import pytest
  from darts.logging import get_logger
  from darts.models import LinearRegressionModel, NaiveSeasonal
  from darts.tests.models.forecasting.test_regression_models import dummy_timeseries
  from darts.utils.timeseries_generation import constant_timeseries
  from darts.utils.timeseries_generation import linear_timeseries
label_desc: Use image node_id 3 for calling the TestResiduals obj's underlying member method code with example usage: obj.test_forecasting_residuals_cov_output() without return types