code: def test_extract_datetime_features_from_specified_variables(
      df_datetime, df_datetime_transformed
  ):
      # single datetime variable
      X = DatetimeFeatures(variables="date_obj1").fit_transform(
          df_datetime
      )
      pd.testing.assert_frame_equal(
          X,
          df_datetime_transformed[
              vars_non_dt
              + ["datetime_range", "date_obj2", "time_obj"]
              + ["date_obj1" + feat for feat in feat_names_default]
          ],
      )
  
      # multiple datetime variables
      X = DatetimeFeatures(
          variables=["datetime_range", "date_obj2"]
      ).fit_transform(df_datetime)
      pd.testing.assert_frame_equal(
          X,
          df_datetime_transformed[
              vars_non_dt
              + ["date_obj1", "time_obj"]
              + [
                  var + feat
                  for var in ["datetime_range", "date_obj2"]
                  for feat in feat_names_default
              ]
          ],
      )
  
      # multiple datetime variables in different order than they appear in the df
      X = DatetimeFeatures(
          variables=["date_obj2", "date_obj1"]
      ).fit_transform(df_datetime)
      pd.testing.assert_frame_equal(
          X,
          df_datetime_transformed[
              vars_non_dt
              + ["datetime_range", "time_obj"]
              + [
                  var + feat
                  for var in ["date_obj2", "date_obj1"]
                  for feat in feat_names_default
              ]
          ],
      )
  
      # datetime variable is index
      X = DatetimeFeatures(
          variables="index",
          features_to_extract=["month", "day_of_month"],
      ).fit_transform(dates_idx_dt)
      pd.testing.assert_frame_equal(
          X,
          pd.concat(
              [
                  dates_idx_dt,
                  pd.DataFrame(
                      [[2, 27], [2, 28], [3, 1], [3, 2]],
                      index=dates_idx_dt.index,
                      columns=["month", "day_of_month"],
                  ),
              ],
              axis=1,
          ),
      )
  
imports: import numpy
  import pandas
  import pytest
  from sklearn.exceptions import NotFittedError
  from sklearn.pipeline import Pipeline
  from feature_engine.datetime import DatetimeFeatures
  from feature_engine.datetime._datetime_constants import FEATURES_DEFAULT, FEATURES_SUFFIXES, FEATURES_SUPPORTED
label_desc: Use image node_id 14 for calling a global function with example usage: test_extract_datetime_features_from_specified_variables(df_datetime, df_datetime_transformed) without return types