def test_sample_weight(self, config):
        """check that passing sample weights work and that it yields different results than without sample weights."""
        manual_weight, multi_series = config
        ts = AirPassengersDataset().load()
        if manual_weight:
            sample_weight = np.linspace(0, 1, len(ts))
            sample_weight = ts.with_values(np.expand_dims(sample_weight, -1))
        else:
            sample_weight = "linear"

        if multi_series:
            ts = [ts] * 2
            sample_weight = [sample_weight] * 2 if manual_weight else sample_weight

        model = LinearRegressionModel(lags=3, output_chunk_length=1)
        start_kwargs = {"start": -1, "start_format": "position"}
        res_non_weighted = model.residuals(series=ts, values_only=True, **start_kwargs)

        model = LinearRegressionModel(lags=3, output_chunk_length=1)
        res_weighted = model.residuals(
            series=ts, sample_weight=sample_weight, values_only=True, **start_kwargs
        )

        if not multi_series:
            res_weighted = [res_weighted]
            res_non_weighted = [res_non_weighted]

        # check that the predictions are different
        for res_nw, res_w in zip(res_non_weighted, res_weighted):
            with pytest.raises(AssertionError):
                np.testing.assert_array_almost_equal(res_w, res_nw)
check that passing sample weights work and that it yields different results than without sample weights.
darts/tests/models/forecasting/test_residuals.py