code: def test_past_df(df_daily):
      """Test past df."""
      df_train = df_daily["df_train"]
  
      past_df = pd.DataFrame(
          {
              "ts": pd.date_range(
                  start=df_train["ts"].iloc[0] - timedelta(weeks=1),
                  periods=7,
                  freq="D",
              ),
              "y": -1.0,
          }
      )
  
      model = LagBasedEstimator(past_df=past_df)
      model.fit(df_train)
      # Checks ``model.df``.
      # It should include the past 1 week data from ``past_df``.
      df_expanded = pd.concat([past_df, df_train], axis=0).reset_index(
          drop=True
      )
      assert model.df.equals(df_expanded)
  
      # Checks prediction within training.
      df_fit = model.predict(df_train)
      # The value column should be the same as the input.
      assert df_fit["y"].equals(df_train["y"].astype(float))
      # The first week's fitted values is the ``past_df``.
      assert (
          df_fit[PREDICTED_COL]
          .iloc[:7]
          .reset_index(drop=True)
          .equals(past_df["y"])
      )
      assert list(df_fit.columns) == ["ts", "y", PREDICTED_COL]
  
imports: from datetime import timedelta
  import numpy
  import pandas
  import pytest
  from dateutil.relativedelta import relativedelta
  from testfixtures import LogCapture
  from greykite.common.constants import ERR_STD_COL
  from greykite.common.constants import LOGGER_NAME
  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.sklearn.estimator.lag_based_estimator import LagBasedEstimator
label_desc: Use image node_id 9 for calling a global function with example usage: test_past_df(df_daily) without return types