code: def test_errors(df_daily):
      """Tests errors."""
      df_train = df_daily["df_train"]
      # Illegal lag unit.
      with pytest.raises(
          ValueError, match=f"The lag unit 'happy' is not recognized."
      ):
          model = LagBasedEstimator(lag_unit="happy")
          model.fit(df_train)
      # Illegal lags.
      lags = [1, "a"]
      with pytest.raises(
          ValueError,
          match=f"Not all lags in '\\[1, 'a'\\]' can be converted to integers.",
      ):
          model = LagBasedEstimator(lags=lags)
          model.fit(df_train)
      # Negative lags.
      lags = [1, -1]
      with pytest.raises(
          ValueError, match="All lags must be positive integers."
      ):
          model = LagBasedEstimator(lags=lags)
          model.fit(df_train)
      # Lags is not a list.
      lags = 1
      with pytest.raises(
          ValueError,
          match="The lags must be a list of integers, found '1'.",
      ):
          model = LagBasedEstimator(lags=lags)
          model.fit(df_train)
      # Aggregation function not valid.
      with pytest.raises(
          ValueError,
          match=f"The aggregation function 'happy' is not recognized as a string. "
          f"Please either pass a known string or a function.",
      ):
          model = LagBasedEstimator(agg_func="happy")
          model.fit(df_train)
      # Empty df.
      with pytest.raises(ValueError, match="The input df is empty!"):
          model = LagBasedEstimator()
          model.fit(pd.DataFrame({}))
      # Frequency not provided and can not be inferred.
      df = df_train.iloc[[0, 1, 3]].reset_index(drop=True)
      with pytest.raises(
          ValueError,
          match="Frequency can not be inferred. Please provide frequency.",
      ):
          model = LagBasedEstimator()
          model.fit(df)
      # Lag unit is less than data frequency.
      with pytest.raises(
          ValueError,
          match=f"The lag unit 'minute' must be at least equal to the data frequency 'D'.",
      ):
          model = LagBasedEstimator(lag_unit="minute", freq="D")
          model.fit(df_train)
      # Prediction before train start.
      with pytest.raises(
          ValueError,
          match="The lag based estimator does not support hindcasting.",
      ):
          model = LagBasedEstimator()
          model.fit(df_train)
          df = pd.concat(
              [
                  pd.DataFrame(
                      {
                          "ts": [
                              df_train["ts"].iloc[0] - timedelta(days=1)
                          ],
                          "y": [0],
                      }
                  ),
                  df_train,
              ],
              axis=0,
          )
          model.predict(df)
  
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 16 for calling a global function with example usage: test_errors(df_daily) without return types