def test_lagged_prediction_data_series_too_short_error(self):
        """
        Tests that `create_lagged_prediction_data` throws correct error
        when supplied series is too short to generate any
        features from using the specified `lags`.
        """
        series = linear_timeseries(start=1, length=2, freq=1)
        # Check error thrown by 'moving windows' method and by 'time intersection' method:
        for use_moving_windows in (False, True):
            with pytest.raises(ValueError) as err:
                create_lagged_prediction_data(
                    target_series=series,
                    lags=[-20, -1],
                    uses_static_covariates=False,
                    use_moving_windows=use_moving_windows,
                )
            assert (
                "`target_series` must have at least "
                "`-min(lags) + max(lags) + 1` = 20 "
                "time steps; instead, it only has 2."
            ) == str(err.value)
            with pytest.raises(ValueError) as err:
                create_lagged_prediction_data(
                    past_covariates=series,
                    lags_past_covariates=[-20, -1],
                    uses_static_covariates=False,
                    use_moving_windows=use_moving_windows,
                )
            assert (
                "`past_covariates` must have at least "
                "`-min(lags_past_covariates) + max(lags_past_covariates) + 1` = 20 "
                "time steps; instead, it only has 2."
            ) == str(err.value)

        Tests that `create_lagged_prediction_data` throws correct error
        when supplied series is too short to generate any
        features from using the specified `lags`.
        
darts/tests/utils/tabularization/test_create_lagged_prediction_data.py