code: def test_find_seasonality_changepoints(hourly_data):
      df = hourly_data["df"]
      dl = DataLoader()
      df_pt = dl.load_peyton_manning()
  
      # model training with given values
      model = ChangepointDetector()
      model.find_seasonality_changepoints(
          df=df,
          time_col="ts",
          value_col="y",
          potential_changepoint_n=80,
          resample_freq="2D",
          seasonality_components_df=pd.DataFrame(
              {
                  "name": ["tod", "tow", "conti_year"],
                  "period": [24.0, 7.0, 1.0],
                  "order": [3, 4, 5],
                  "seas_names": ["daily", "weekly", "yearly"],
              }
          ),
      )
      # resample frequency is "2D", daily component is automatically removed from
      # seasonality_components_df
      assert model.seasonality_df.shape[1] == 18 * 81
      assert model.seasonality_changepoints is not None
      assert model.seasonality_estimation is not None
      assert model.seasonality_estimation.shape[0] == df.shape[0]
      # test a given ``regularization_strength``
      model = ChangepointDetector()
      model.find_seasonality_changepoints(
          df=df,
          time_col="ts",
          value_col="y",
          regularization_strength=1.0,
      )
      # ``regularization_strength`` == 1.0 indicates no change point
      assert all(
          [
              model.seasonality_changepoints[key] == []
              for key in model.seasonality_changepoints.keys()
          ]
      )
      model.find_seasonality_changepoints(
          df=df_pt,
          time_col="ts",
          value_col="y",
          regularization_strength=0.0,
      )
      # ``regularization_strength`` equals 0 indicates at least one change point
      assert any(
          [
              model.seasonality_changepoints[key] != []
              for key in model.seasonality_changepoints.keys()
          ]
      )
      # test `no_changepoint_distance_from_end` with the Peyton Manning data
      model = ChangepointDetector()
      res = model.find_seasonality_changepoints(
          df=df_pt,
          time_col="ts",
          value_col="y",
          no_changepoint_distance_from_end="730D",
          regularization_strength=0.1,
      )
      changepoints_dict = res["seasonality_changepoints"]
      changepoints = []
      for key in changepoints_dict.keys():
          changepoints += changepoints_dict[key]
      # test override `no_changepoint_proportion_from_end` and no change points in the last piece
      no_changepoint_proportion_from_end = timedelta(days=730) / (
          pd.to_datetime(df_pt["ts"].iloc[-1])
          - pd.to_datetime(df_pt["ts"].iloc[0])
      )
      last_date_to_have_changepoint = pd.to_datetime(
          df_pt["ts"].iloc[
              int(
                  df_pt.shape[0]
                  * (1 - no_changepoint_proportion_from_end)
              )
          ]
      )
      assert changepoints[-1] <= last_date_to_have_changepoint
      # test daily data automatically drops daily seasonality components
      cd = ChangepointDetector()
      res = cd.find_seasonality_changepoints(
          df=df_pt, time_col="ts", value_col="y"
      )
      assert "daily" not in res["seasonality_changepoints"].keys()
      # test feeding the same df with different column names will not rerun trend estimation
      df2 = df_pt.copy().rename({"ts": "ts2", "y": "y2"}, axis=1)
      cd = ChangepointDetector()
      cd.find_seasonality_changepoints(
          df=df_pt, time_col="ts", value_col="y"
      )
      with pytest.warns(
          UserWarning,
          match="Trend changepoints are already identified, using past trend estimation.",
      ):
          cd.find_seasonality_changepoints(
              df=df2, time_col="ts2", value_col="y2"
          )
      assert cd.time_col == "ts"
      assert cd.value_col == "y"
      # negative potential_changepoint_n
      model = ChangepointDetector()
      with pytest.raises(
          ValueError,
          match="potential_changepoint_n can not be negative. "
          "A large number such as 50 is recommended",
      ):
          model.find_seasonality_changepoints(
              df=df,
              time_col="ts",
              value_col="y",
              potential_changepoint_n=-1,
          )
      # negative regularization_strength
      with pytest.raises(
          ValueError,
          match="regularization_strength must be between 0.0 and 1.0.",
      ):
          model.find_seasonality_changepoints(
              df=df,
              time_col="ts",
              value_col="y",
              regularization_strength=-1,
          )
      # test regularization_strength == None warning
      with pytest.warns(
          UserWarning,
          match="regularization_strength is set to None. This will",
      ):
          model.find_seasonality_changepoints(
              df=df,
              time_col="ts",
              value_col="y",
              regularization_strength=None,
          )
      # test existing trend estimation warning
      model = ChangepointDetector()
      model.find_trend_changepoints(df=df, time_col="ts", value_col="y")
      with pytest.warns(
          UserWarning,
          match="Trend changepoints are already identified, using past trend estimation.",
      ):
          model.find_seasonality_changepoints(
              df=df, time_col="ts", value_col="y"
          )
      # df sample size too small
      df_small = pd.DataFrame(
          data={
              "ts": pd.date_range(
                  start="2020-1-1", end="2020-1-3", freq="D"
              ),
              "y": [1, 2, 3],
          }
      )
      model = ChangepointDetector()
      with pytest.raises(
          ValueError,
          match="Change point detector does not work for less than "
          "5 observations. Please increase sample size.",
      ):
          model.find_seasonality_changepoints(
              df=df_small,
              time_col="ts",
              value_col="y",
          )
      # tests given trend changepoints
      cd = ChangepointDetector()
      cd.find_seasonality_changepoints(
          df=df_pt,
          time_col="ts",
          value_col="y",
          trend_changepoints=list(
              pd.to_datetime(["2016-01-01", "2017-02-05"])
          ),
      )
      assert cd.trend_changepoints == list(
          pd.to_datetime(["2016-01-01", "2017-02-05"])
      )
      assert cd.original_df is not None
      assert cd.trend_estimation is not None
      assert cd.y is not None
      assert cd.time_col == "ts"
      assert cd.value_col == "y"
  
imports: from datetime import timedelta
  import numpy
  import pandas
  import pytest
  from pandas.tseries.frequencies import to_offset
  from sklearn.base import RegressorMixin
  from testfixtures import LogCapture
  from greykite.algo.changepoint.adalasso.changepoint_detector import ChangepointDetector
  from greykite.algo.changepoint.adalasso.changepoint_detector import get_changepoints_dict
  from greykite.algo.changepoint.adalasso.changepoint_detector import get_seasonality_changepoints
  from greykite.algo.changepoint.shift_detection.shift_detector import ShiftDetection
  from greykite.common.data_loader import DataLoader
  from greykite.common.logging import LOGGER_NAME
  from greykite.common.testing_utils import generate_df_for_tests
  from greykite.common.testing_utils import generate_df_with_arbitrary_trends_and_shifts
  from greykite.common.testing_utils import generate_test_changepoint_df
label_desc: Use image node_id 5 for calling a global function with example usage: test_find_seasonality_changepoints(hourly_data) without return types