code: def test_estimate_trend_with_detected_changepoints():
      df = pd.DataFrame(
          {
              "ts": pd.date_range(
                  start="2020-01-01", end="2020-01-05", freq="D"
              ),
              "y": [1, 2, 3, 4, 5],
          }
      )
      changepoints = [dt(2020, 1, 3)]
      trend_estimate = estimate_trend_with_detected_changepoints(
          df=df, time_col="ts", value_col="y", changepoints=changepoints
      )
      assert isinstance(trend_estimate, pd.Series)
      assert trend_estimate.shape[0] == df.shape[0]
      assert (trend_estimate.index == df["ts"]).all()
      trend01 = np.round(trend_estimate[1] - trend_estimate[0], 5)
      trend12 = np.round(trend_estimate[2] - trend_estimate[1], 5)
      trend34 = np.round(trend_estimate[4] - trend_estimate[3], 5)
      assert trend01 == trend12
      assert trend12 != trend34
      # tests ValueError
      with pytest.raises(
          ValueError,
          match="estimator can only be either 'ridge' or 'ols'.",
      ):
          estimate_trend_with_detected_changepoints(
              df=df,
              time_col="ts",
              value_col="y",
              changepoints=changepoints,
              estimator="lasso",
          )
  
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 15 for calling a global function with example usage: test_estimate_trend_with_detected_changepoints() without return types