code: def test_plot_change():
      observations = pd.Series(
          {"y": [1, 2, 3, 4, 5]},
          index=[
              dt(2020, 1, 1),
              dt(2020, 1, 2),
              dt(2020, 1, 3),
              dt(2020, 1, 4),
              dt(2020, 1, 5),
          ],
      )
      trend_estimate = pd.Series(
          [2, 3, 4, 5, 6],
          index=[
              dt(2020, 1, 1),
              dt(2020, 1, 2),
              dt(2020, 1, 3),
              dt(2020, 1, 4),
              dt(2020, 1, 5),
          ],
      )
      trend_change = [dt(2020, 1, 2), dt(2020, 1, 4)]
      year_seasonality_estimate = pd.Series(
          [1, 2, 1, 2, 1],
          index=[
              dt(2020, 1, 1),
              dt(2020, 1, 2),
              dt(2020, 1, 3),
              dt(2020, 1, 4),
              dt(2020, 1, 5),
          ],
      )
      adaptive_lasso_estimate = pd.Series(
          [3, 4, 5, 6, 7],
          index=[
              dt(2020, 1, 1),
              dt(2020, 1, 2),
              dt(2020, 1, 3),
              dt(2020, 1, 4),
              dt(2020, 1, 5),
          ],
      )
      seasonality_estimate = pd.Series(
          [1, 2, 3, 1, 2],
          index=[
              dt(2020, 1, 1),
              dt(2020, 1, 2),
              dt(2020, 1, 3),
              dt(2020, 1, 4),
              dt(2020, 1, 5),
          ],
      )
      seasonality_change_dict = {
          "weekly": [dt(2020, 1, 1)],
          "yearly": [dt(2020, 1, 3)],
      }
      seasonality_change_list = [dt(2020, 1, 1), dt(2020, 1, 3)]
      fig = plot_change(
          observation=observations,
          trend_estimate=trend_estimate,
          trend_change=trend_change,
          year_seasonality_estimate=year_seasonality_estimate,
          adaptive_lasso_estimate=adaptive_lasso_estimate,
      )
      assert len(fig.data) == 6
      fig1 = plot_change(
          observation=None,
          trend_estimate=None,
          trend_change=trend_change,
          year_seasonality_estimate=None,
          adaptive_lasso_estimate=adaptive_lasso_estimate,
      )
      assert len(fig1.data) == 3
      fig2 = plot_change(
          observation=observations,
          trend_estimate=trend_estimate,
          trend_change=trend_change,
          year_seasonality_estimate=year_seasonality_estimate,
          adaptive_lasso_estimate=adaptive_lasso_estimate,
          seasonality_estimate=seasonality_estimate,
          seasonality_change=seasonality_change_dict,
      )
      assert len(fig2.data) == 9
      fig3 = plot_change(
          observation=observations,
          trend_estimate=trend_estimate,
          trend_change=trend_change,
          year_seasonality_estimate=year_seasonality_estimate,
          adaptive_lasso_estimate=adaptive_lasso_estimate,
          seasonality_estimate=seasonality_estimate,
          seasonality_change=seasonality_change_list,
      )
      assert len(fig3.data) == 9
      # tests warning
      with pytest.warns(UserWarning) as record:
          seasonality_change_dict = {
              "weekly": [dt(2020, 1, 1)],
              "yearly": [dt(2020, 1, 3)],
              "test1": [dt(2020, 1, 3)],
              "test2": [dt(2020, 1, 3)],
              "test3": [dt(2020, 1, 3)],
              "test4": [dt(2020, 1, 3)],
              "test5": [dt(2020, 1, 3)],
              "test6": [dt(2020, 1, 3)],
              "test7": [dt(2020, 1, 3)],
          }
          plot_change(
              observation=observations,
              trend_estimate=trend_estimate,
              trend_change=trend_change,
              year_seasonality_estimate=year_seasonality_estimate,
              adaptive_lasso_estimate=adaptive_lasso_estimate,
              seasonality_estimate=seasonality_estimate,
              seasonality_change=seasonality_change_dict,
          )
          assert (
              "Only the first 8 components with detected change points"
              "are plotted."
          ) in record[0].message.args[0]
      with pytest.warns(UserWarning) as record:
          plot_change(
              observation=None,
              trend_estimate=None,
              trend_change=trend_change,
              year_seasonality_estimate=year_seasonality_estimate,
              adaptive_lasso_estimate=None,
              seasonality_estimate=None,
              seasonality_change=None,
          )
      assert (
          "trend_change is not shown. Must provide observations, trend_estimate, "
          "adaptive_lasso_estimate or seasonality_estimate to plot trend_change."
      ) in record[0].message.args[0]
      with pytest.warns(UserWarning) as record:
          plot_change(
              observation=None,
              trend_estimate=trend_estimate,
              trend_change=trend_change,
              year_seasonality_estimate=year_seasonality_estimate,
              adaptive_lasso_estimate=adaptive_lasso_estimate,
              seasonality_estimate=None,
              seasonality_change=seasonality_change_list,
          )
          assert (
              "seasonality_change is not shown. Must provide observations or"
              " seasonality_estimate to plot seasonality_change."
          ) in record[0].message.args[0]
      with pytest.raises(
          ValueError,
          match="seasonality_change must be either list or dict.",
      ):
          plot_change(
              observation=None,
              trend_estimate=trend_estimate,
              trend_change=trend_change,
              year_seasonality_estimate=year_seasonality_estimate,
              adaptive_lasso_estimate=adaptive_lasso_estimate,
              seasonality_estimate=seasonality_estimate,
              seasonality_change=np.array(seasonality_change_list),
          )
  
