code: def test_sort_index(df_time):
      X = df_time.copy()
  
      # Shuffle dataframe
      Xs = X.sample(len(df_time)).copy()
  
      transformer = LagFeatures(sort_index=True)
      X_tr = transformer.fit_transform(Xs)
  
      A = X[transformer.variables_].iloc[0:4].values
      B = X_tr[transformer._get_new_features_name()].iloc[1:5].values
      assert (A == B).all()
  
      transformer = LagFeatures(sort_index=False)
      X_tr = transformer.fit_transform(Xs)
  
      A = Xs[transformer.variables_].iloc[0:4].values
      B = X_tr[transformer._get_new_features_name()].iloc[1:5].values
      assert (A == B).all()
  
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 9 for calling a global function with example usage: test_sort_index(df_time) without return types