code: def test_merge_anomaly_info():
      """Tests ``merge_anomaly_info`` method."""
      periods = 10
      df = pd.DataFrame(
          {
              TIME_COL: pd.date_range(
                  start="2020-01-01", periods=periods
              ),
              VALUE_COL: range(periods),
              ANOMALY_COL: [
                  0,
                  0,
                  1,
                  1,
                  0,
                  0,
                  0,
                  0,
                  0,
                  0,
              ],  # Anomalies on 2020-01-03 and 2020-01-04
          }
      )
      y_true = [
          0,
          0,
          1,
          1,
          0,
          0,
          0,
          0,
          0,
          1,
      ]  # Anomalies on 2020-01-03, 2020-01-04 and 2020-01-10
      anomaly_df = pd.DataFrame(
          {START_TIME_COL: ["2020-01-04"], END_TIME_COL: ["2020-01-06"]}
      )
      data = DetectorData(df=df, y_true=y_true, anomaly_df=anomaly_df)
  
      detector = GreykiteDetector()
      fit_data = detector.merge_anomaly_info(data, freq="D")
      # Checks `anomaly_df` in `fit_data`.
      # We expect combined anomalies from 2020-01-03 to 2020-01-06, and on 2020-01-10.
      expected_anomaly_df = pd.DataFrame(
          {
              START_TIME_COL: pd.to_datetime(
                  ["2020-01-03", "2020-01-10"]
              ),
              END_TIME_COL: pd.to_datetime(
                  ["2020-01-06", "2020-01-10"]
              ),
          }
      )
      assert fit_data.anomaly_df.equals(expected_anomaly_df)
      # Checks `y_true` in `fit_data`.
      expected_y_true = pd.Series(
          [0, 0, 1, 1, 1, 1, 0, 0, 0, 1]
      ).astype(bool)
      assert fit_data.y_true.equals(expected_y_true)
      # Checks `df` in `fit_data`.
      assert fit_data.df[ANOMALY_COL].equals(expected_y_true)
      assert f"adjusted_{VALUE_COL}" in fit_data.df.columns
  
imports: import datetime
  import numpy
  import pandas
  import plotly.express
  import pytest
  from greykite.common.constants import ACTUAL_COL
  from greykite.common.constants import ANOMALY_COL
  from greykite.common.constants import END_TIME_COL
  from greykite.common.constants import PREDICTED_ANOMALY_COL
  from greykite.common.constants import PREDICTED_COL
  from greykite.common.constants import PREDICTED_LOWER_COL
  from greykite.common.constants import PREDICTED_UPPER_COL
  from greykite.common.constants import START_TIME_COL
  from greykite.common.constants import TIME_COL
  from greykite.common.constants import VALUE_COL
  from greykite.common.testing_utils import generate_df_for_tests
  from greykite.common.testing_utils_anomalies import contaminate_df_with_anomalies
  from greykite.common.viz.timeseries_annotate import plot_anomalies_over_forecast_vs_actual
  from greykite.common.viz.timeseries_annotate import plot_lines_markers
  from greykite.common.viz.timeseries_annotate import plt_compare_series_annotations
  from greykite.detection.common.ad_evaluation import f1_score
  from greykite.detection.common.ad_evaluation import precision_score
  from greykite.detection.common.ad_evaluation import recall_score
  from greykite.detection.detector.ad_utils import partial_return
  from greykite.detection.detector.config import F1
  from greykite.detection.detector.config import ADConfig
  from greykite.detection.detector.data import DetectorData
  from greykite.detection.detector.greykite import DETECTOR_PREDICT_COLS
  from greykite.detection.detector.greykite import GreykiteDetector
  from greykite.detection.detector.reward import Reward
  from greykite.framework.templates.autogen.forecast_config import EvaluationPeriodParam
  from greykite.framework.templates.autogen.forecast_config import ForecastConfig
  from greykite.framework.templates.autogen.forecast_config import MetadataParam
  from greykite.framework.templates.autogen.forecast_config import ModelComponentsParam
label_desc: Use image node_id 12 for calling a global function with example usage: test_merge_anomaly_info() without return types