def test_correct_user_weights(self, config):
        """Checks correct weights extraction for:
        - varying target series sizes
        - with and without moving window tabularization
        - weights with exact matching index and longer weights
        - single and multi horizon
        - with and without output chunk shift
        - datetime and integer index
        - single and multiple series
        - uni- and multivariate series
        """
        (
            training_size,
            use_moving_windows,
            weights_longer,
            ocl,
            ocs,
            freq,
            single_series,
            univar_series,
            stride,
        ) = config
        lags = [-4, -1]
        if not isinstance(freq, int):
            freq = pd.tseries.frequencies.to_offset(freq)
            start = pd.Timestamp("2000-01-01")
        else:
            start = 1

        train_y = linear_timeseries(
            start=start, end_value=training_size - 1, length=training_size, freq=freq
        )
        if not univar_series:
            train_y.stack(train_y)

        # weights are either longer or have the exact time index as the target series
        n_weights = len(train_y) + 2 * int(weights_longer)
        ts_weights = TimeSeries.from_times_and_values(
            times=generate_index(
                start=train_y.start_time() - int(weights_longer) * freq,
                length=n_weights,
                freq=freq,
            ),
            values=np.linspace(0, 1, n_weights),
        )
        if not univar_series:
            ts_weights.stack(ts_weights + 1.0)

        _, y, _, _, weights = create_lagged_training_data(
            lags=lags,
            target_series=train_y if single_series else [train_y] * 2,
            output_chunk_length=ocl,
            uses_static_covariates=False,
            sample_weight=ts_weights if single_series else [ts_weights] * 2,
            output_chunk_shift=ocs,
            use_moving_windows=use_moving_windows,
            stride=stride,
        )
        # weights shape must match label shape, since we have one
        # weight per sample and predict step
        assert weights.shape == y.shape

        # get the weights matching the index of the target series
        weights_exact = ts_weights.values()
        if weights_longer:
            weights_exact = weights_exact[1:-1]

        # the weights correspond to the same sample and time index as the `y` labels
        expected_weights = []
        len_y_single = len(y) if single_series else len(y) // 2
        for i in range(ocl):
            # Shift by (len_y_single - 1) * stride to have the right amount of values
            # Shift by i to account for the target shift due to multi_models=True
            # Shift by 1 to include the last element
            first_label_idx = len(weights_exact) - (len_y_single - 1) * stride - 1 - i
            # Shift by i to account for the target shift due to multi_models=True
            # Shift by i to have the correct amount of values
            # Shift by 1 to include the last element
            last_label_idx = len(weights_exact) - i * 2 + 1
            mask = slice(first_label_idx, last_label_idx, stride)
            expected_weights.append(weights_exact[mask])
        # ocl=0 is the last set of weights, without target shift
        expected_weights = np.concatenate(expected_weights[::-1], axis=1)
        if not single_series:
            expected_weights = np.concatenate([expected_weights] * 2, axis=0)
        np.testing.assert_array_almost_equal(weights[:, :, 0], expected_weights)
Checks correct weights extraction for:
        - varying target series sizes
        - with and without moving window tabularization
        - weights with exact matching index and longer weights
        - single and multi horizon
        - with and without output chunk shift
        - datetime and integer index
        - single and multiple series
        - uni- and multivariate series
        
darts/tests/utils/tabularization/test_create_lagged_training_data.py