def test_lagged_prediction_data_invalid_lag_values_error(self):
        """
        Tests that `create_lagged_prediction_data` throws correct
        error when invalid lag values are specified. More specifically:
            - If `lags` contains any value greater than `-1`, an error
            should be thrown (since times > `-1` are used for labels).
            - If `lags_past_covariates`/`lags_future_covariates` contains
            any value greater than `0`, an error should be thrown (i.e. we
            shouldn't be predicting the past using the future).
        """
        series = linear_timeseries(start=1, length=3, freq=1)
        # Check error thrown by 'moving windows' method and by 'time intersection' method:
        for use_moving_windows in (False, True):
            # Test invalid `lags` values:
            with pytest.raises(ValueError) as err:
                create_lagged_prediction_data(
                    target_series=series,
                    lags=[0],
                    uses_static_covariates=False,
                    use_moving_windows=use_moving_windows,
                )
            assert (
                "`lags` must be a `Sequence` or `Dict` containing only `int` values less than 0."
            ) == str(err.value)
            # Test invalid `lags_past_covariates` values:
            with pytest.raises(ValueError) as err:
                create_lagged_prediction_data(
                    past_covariates=series,
                    lags_past_covariates=[0],
                    uses_static_covariates=False,
                    use_moving_windows=use_moving_windows,
                )
            assert (
                "`lags_past_covariates` must be a `Sequence` or `Dict` containing only `int` values less than 0."
            ) == str(err.value)
            # This should *not* throw an error:
            create_lagged_prediction_data(
                future_covariates=series,
                lags_future_covariates=[-1, 0, 1],
                uses_static_covariates=False,
                use_moving_windows=use_moving_windows,
            )

        Tests that `create_lagged_prediction_data` throws correct
        error when invalid lag values are specified. More specifically:
            - If `lags` contains any value greater than `-1`, an error
            should be thrown (since times > `-1` are used for labels).
            - If `lags_past_covariates`/`lags_future_covariates` contains
            any value greater than `0`, an error should be thrown (i.e. we
            shouldn't be predicting the past using the future).
        
darts/tests/utils/tabularization/test_create_lagged_prediction_data.py