code: def test_get_auto_holiday(df_daily):
      """Tests automatic holidays if the return is the same as calling `HolidayGrouper`."""
      # Initializes inputs that will be used in both cases.
      start_year = 2007
      end_year = 2016
      pre_num = 2
      post_num = 2
      pre_post_num_dict = {"New Year's Day": (1, 3)}
      holiday_lookup_countries = ["US"]
  
      # Constructs `daily_event_df_dict` through directly calling `HolidayGrouper`.
      # Constructs `holiday_df`.
      holiday_df_dict = get_holidays(
          countries=holiday_lookup_countries,
          year_start=start_year - 1,
          year_end=end_year + 1,
      )
  
      holiday_df_list = [
          holidays for _, holidays in holiday_df_dict.items()
      ]
      holiday_df = pd.concat(holiday_df_list)
      # Removes the observed holidays and only keep the original holidays.
      holiday_df = holiday_df[
          ~holiday_df[EVENT_DF_LABEL_COL].str.contains("Observed")
      ]
  
      # Calls `HolidayGrouper`.
      hg = HolidayGrouper(
          df=df_daily,
          time_col=TIME_COL,
          value_col=VALUE_COL,
          holiday_df=holiday_df,
          holiday_date_col=EVENT_DF_DATE_COL,
          holiday_name_col=EVENT_DF_LABEL_COL,
          holiday_impact_pre_num_days=pre_num,
          holiday_impact_post_num_days=post_num,
          holiday_impact_dict=pre_post_num_dict,
      )
  
      hg.group_holidays()
      daily_event_df_dict_constructed = hg.result_dict[
          "daily_event_df_dict"
      ]
  
      # Constructs `daily_event_df_dict` through `get_auto_holidays` with country list and asserts the result is the same.
      daily_event_df_dict_from_auto_country = get_auto_holidays(
          df=df_daily,
          time_col=TIME_COL,
          value_col=VALUE_COL,
          start_year=start_year,
          end_year=end_year,
          pre_num=pre_num,
          post_num=post_num,
          pre_post_num_dict=pre_post_num_dict,
          holiday_lookup_countries=holiday_lookup_countries,
          holidays_to_model_separately=None,
          daily_event_df_dict=None,
          auto_holiday_params=None,
      )
      assert_equal(
          daily_event_df_dict_constructed,
          daily_event_df_dict_from_auto_country,
      )
  
      # Constructs `daily_event_df_dict` through `get_auto_holidays` with external `daily_event_df_dict` and asserts the
      # result is the same.
  
      # Constructs `daily_event_df_dict_input` for input based on `holiday_df`.
      daily_event_df_dict_input = {
          key: value
          for key, value in holiday_df.groupby(EVENT_DF_LABEL_COL)
      }
      daily_event_df_dict_from_auto_input = get_auto_holidays(
          df=df_daily,
          time_col=TIME_COL,
          value_col=VALUE_COL,
          start_year=start_year,
          end_year=end_year,
          pre_num=pre_num,
          post_num=post_num,
          pre_post_num_dict=pre_post_num_dict,
          holiday_lookup_countries=[],
          holidays_to_model_separately=None,
          daily_event_df_dict=daily_event_df_dict_input,
          auto_holiday_params=None,
      )
      assert_equal(
          daily_event_df_dict_constructed,
          daily_event_df_dict_from_auto_input,
      )
  
      # Uses 'auto_holiday_params["df"]' to input time series on which holidays are referred and asserts the
      # result is the same.
      daily_event_df_dict_from_auto_input = get_auto_holidays(
          df=None,
          time_col=TIME_COL,
          value_col=VALUE_COL,
          start_year=start_year,
          end_year=end_year,
          pre_num=pre_num,
          post_num=post_num,
          pre_post_num_dict=pre_post_num_dict,
          holiday_lookup_countries=[],
          holidays_to_model_separately=None,
          daily_event_df_dict=daily_event_df_dict_input,
          auto_holiday_params=dict(df=df_daily),
      )
      assert_equal(
          daily_event_df_dict_constructed,
          daily_event_df_dict_from_auto_input,
      )
  
      # Inputs `holiday_df` directly through `auto_holiday_params` and asserts the result is the same.
      # The `holiday_lookup_countries` should be ignored in this case.
      daily_event_df_dict_from_input_holiday_df = get_auto_holidays(
          df=df_daily,
          time_col=TIME_COL,
          value_col=VALUE_COL,
          start_year=start_year,
          end_year=end_year,
          pre_num=pre_num,
          post_num=post_num,
          pre_post_num_dict=pre_post_num_dict,
          holiday_lookup_countries=holiday_lookup_countries,
          holidays_to_model_separately=None,
          daily_event_df_dict=None,
          auto_holiday_params=dict(holiday_df=holiday_df),
      )
      assert_equal(
          daily_event_df_dict_constructed,
          daily_event_df_dict_from_input_holiday_df,
      )
  
      # When holidays are not passed in through `holiday_lookup_countries` or `daily_event_df_dict`, a `ValueError`
      # should be raised.
      with pytest.raises(
          ValueError, match="Holiday list needs to be specified"
      ):
          _ = get_auto_holidays(
              df=df_daily,
              time_col=TIME_COL,
              value_col=VALUE_COL,
              start_year=start_year,
              end_year=end_year,
              pre_num=pre_num,
              post_num=post_num,
              pre_post_num_dict=pre_post_num_dict,
              holiday_lookup_countries=[],
              holidays_to_model_separately=None,
              daily_event_df_dict=None,
              auto_holiday_params=None,
          )
  
      # When no `df` is passed in through `df` or `auto_holiday_params`, a `ValueError`
      # should be raised.
      with pytest.raises(
          ValueError, match="Dataframe cannot be `None` or empty"
      ):
          _ = get_auto_holidays(
              df=None,
              time_col=TIME_COL,
              value_col=VALUE_COL,
              start_year=start_year,
              end_year=end_year,
              pre_num=pre_num,
              post_num=post_num,
              pre_post_num_dict=pre_post_num_dict,
              holiday_lookup_countries=holiday_lookup_countries,
              holidays_to_model_separately=None,
              daily_event_df_dict=None,
              auto_holiday_params=None,
          )
  
imports: import numpy
  import pandas
  import pytest
  from greykite.algo.common.holiday_grouper import HolidayGrouper
  from greykite.algo.forecast.silverkite.auto_config import get_auto_growth
  from greykite.algo.forecast.silverkite.auto_config import get_auto_holidays
  from greykite.algo.forecast.silverkite.auto_config import get_auto_seasonality
  from greykite.common.constants import EVENT_DF_DATE_COL
  from greykite.common.constants import EVENT_DF_LABEL_COL
  from greykite.common.constants import TIME_COL
  from greykite.common.constants import VALUE_COL
  from greykite.common.data_loader import DataLoader
  from greykite.common.features.timeseries_features import get_holidays
  from greykite.common.python_utils import assert_equal
label_desc: Use image node_id 6 for calling a global function with example usage: test_get_auto_holiday(df_daily) without return types