def test_lagged_prediction_data_unspecified_lag_or_series_warning(self):
        """
        Tests that `create_lagged_prediction_data` throws correct
        user warnings when a series is specified without any
        corresponding lags, or vice versa.
        """
        series = linear_timeseries(start=1, length=20, freq=1)
        lags = [-1]
        # Check warnings thrown by 'moving windows' method and by 'time intersection' method:
        for use_moving_windows in (False, True):
            with warnings.catch_warnings(record=True) as w:
                _ = create_lagged_prediction_data(
                    target_series=series,
                    lags=lags,
                    future_covariates=series,
                    uses_static_covariates=False,
                    use_moving_windows=use_moving_windows,
                )
                assert len(w) == 1
                assert issubclass(w[0].category, UserWarning)
                assert str(w[0].message) == (
                    "`future_covariates` was specified without accompanying "
                    "`lags_future_covariates` and, thus, will be ignored."
                )
            # Specify `lags_future_covariates` but not `future_covariates`:
            with warnings.catch_warnings(record=True) as w:
                _ = create_lagged_prediction_data(
                    target_series=series,
                    lags=lags,
                    lags_future_covariates=lags,
                    uses_static_covariates=False,
                    use_moving_windows=use_moving_windows,
                )
                assert len(w) == 1
                assert issubclass(w[0].category, UserWarning)
                assert str(w[0].message) == (
                    "`lags_future_covariates` was specified without accompanying "
                    "`future_covariates` and, thus, will be ignored."
                )
            # Specify `lags_future_covariates` but not `future_covariates`, and
            # `past_covariates` but not `lags_past_covariates`, and `target_series`
            # but not `lags`:
            with warnings.catch_warnings(record=True) as w:
                _ = create_lagged_prediction_data(
                    target_series=series,
                    lags=lags,
                    past_covariates=series,
                    lags_future_covariates=lags,
                    uses_static_covariates=False,
                    use_moving_windows=use_moving_windows,
                )
                assert len(w) == 2
                assert issubclass(w[0].category, UserWarning)
                assert issubclass(w[1].category, UserWarning)
                assert str(w[0].message) == (
                    "`past_covariates` was specified without accompanying "
                    "`lags_past_covariates` and, thus, will be ignored."
                )
                assert str(w[1].message) == (
                    "`lags_future_covariates` was specified without accompanying "
                    "`future_covariates` and, thus, will be ignored."
                )
            # Specify `target_series` but not `lags` - this *should* throw
            # a warning when creating prediction data:
            with warnings.catch_warnings(record=True) as w:
                _ = create_lagged_prediction_data(
                    target_series=series,
                    past_covariates=series,
                    lags_past_covariates=lags,
                    uses_static_covariates=False,
                    use_moving_windows=use_moving_windows,
                )
                assert len(w) == 1
                assert issubclass(w[0].category, UserWarning)
                assert str(w[0].message) == (
                    "`target_series` was specified without accompanying "
                    "`lags` and, thus, will be ignored."
                )
            # Specify `target_series` but not `lags` - this *should* throw
            # a warning when creating prediction data:
            with warnings.catch_warnings(record=True) as w:
                _ = create_lagged_prediction_data(
                    lags=lags,
                    past_covariates=series,
                    lags_past_covariates=lags,
                    uses_static_covariates=False,
                    use_moving_windows=use_moving_windows,
                )
                assert len(w) == 1
                assert issubclass(w[0].category, UserWarning)
                assert str(w[0].message) == (
                    "`lags` was specified without accompanying "
                    "`target_series` and, thus, will be ignored."
                )

        Tests that `create_lagged_prediction_data` throws correct
        user warnings when a series is specified without any
        corresponding lags, or vice versa.
        
darts/tests/utils/tabularization/test_create_lagged_prediction_data.py