def test_backtest_retrain(self, patch_retrain_func, params):
        """
        Test backtest method with different retrain arguments
        """
        model_cls, retrainable, multivariate, retrain, model_type, variate_args = params
        if variate_args is not None:
            if variate_args == "lr_univ_args":
                model_args = {"lags": [-1, -2, -3]}
            else:  # "lr_multiv_args"
                model_args = {
                    "lags": [-1, -2, -3],
                    "lags_past_covariates": [-1, -2, -3],
                }
        else:
            model_args = dict()
        model = model_cls(**model_args)

        if str(retrain) == "patch_retrain_func":
            retrain = patch_retrain_func

        series = self.ts_pass_train

        if (
            not isinstance(retrain, (int, bool, Callable))
            or (isinstance(retrain, int) and retrain < 0)
            or (isinstance(retrain, (Callable)) and (not retrainable))
            or ((retrain != 1) and (not retrainable))
        ):
            with pytest.raises(ValueError):
                _ = model.historical_forecasts(series, retrain=retrain)

        else:
            if isinstance(retrain, Mock):
                # resets patch_retrain_func call_count to 0
                retrain.call_count = 0
                retrain.side_effect = [True, False] * (len(series) // 2)

            fit_method_to_patch = (
                f"darts.models.forecasting.forecasting_model.{model_type}._fit_wrapper"
            )
            predict_method_to_patch = f"darts.models.forecasting.forecasting_model.{model_type}._predict_wrapper"

            with patch(fit_method_to_patch) as patch_fit_method:
                with patch(
                    predict_method_to_patch, side_effect=series
                ) as patch_predict_method:
                    # Set _fit_called attribute to True, otherwise retrain function is never called
                    model._fit_called = True

                    # run backtest
                    _ = model.historical_forecasts(
                        series,
                        past_covariates=series if multivariate else None,
                        retrain=retrain,
                    )

                    assert patch_predict_method.call_count > 1
                    assert patch_fit_method.call_count > 1

                    if isinstance(retrain, Mock):
                        # check that patch_retrain_func has been called at each iteration
                        assert retrain.call_count > 1

        Test backtest method with different retrain arguments
        
darts/tests/models/forecasting/test_local_forecasting_models.py