code: def test_uncertainty(df):
      model = ConstantBaseForecastEstimator()
      model.time_col_ = TIME_COL
      model.value_col_ = VALUE_COL
  
      # Only coverage is given.
      # The default uncertainty method is used.
      model.fit_uncertainty(df=df, uncertainty_dict={})
  
      assert model.uncertainty_model is not None
      assert (
          model.uncertainty_model.UNCERTAINTY_METHOD
          == UncertaintyMethodEnum.simple_conditional_residuals.name
      )
  
      df_pred = model.predict_uncertainty(df=df)
      assert PREDICTED_LOWER_COL in df_pred.columns
      assert PREDICTED_UPPER_COL in df_pred.columns
      assert (
          (df_pred[PREDICTED_LOWER_COL] + df_pred[PREDICTED_UPPER_COL])
          .round(2)
          .equals((df_pred[PREDICTED_COL] * 2).round(2))
      )
  
      # Both coverage and uncertainty dict are given.
      model.fit_uncertainty(
          df=df,
          uncertainty_dict=dict(
              uncertainty_method=UncertaintyMethodEnum.simple_conditional_residuals.name,
              params=dict(value_col=VALUE_COL, is_residual_based=True),
          ),
      )
  
      assert model.uncertainty_model is not None
      assert (
          model.uncertainty_model.UNCERTAINTY_METHOD
          == UncertaintyMethodEnum.simple_conditional_residuals.name
      )
  
      df_pred = model.predict_uncertainty(df=df)
      assert PREDICTED_LOWER_COL in df_pred.columns
      assert PREDICTED_UPPER_COL in df_pred.columns
      assert (
          (df_pred[PREDICTED_LOWER_COL] + df_pred[PREDICTED_UPPER_COL])
          .round(2)
          .equals((df_pred[PREDICTED_COL] * 2).round(2))
      )
  
imports: import numpy
  import pandas
  import pytest
  from pandas.testing import assert_frame_equal
  from sklearn.metrics import mean_absolute_error
  from sklearn.metrics import mean_squared_error
  from testfixtures import LogCapture
  from greykite.common.constants import LOGGER_NAME
  from greykite.common.constants import PREDICTED_COL
  from greykite.common.constants import PREDICTED_LOWER_COL
  from greykite.common.constants import PREDICTED_UPPER_COL
  from greykite.common.constants import TIME_COL
  from greykite.common.constants import VALUE_COL
  from greykite.common.evaluation import r2_null_model_score
  from greykite.sklearn.estimator.base_forecast_estimator import BaseForecastEstimator
  from greykite.sklearn.uncertainty.uncertainty_methods import UncertaintyMethodEnum
label_desc: Use image node_id 12 for calling a global function with example usage: test_uncertainty(df) without return types