def test_lagged_training_data_extend_past_and_future_covariates(self, config):
        """
        Tests that `create_lagged_training_data` correctly handles case where features
        and labels can be created for a time that is *not* contained in `past_covariates`
        and/or `future_covariates`.

        More specifically, we define the series and lags such that a training example can
        be generated for time `target.end_time()`, even though this time isn't contained in
        neither `past` nor `future`.
        """
        output_chunk_shift, use_moving_windows, (series_type, freq) = config
        if series_type == "integer":
            target = linear_timeseries(
                start=0, length=10, start_value=1, end_value=2, freq=freq
            )
            past = linear_timeseries(
                start=0, length=8, start_value=2, end_value=3, freq=freq
            )
            future = linear_timeseries(
                start=0, length=6, start_value=3, end_value=4, freq=freq
            )
        else:
            target = linear_timeseries(
                start=pd.Timestamp("1/1/2000"),
                start_value=1,
                end_value=2,
                length=11,
                freq=freq,
            )
            past = linear_timeseries(
                start=pd.Timestamp("1/1/2000"),
                start_value=2,
                end_value=3,
                length=9,
                freq=freq,
            )
            future = linear_timeseries(
                start=pd.Timestamp("1/1/2000"),
                start_value=3,
                end_value=4,
                length=7,
                freq=freq,
            )

        # Can create feature for time `t = 10`, but this time isn't in `past` or `future`:
        lags = [-1]
        lags_past = [-2]
        lags_future = [-4]
        # Only want to check very last generated observation:
        max_samples_per_ts = 1
        # Expect `X` to be constructed from second-to-last value of `target` (i.e.
        # the value immediately prior to the label), and the very last values of
        # `past` and `future`:
        expected_X = np.concatenate([
            target.all_values(copy=False)[-2 - output_chunk_shift, :, 0],
            past.all_values(copy=False)[-1 - output_chunk_shift, :, 0],
            future.all_values(copy=False)[-1 - output_chunk_shift, :, 0],
        ]).reshape(1, -1, 1)
        # Label is very last value of `target`:
        expected_y = target.all_values(copy=False)[-1:, :, :]

        expected_times = generate_index(
            start=target.end_time() - output_chunk_shift * target.freq,
            length=1,
            freq=target.freq,
        )

        # Check correctness for both 'moving window' method
        # and 'time intersection' method:
        kwargs = {
            "expected_X": expected_X,
            "expected_y": expected_y,
            "expected_times_x": expected_times,
            "expected_times_y": expected_times,
            "target": target,
            "past_cov": past,
            "future_cov": future,
            "lags": lags,
            "lags_past": lags_past,
            "lags_future": lags_future,
            "output_chunk_length": 1,
            "output_chunk_shift": output_chunk_shift,
            "use_static_covariates": False,
            "multi_models": True,
            "max_samples_per_ts": max_samples_per_ts,
            "use_moving_windows": use_moving_windows,
            "concatenate": True,
            "stride": 1,
        }

        self.helper_check_lagged_data(convert_lags_to_dict=False, **kwargs)

        if use_moving_windows:
            self.helper_check_lagged_data(convert_lags_to_dict=True, **kwargs)
        else:
            with pytest.raises(ValueError) as err:
                self.helper_check_lagged_data(convert_lags_to_dict=True, **kwargs)
            assert str(err.value).startswith(
                "`use_moving_windows=False` is not supported when any of the lags"
            )

        Tests that `create_lagged_training_data` correctly handles case where features
        and labels can be created for a time that is *not* contained in `past_covariates`
        and/or `future_covariates`.

        More specifically, we define the series and lags such that a training example can
        be generated for time `target.end_time()`, even though this time isn't contained in
        neither `past` nor `future`.
        
darts/tests/utils/tabularization/test_create_lagged_training_data.py