def test_predict_kwargs(self, model_type, enable_optimization):
        """check that the parameters provided in predict_kwargs are correctly processed"""
        invalid_predict_kwargs = {"predict_likelihood_parameters": False}
        unsupported_predict_kwargs = {"unsupported": "unsupported"}
        if model_type == "regression":
            valid_predict_kwargs = {}
        else:
            valid_predict_kwargs = {"batch_size": 10}

        n = 2
        model = self.create_model(1, use_ll=False, model_type=model_type)

        # torch not available
        if model is None:
            return

        model.fit(series=self.ts_pass_train[:-n])

        # supported argument
        hist_fc = model.historical_forecasts(
            self.ts_pass_train,
            forecast_horizon=1,
            start=len(self.ts_pass_train) - n,
            retrain=False,
            enable_optimization=enable_optimization,
            predict_kwargs=valid_predict_kwargs,
        )

        assert hist_fc.components.equals(self.ts_pass_train.components)
        assert len(hist_fc) == n

        # passing unsupported prediction argument
        with pytest.raises(TypeError):
            hist_fc = model.historical_forecasts(
                self.ts_pass_train,
                forecast_horizon=1,
                start=len(self.ts_pass_train) - n,
                retrain=False,
                enable_optimization=enable_optimization,
                predict_kwargs=unsupported_predict_kwargs,
            )

        # passing hist_fc parameters in predict_kwargs, interfering with the logic
        with pytest.raises(ValueError) as msg:
            hist_fc = model.historical_forecasts(
                self.ts_pass_train,
                forecast_horizon=1,
                start=len(self.ts_pass_train) - n,
                retrain=False,
                enable_optimization=enable_optimization,
                predict_kwargs=invalid_predict_kwargs,
            )
        assert str(msg.value).startswith(
            "The following parameters cannot be passed in `predict_kwargs`"
        )
check that the parameters provided in predict_kwargs are correctly processed
darts/tests/utils/historical_forecasts/test_historical_forecasts.py