code: def test_correct_lag_when_using_freq(df_time):
      # Expected
      date_time = [
          pd.Timestamp("2020-05-15 12:00:00"),
          pd.Timestamp("2020-05-15 12:15:00"),
          pd.Timestamp("2020-05-15 12:30:00"),
          pd.Timestamp("2020-05-15 12:45:00"),
          pd.Timestamp("2020-05-15 13:00:00"),
      ]
      expected_results = {
          "ambient_temp": [31.31, 31.51, 32.15, 32.39, 32.62],
          "module_temp": [49.18, 49.84, 52.35, 50.63, 49.61],
          "irradiation": [0.51, 0.79, 0.65, 0.76, 0.42],
          "color": ["blue"] * 5,
          "ambient_temp_lag_1h": [
              np.nan,
              np.nan,
              np.nan,
              np.nan,
              31.31,
          ],
          "module_temp_lag_1h": [np.nan, np.nan, np.nan, np.nan, 49.18],
          "irradiation_lag_1h": [np.nan, np.nan, np.nan, np.nan, 0.51],
          "ambient_temp_lag_15min": [
              np.nan,
              31.31,
              31.51,
              32.15,
              32.39,
          ],
          "module_temp_lag_15min": [np.nan, 49.18, 49.84, 52.35, 50.63],
          "irradiation_lag_15min": [np.nan, 0.51, 0.79, 0.65, 0.76],
      }
      expected_results_df = pd.DataFrame(
          data=expected_results,
          index=date_time,
      )
  
      # When freq is a string
      transformer = LagFeatures(freq="1h")
      df_tr = transformer.fit_transform(df_time)
      assert df_tr.head(5).equals(
          expected_results_df.drop(
              [
                  "ambient_temp_lag_15min",
                  "module_temp_lag_15min",
                  "irradiation_lag_15min",
              ],
              axis=1,
          )
      )
  
      # When freq is a list
      transformer = LagFeatures(freq=["1h", "15min"])
      df_tr = transformer.fit_transform(df_time)
      assert df_tr.head(5).equals(expected_results_df)
  
      # When drop original is True
      transformer = LagFeatures(freq=["1h"], drop_original=True)
      df_tr = transformer.fit_transform(df_time)
      assert df_tr.head(5).equals(
          expected_results_df[
              [
                  "color",
                  "ambient_temp_lag_1h",
                  "module_temp_lag_1h",
                  "irradiation_lag_1h",
              ]
          ]
      )
  
file_path: feature_engine/tests/test_time_series/test_forecasting/test_lag_features.py
imports: import numpy
  import pandas
  import pytest
  from feature_engine.timeseries.forecasting import LagFeatures
label_desc: Use image node_id 8 for calling a global function with example usage: test_correct_lag_when_using_freq(df_time) without return types