code: def test_infer_forecast_horizons(hourly_data_with_reg, params):
      """Tests that the estimator is able to infer the correct forecast horizon for
      each stage of model, under different situations.
      """
      model = MultistageForecastEstimator(**params)
      # The default forecast horizon is 12.
      # We truncate df to have the future period overlapping 2 days.
      df = hourly_data_with_reg.iloc[:-3]
      model.fit(df)
      assert model.forecast_horizons == (2, 12)
      # Now we do not truncate df to have the future period overlapping 1 day.
      model.fit(hourly_data_with_reg)
      assert model.forecast_horizons == (1, 12)
  
imports: import datetime
  import numpy
  import pandas
  import pytest
  from testfixtures import LogCapture
  import greykite.common.constants
  from greykite.common.testing_utils import generate_df_for_tests
  from greykite.sklearn.estimator.lag_based_estimator import LagBasedEstimator
  from greykite.sklearn.estimator.multistage_forecast_estimator import MultistageForecastEstimator
  from greykite.sklearn.estimator.multistage_forecast_estimator import MultistageForecastModelConfig
  from greykite.sklearn.estimator.simple_silverkite_estimator import SimpleSilverkiteEstimator
  from greykite.sklearn.uncertainty.uncertainty_methods import UncertaintyMethodEnum
label_desc: Use image node_id 22 for calling a global function with example usage: test_infer_forecast_horizons(hourly_data_with_reg, params) without return types