code: def test_constant_variance_forecast(self):
      vol = ConstantVariance()
      params = np.array([10.0])
      backcast = vol.backcast(self.resid)
      var_bounds = vol.variance_bounds(self.resid)
      forecast = vol.forecast(params, self.resid, backcast, var_bounds)
      assert np.all(np.isfinite(forecast.forecasts))
      assert forecast.forecasts[-1] == params[0]
      assert forecast.forecast_paths is None
      assert forecast.shocks is None
  
      forecast = vol.forecast(
          params, self.resid, backcast, var_bounds, horizon=5
      )
      assert forecast.forecasts.shape == (1, 5)
      assert np.all(np.isfinite(forecast.forecasts))
      assert np.all(forecast.forecasts == params[0])
      assert forecast.forecast_paths is None
      assert forecast.shocks is None
  
      forecast = vol.forecast(
          params, self.resid, backcast, var_bounds, start=100
      )
      assert forecast.forecasts.shape == (900, 1)
      assert np.all(np.isfinite(forecast.forecasts))
      assert np.all(forecast.forecasts == params[0])
      assert forecast.forecast_paths is None
      assert forecast.shocks is None
  
      forecast = vol.forecast(
          params, self.resid, backcast, var_bounds, start=100, horizon=3
      )
      assert forecast.forecasts.shape == (900, 3)
      assert np.all(np.isfinite(forecast.forecasts))
      assert np.all(forecast.forecasts == params[0])
      assert forecast.forecast_paths is None
      assert forecast.shocks is None
  
      with pytest.raises(ValueError):
          vol.forecast(
              params,
              self.resid,
              backcast,
              var_bounds,
              horizon=5,
              method="bootstrap",
              start=0,
              simulations=2000,
          )
  
imports: import numpy
  from numpy.random import RandomState
  from numpy.testing import assert_allclose
  import pandas
  import pytest
  from arch.univariate import arch_model
  from arch.univariate.distribution import Normal, StudentsT
  from arch.univariate.mean import ConstantMean
  from arch.univariate.volatility import APARCH, EGARCH, FIGARCH, GARCH, HARCH, BootstrapRng, ConstantVariance, EWMAVariance, FixedVariance, MIDASHyperbolic, RiskMetrics2006
label_desc: Use image node_id 2 for calling the TestVarianceForecasts obj's underlying member method code with example usage: obj.test_constant_variance_forecast() without return types