def test_trained_models(self):
        """EnsembleModels can be instantiated with pre-trained GlobalForecastingModels"""
        local_model = NaiveDrift()
        global_model = LinearRegressionModel(lags=2)
        local_model.fit(self.series1)
        global_model.fit(self.series1)

        # local and global trained
        with pytest.raises(ValueError):
            NaiveEnsembleModel([local_model, global_model])

        # local untrained, global trained
        with pytest.raises(ValueError):
            NaiveEnsembleModel([local_model.untrained_model(), global_model])

        # local trained, global untrained
        with pytest.raises(ValueError):
            NaiveEnsembleModel([local_model, global_model.untrained_model()])

        # global trained, global untrained
        with pytest.raises(ValueError):
            NaiveEnsembleModel([global_model, global_model.untrained_model()])

        # both global trained, retrain = True
        with pytest.raises(ValueError):
            # models need to be explicitly reset before retraining them
            NaiveEnsembleModel(
                [global_model, global_model], train_forecasting_models=True
            )
        model_ens_retrain = NaiveEnsembleModel(
            [global_model.untrained_model(), global_model.untrained_model()],
            train_forecasting_models=True,
        )
        with pytest.raises(ValueError):
            model_ens_retrain.predict(1, series=self.series1)
        model_ens_retrain.fit(self.series1)
        model_ens_retrain.predict(1, series=self.series1)

        # both global trained, retrain = False
        model_ens_no_retrain = NaiveEnsembleModel(
            [global_model, global_model], train_forecasting_models=False
        )
        model_ens_no_retrain.predict(1, series=self.series1)
EnsembleModels can be instantiated with pre-trained GlobalForecastingModels
darts/tests/models/forecasting/test_ensemble_models.py