code: def test_build_autoreg_df_with_filling_na():
      """Testing build_autoreg_df use case with filling missing data."""
      df = pd.DataFrame(
          {"x": [1, 5, 6, 7, 8, -1, -10, -19, -20, 10], "y": range(10)}
      )
  
      autoreg_info = build_autoreg_df(
          value_col="x",
          lag_dict={"orders": [1, 2, 5]},
          agg_lag_dict={
              "orders_list": [[1, 2, 5], [1, 3, 8], [2, 3, 4]],
              "interval_list": [(1, 5), (1, 8)],
          },
          series_na_fill_func=lambda s: s.bfill().ffill(),
      )  # filling NULLs with simle backward and then forward method
  
      build_lags_func = autoreg_info["build_lags_func"]
      lag_col_names = autoreg_info["lag_col_names"]
      agg_lag_col_names = autoreg_info["agg_lag_col_names"]
      max_order = autoreg_info["max_order"]
      min_order = autoreg_info["min_order"]
  
      lag_df_info = build_lags_func(df)
      lag_df = lag_df_info["lag_df"]
      agg_lag_df = lag_df_info["agg_lag_df"]
  
      assert (
          max_order == 8
      ), "returned max_order should be 8 for the given input"
  
      assert (
          min_order == 1
      ), "returned min_order should be 8 for the given input"
  
      assert list(lag_df.columns) == lag_col_names
  
      assert lag_col_names == [
          "x_lag1",
          "x_lag2",
          "x_lag5",
      ], "The expected column names were not found in lags dataframe (lag_df)"
  
      assert (
          lag_df["x_lag1"].values[0].round(1) == 1.0
      ), "lag value is not correct"
      assert (
          lag_df["x_lag1"].values[1].round(1) == 1.0
      ), "lag value is not correct"
      assert (
          lag_df["x_lag1"].values[2].round(0) == 5.0
      ), "lag value is not correct"
      assert (
          lag_df["x_lag2"].values[7].round(0) == -1.0
      ), "lag value is not correct"
      assert (
          lag_df["x_lag5"].values[8].round(0) == 7.0
      ), "lag value is not correct"
  
      assert list(agg_lag_df.columns) == agg_lag_col_names
  
      assert agg_lag_col_names == [
          "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(1) == 2.3
      ), "aggregated lags are not correct"
      assert (
          agg_lag_df["x_avglag_1_to_8"].values[7].round(1) == 2.1
      ), "aggregated lags are not correct"
  
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 9 for calling a global function with example usage: test_build_autoreg_df_with_filling_na() without return types