code: def test_cum_effect(daily_df):
      """Tests the cum effect satisfies the thresholds."""
      hi = HolidayInferrer()
      result = hi.infer_holidays(df=daily_df)
      cum_effects = np.nansum(
          np.abs(list(hi.score_result_avg.values()))
      )
      # Independent holidays.
      # Before adding the last one, the effect should be less than the threshold.
      # After adding the last one, the effect should exceed the threshold.
      ind_effects = [
          hi.score_result_avg[hi._transform_country_holidays([h])[0]]
          for h in result["independent_holidays"]
      ]
      independent_holiday_effects = np.nansum(np.abs(ind_effects))
      independent_holiday_effects_minus_1 = (
          independent_holiday_effects
          - min([abs(x) for x in ind_effects])
      )
      assert (
          independent_holiday_effects_minus_1 / cum_effects
          < hi.independent_holiday_thres
      )
      assert (
          independent_holiday_effects / cum_effects
          >= hi.independent_holiday_thres
      )
      # Together holidays.
      # Before adding the last one, the effect should be less than the threshold.
      # After adding the last one, the effect should exceed the threshold.
      tog_effects = [
          hi.score_result_avg[hi._transform_country_holidays([h])[0]]
          for h in result["together_holidays_positive"]
          + result["together_holidays_negative"]
      ]
      together_holiday_effects = (
          independent_holiday_effects + np.nansum(np.abs(tog_effects))
      )
      together_holiday_effects_minus_1 = together_holiday_effects - min(
          [abs(x) for x in tog_effects]
      )
      assert (
          together_holiday_effects_minus_1 / cum_effects
          < hi.together_holiday_thres
      )
      assert (
          together_holiday_effects / cum_effects
          >= hi.together_holiday_thres
      )
  
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 11 for calling a global function with example usage: test_cum_effect(daily_df) without return types