code: def test_remove_observed():
      """Tests the observed holidays are accurately renamed
      and the corresponding original holidays are removed."""
      df = pd.DataFrame(
          {
              "ts": pd.date_range("2020-01-01", freq="D", periods=731),
              "y": 1,
          }
      )
      # 5 observed holidays are removed.
      country_holiday_df = get_holiday_df(
          country_list=["US"], years=[2020, 2021, 2022]
      )
      assert len(country_holiday_df) == 42
      hi = HolidayInferrer()
      hi.infer_holidays(df=df)
      assert len(hi.country_holiday_df) == 35
      # Tests the correctness of observed holiday removal.
      # 2020-07-03 is the observed Independence Day for 2022-07-04.
      assert (
          hi.country_holiday_df[
              hi.country_holiday_df["ts"] == pd.Timestamp("2020-07-03")
          ]["holiday"].values
          == "Independence Day"
      )
      assert (
          len(
              hi.country_holiday_df[
                  hi.country_holiday_df["ts"]
                  == pd.Timestamp("2020-07-04")
              ]["holiday"]
          )
          == 0
      )
      # 2021-07-05 is the observed Independence Day for 2022-07-04.
      assert (
          hi.country_holiday_df[
              hi.country_holiday_df["ts"] == pd.Timestamp("2021-07-05")
          ]["holiday"].values
          == "Independence Day"
      )
      assert (
          len(
              hi.country_holiday_df[
                  hi.country_holiday_df["ts"]
                  == pd.Timestamp("2021-07-04")
              ]["holiday"]
          )
          == 0
      )
      # 2021-12-24 is the observed Christmas Day for 2021-12-25.
      assert (
          hi.country_holiday_df[
              hi.country_holiday_df["ts"] == pd.Timestamp("2021-12-24")
          ]["holiday"].values
          == "Christmas Day"
      )
      assert (
          len(
              hi.country_holiday_df[
                  hi.country_holiday_df["ts"]
                  == pd.Timestamp("2021-12-25")
              ]["holiday"]
          )
          == 0
      )
      # 2021-12-31 is the observed New Year's Day for 2022-01-01.
      assert (
          hi.country_holiday_df[
              hi.country_holiday_df["ts"] == pd.Timestamp("2021-12-31")
          ]["holiday"].values
          == "New Year's Day"
      )
      assert (
          len(
              hi.country_holiday_df[
                  hi.country_holiday_df["ts"]
                  == pd.Timestamp("2022-01-01")
              ]["holiday"]
          )
          == 0
      )
      # 2022-12-26 is the observed Christmas Day for 2022-12-25.
      assert (
          hi.country_holiday_df[
              hi.country_holiday_df["ts"] == pd.Timestamp("2022-12-26")
          ]["holiday"].values
          == "Christmas Day"
      )
      assert (
          len(
              hi.country_holiday_df[
                  hi.country_holiday_df["ts"]
                  == pd.Timestamp("2022-12-25")
              ]["holiday"]
          )
          == 0
      )
  
imports: import numpy
  import pandas
  import pytest
  from holidays_ext.get_holidays import get_holiday_df
  from testfixtures import LogCapture
  from greykite.algo.common.holiday_inferrer import HolidayInferrer
  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.logging import LOGGER_NAME
label_desc: Use image node_id 10 for calling a global function with example usage: test_remove_observed() without return types