code: def test_find_neighbor_changepoints():
      cp_idx = [1, 2, 5, 7, 8, 9, 10, 18, 22]
      neighbor_cps = find_neighbor_changepoints(cp_idx=cp_idx)
      assert neighbor_cps == [[1, 2], [5], [7, 8, 9, 10], [18], [22]]
      # test with greater neighbor distance
      cp_idx = [1, 2, 4, 7, 9, 12, 15, 20]
      neighbor_cps = find_neighbor_changepoints(
          cp_idx=cp_idx, min_index_distance=3
      )
      assert neighbor_cps == [[1, 2, 4], [7, 9], [12], [15], [20]]
      # test negative distance ValueError
      with pytest.raises(
          ValueError, match="`min_index_distance` must be positive."
      ):
          find_neighbor_changepoints(
              cp_idx=cp_idx, min_index_distance=-1
          )
      # tests unsorted input
      cp_idx = [2, 1, 4, 7, 9, 12, 15, 20]
      with pytest.warns(UserWarning) as record:
          neighbor_cps = find_neighbor_changepoints(
              cp_idx=cp_idx, min_index_distance=3
          )
          assert (
              "The given `cp_idx` is not sorted. It has been sorted."
          ) in record[0].message.args[0]
          assert neighbor_cps == [[1, 2, 4], [7, 9], [12], [15], [20]]
  
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 9 for calling a global function with example usage: test_find_neighbor_changepoints() without return types