code: def test_build_agg_lag_df():
      """Testing build_agg_lag_df."""
      df = pd.DataFrame(
          {"x": [1, 5, 6, 7, 8, -1, -10, -19, -20, 10], "y": range(10)}
      )
  
      agg_lag_info = build_agg_lag_df(
          value_col="x",
          df=df,
          orders_list=[[1, 2, 5], [1, 3, 8], [2, 3, 4]],
          interval_list=[(1, 5), (1, 8)],
          agg_func=np.mean,
          agg_name="avglag",
      )
  
      agg_lag_df = agg_lag_info["agg_lag_df"]
  
      assert list(agg_lag_df.columns) == [
          "x_avglag_1_2_5",
          "x_avglag_1_3_8",
          "x_avglag_2_3_4",
          "x_avglag_1_to_5",
          "x_avglag_1_to_8",
      ], "aggregated lag df does not have the correct names"
      assert (
          agg_lag_df["x_avglag_1_2_5"].values[2].round(0) == 3.0
      ), "aggregated lags are not correct"
      assert (
          agg_lag_df["x_avglag_1_to_8"].values[7].round(1) == 2.3
      ), "aggregated lags are not correct"
  
      # agg_func "mean" produces the same result
      assert_equal(
          agg_lag_df,
          build_agg_lag_df(
              value_col="x",
              df=df,
              orders_list=[[1, 2, 5], [1, 3, 8], [2, 3, 4]],
              interval_list=[(1, 5), (1, 8)],
              agg_func="mean",
              agg_name="avglag",
          )["agg_lag_df"],
      )
  
      # check for Exception being raised for repeated orders
      with pytest.raises(
          Exception,
          match="a list of orders in orders_list contains a duplicate element",
      ):
          build_agg_lag_df(
              df=df,
              value_col="x",
              orders_list=[[1, 2, 2], [1, 3, 8], [2, 3, 4]],
              interval_list=[(1, 5), (1, 8)],
              agg_func=np.mean,
              agg_name="avglag",
          )
  
      # check for Exception being raised for interval not being on length 2
      with pytest.raises(
          Exception, match="interval must be a tuple of length 2"
      ):
          build_agg_lag_df(
              df=df,
              value_col="x",
              orders_list=[[1, 2, 3], [1, 3, 8], [2, 3, 4]],
              interval_list=[(1, 5), (1, 8, 9)],
              agg_func=np.mean,
              agg_name="avglag",
          )
  
      # check for Exception being raised for interval[0] <= interval[1]
      # for each interval in interval_list
      with pytest.raises(
          Exception,
          match=r"we must have interval\[0\] <= interval\[1\], for each interval in interval_list",
      ):
          build_agg_lag_df(
              df=df,
              value_col="x",
              orders_list=[[1, 2, 3], [1, 3, 8], [2, 3, 4]],
              interval_list=[(1, 5), (8, 1)],
              agg_func=np.mean,
              agg_name="avglag",
          )
  
imports: import numpy
  import pandas
  import pytest
  from greykite.common.features.timeseries_lags import build_agg_lag_df
  from greykite.common.features.timeseries_lags import build_autoreg_df
  from greykite.common.features.timeseries_lags import build_autoreg_df_multi
  from greykite.common.features.timeseries_lags import build_lag_df
  from greykite.common.features.timeseries_lags import min_max_lag_order
  from greykite.common.python_utils import assert_equal
label_desc: Use image node_id 5 for calling a global function with example usage: test_build_agg_lag_df() without return types