def test_historical_forecasts_no_target_lags_with_static_covs(self, lpo):
        """Tests that historical forecasts work without target lags but with static covariates.
        For last_points_only `True` and `False`."""
        ocl = 7
        series = tg.linear_timeseries(
            length=28, start=pd.Timestamp("2000-01-01"), freq="d"
        ).with_static_covariates(pd.Series([1.0]))

        model = LinearRegressionModel(
            lags=None,
            lags_future_covariates=(3, 0),
            output_chunk_length=ocl,
            use_static_covariates=True,
        )
        model.fit(series, future_covariates=series)

        preds1 = model.historical_forecasts(
            series,
            future_covariates=series,
            retrain=False,
            enable_optimization=True,
            last_points_only=lpo,
        )
        preds2 = model.historical_forecasts(
            series,
            future_covariates=series,
            retrain=False,
            enable_optimization=False,
            last_points_only=lpo,
        )
        if lpo:
            preds1 = [preds1]
            preds2 = [preds2]

        for p1, p2 in zip(preds1, preds2):
            np.testing.assert_array_almost_equal(p1.values(), p2.values())
Tests that historical forecasts work without target lags but with static covariates.
        For last_points_only `True` and `False`.
darts/tests/models/forecasting/test_sklearn_models.py