imports: from datetime import datetime
  import numpy
  import pandas
  import pytest
  from greykite.algo.changepoint.adalasso.changepoints_utils import adaptive_lasso_cv
  from greykite.algo.changepoint.adalasso.changepoints_utils import build_seasonality_feature_df_from_detection_result
  from greykite.algo.changepoint.adalasso.changepoints_utils import build_seasonality_feature_df_with_changes
  from greykite.algo.changepoint.adalasso.changepoints_utils import build_trend_feature_df_with_changes
  from greykite.algo.changepoint.adalasso.changepoints_utils import check_freq_unit_at_most_day
  from greykite.algo.changepoint.adalasso.changepoints_utils import combine_detected_and_custom_trend_changepoints
  from greykite.algo.changepoint.adalasso.changepoints_utils import compute_fitted_components
  from greykite.algo.changepoint.adalasso.changepoints_utils import compute_min_changepoint_index_distance
  from greykite.algo.changepoint.adalasso.changepoints_utils import estimate_seasonality_with_detected_changepoints
  from greykite.algo.changepoint.adalasso.changepoints_utils import estimate_trend_with_detected_changepoints
  from greykite.algo.changepoint.adalasso.changepoints_utils import filter_changepoints
  from greykite.algo.changepoint.adalasso.changepoints_utils import find_neighbor_changepoints
  from greykite.algo.changepoint.adalasso.changepoints_utils import get_changes_from_beta
  from greykite.algo.changepoint.adalasso.changepoints_utils import get_seasonality_changepoint_df_cols
  from greykite.algo.changepoint.adalasso.changepoints_utils import get_seasonality_changes_from_adaptive_lasso
  from greykite.algo.changepoint.adalasso.changepoints_utils import get_trend_changepoint_dates_from_cols
  from greykite.algo.changepoint.adalasso.changepoints_utils import get_trend_changes_from_adaptive_lasso
  from greykite.algo.changepoint.adalasso.changepoints_utils import get_yearly_seasonality_changepoint_dates_from_freq
  from greykite.algo.changepoint.adalasso.changepoints_utils import plot_change
  from greykite.common.testing_utils import generate_df_for_tests
label_desc: Use image node_id 7 for calling a global function with example usage: test_plot_change() without return types