def test_invalid_sample_weights(self, use_moving_windows):
        """Checks invalid weights raise error with and without moving window tabularization
        - too short series
        - not enough series
        - invalid string
        - weights shape does not match number of `series` components
        """
        training_size = 10

        train_y = linear_timeseries(length=training_size)
        weights_too_short = train_y[:-2]
        with pytest.raises(ValueError) as err:
            _ = create_lagged_training_data(
                lags=[-4, -1],
                target_series=train_y,
                output_chunk_length=1,
                uses_static_covariates=False,
                sample_weight=weights_too_short,
                output_chunk_shift=0,
                use_moving_windows=use_moving_windows,
            )
        assert (
            str(err.value)
            == "The `sample_weight` series must have at least the same times as the target `series`."
        )

        with pytest.raises(ValueError) as err:
            _ = create_lagged_training_data(
                lags=[-4, -1],
                target_series=[train_y] * 2,
                output_chunk_length=1,
                uses_static_covariates=False,
                sample_weight=[train_y],
                output_chunk_shift=0,
                use_moving_windows=use_moving_windows,
            )
        assert (
            str(err.value)
            == "The provided sequence of target `series` must have the same length as the provided sequence "
            "of `sample_weight`."
        )

        with pytest.raises(ValueError) as err:
            _ = create_lagged_training_data(
                lags=[-4, -1],
                target_series=[train_y] * 2,
                output_chunk_length=1,
                uses_static_covariates=False,
                sample_weight="invalid",
                output_chunk_shift=0,
                use_moving_windows=use_moving_windows,
            )
        assert str(err.value).startswith("Invalid `sample_weight` value: `'invalid'`. ")

        with pytest.raises(ValueError) as err:
            _ = create_lagged_training_data(
                lags=[-4, -1],
                target_series=train_y,
                output_chunk_length=1,
                uses_static_covariates=False,
                sample_weight=train_y.stack(train_y),
                output_chunk_shift=0,
                use_moving_windows=use_moving_windows,
            )
        assert str(err.value) == (
            "The number of components in `sample_weight` must either be `1` or "
            "match the number of target series components `1`."
        )
Checks invalid weights raise error with and without moving window tabularization
        - too short series
        - not enough series
        - invalid string
        - weights shape does not match number of `series` components
        
darts/tests/utils/tabularization/test_create_lagged_training_data.py