def test_gridsearch_sample_weight(self, config):
        """check that passing sample weights work and that it yields different results than without sample weights."""
        manual_weight, use_val_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"

        parameters = {"lags": [3], "output_chunk_length": [1]}
        start_kwargs = {"start": -1, "start_format": "position"}
        gs_kwargs = {"val_series": ts} if use_val_series else {"forecast_horizon": 1}
        gs_non_weighted = LinearRegressionModel.gridsearch(
            parameters, series=ts[:-1], **start_kwargs, **gs_kwargs
        )[-1]

        gs_weighted = LinearRegressionModel.gridsearch(
            parameters,
            series=ts[:-1],
            sample_weight=sample_weight,
            **start_kwargs,
            **gs_kwargs,
        )[-1]

        # check that the predictions are different
        assert gs_weighted != gs_non_weighted
check that passing sample weights work and that it yields different results than without sample weights.
darts/tests/models/forecasting/test_backtesting.py