code: def test_find_or_check_datetime_variables(df_datetime):
      var_dt = ["datetime_range"]
      var_dt_str = "datetime_range"
      vars_nondt = ["Age", "Name"]
      vars_convertible_to_dt = [
          "datetime_range",
          "date_obj1",
          "date_obj2",
          "time_obj",
      ]
      var_convertible_to_dt = "date_obj1"
      vars_mix = ["datetime_range", "Age"]
      tz_time = pd.DataFrame(
          {
              "time_objTZ": df_datetime["time_obj"].add(
                  ["+5", "+11", "-3", "-8"]
              )
          }
      )
  
      # error when df has no datetime variables
      with pytest.raises(ValueError):
          assert _find_or_check_datetime_variables(
              df_datetime.loc[:, vars_nondt], variables=None
          )
  
      # errors when vars entered by user are not datetime
      with pytest.raises(TypeError):
          assert _find_or_check_datetime_variables(
              df_datetime, variables="Age"
          )
      with pytest.raises(TypeError):
          assert _find_or_check_datetime_variables(
              df_datetime, variables=vars_nondt
          )
      with pytest.raises(TypeError):
          assert _find_or_check_datetime_variables(
              df_datetime, variables=vars_mix
          )
  
      # error when user enters empty list
      with pytest.raises(ValueError):
          assert _find_or_check_datetime_variables(
              df_datetime, variables=[]
          )
  
      # when variables=None
      assert (
          _find_or_check_datetime_variables(df_datetime, variables=None)
          == vars_convertible_to_dt
      )
      assert _find_or_check_datetime_variables(
          df_datetime[vars_convertible_to_dt].reindex(
              columns=["date_obj1", "datetime_range", "date_obj2"]
          ),
          variables=None,
      ) == ["date_obj1", "datetime_range", "date_obj2"]
  
      # when variables are specified
      assert _find_or_check_datetime_variables(
          df_datetime, var_dt_str
      ) == [var_dt_str]
      assert (
          _find_or_check_datetime_variables(df_datetime, var_dt)
          == var_dt
      )
      assert _find_or_check_datetime_variables(
          df_datetime, variables=var_convertible_to_dt
      ) == [var_convertible_to_dt]
      assert (
          _find_or_check_datetime_variables(
              df_datetime, variables=vars_convertible_to_dt
          )
          == vars_convertible_to_dt
      )
      assert _find_or_check_datetime_variables(
          df_datetime.join(tz_time),
          variables=None,
      ) == vars_convertible_to_dt + ["time_objTZ"]
  
      # datetime var cast as categorical
      df_datetime["date_obj1"] = df_datetime["date_obj1"].astype(
          "category"
      )
      assert _find_or_check_datetime_variables(
          df_datetime, variables="date_obj1"
      ) == ["date_obj1"]
      assert (
          _find_or_check_datetime_variables(
              df_datetime, variables=vars_convertible_to_dt
          )
          == vars_convertible_to_dt
      )
  
file_path: feature_engine/tests/test_variable_handling/test_variable_type_selection.py
imports: import pandas
  import pytest
  from feature_engine._variable_handling.variable_type_selection import _filter_out_variables_not_in_dataframe, _find_all_variables, _find_categorical_and_numerical_variables, _find_or_check_categorical_variables, _find_or_check_datetime_variables, _find_or_check_numerical_variables
label_desc: Use image node_id 5 for calling a global function with example usage: test_find_or_check_datetime_variables(df_datetime) without return types