def test_fit_predict(self, config):
        """Tests fit and predict for univariate and multivariate time series."""
        (model_cls, model_kwargs), is_multivariate = config

        # min train series length for global naive models
        series = tg.linear_timeseries(length=icl)
        if is_multivariate:
            series.stack(series + 100)

        model = model_cls(**model_kwargs)
        assert not model.supports_probabilistic_prediction
        assert not model.supports_likelihood_parameter_prediction

        # calling predict before fit
        with pytest.raises(ValueError):
            model.predict(n=10)

        # calling fit with covariates
        if isinstance(model, GlobalForecastingModel):
            err_type = ValueError
            err_msg_content = "The model does not support"
        else:  # for local models, covariates are not part of signature
            err_type = TypeError
            err_msg_content = "got an unexpected keyword argument"
        with pytest.raises(err_type) as err:
            model.fit(series=series, past_covariates=series)
        assert err_msg_content in str(err.value)
        with pytest.raises(err_type) as err:
            model.fit(series=series, future_covariates=series)
        assert err_msg_content in str(err.value)

        model.fit(series=series)
        # calling predict with covariates
        with pytest.raises(err_type) as err:
            model.predict(n=10, past_covariates=series)
        assert err_msg_content in str(err.value)
        with pytest.raises(err_type) as err:
            model.predict(n=10, future_covariates=series)
        assert err_msg_content in str(err.value)

        # single series predict works with all models
        preds = model.predict(n=10)
        preds_start = series.end_time() + series.freq
        assert isinstance(preds, TimeSeries)
        assert len(preds) == 10
        assert preds.start_time() == preds_start
        assert preds.components.equals(series.components)

        if isinstance(model, LocalForecastingModel):
            # no series at prediction time
            with pytest.raises(err_type) as err:
                _ = model.predict(n=10, series=series)
            assert err_msg_content in str(err.value)
            # no multiple series prediction
            with pytest.raises(err_type) as err:
                _ = model.predict(n=10, series=[series, series])
            assert err_msg_content in str(err.value)
        else:
            preds = model.predict(n=10, series=series)
            assert isinstance(preds, TimeSeries)
            assert len(preds) == 10
            assert preds.start_time() == preds_start
            assert preds.components.equals(series.components)
            preds = model.predict(n=10, series=[series, series])
            assert isinstance(preds, list)
            assert len(preds) == 2
            assert all([isinstance(p, TimeSeries) for p in preds])
            assert all([len(p) == 10 for p in preds])
            assert all([p.start_time() == preds_start for p in preds])
            assert all([p.components.equals(series.components) for p in preds])

        # multiple series training only with global baselines
        if isinstance(model, LocalForecastingModel):
            with pytest.raises(ValueError) as err:
                model.fit(series=[series, series])
            assert "Train `series` must be a single `TimeSeries`." == str(err.value)
        else:
            model.fit(series=[series, series])
Tests fit and predict for univariate and multivariate time series.
darts/tests/models/forecasting/test_baseline_models.py