code: def test_find_or_check_datetime_variables_when_numeric_is_cast_as_category_or_object(
      df_datetime, _num_var, _cat_type
  ):
      df_datetime = _cast_var_as_type(df_datetime, _num_var, _cat_type)
      with pytest.raises(TypeError):
          assert _find_or_check_datetime_variables(
              df_datetime, variables=_num_var
          )
      with pytest.raises(TypeError):
          assert _find_or_check_datetime_variables(
              df_datetime, variables=[_num_var]
          )
      with pytest.raises(ValueError) as errinfo:
          assert _find_or_check_datetime_variables(
              df_datetime[[_num_var]], variables=None
          )
      assert (
          str(errinfo.value)
          == "No datetime variables found in this dataframe."
      )
      assert _find_or_check_datetime_variables(
          df_datetime, variables=None
      ) == [
          "datetime_range",
          "date_obj1",
          "date_obj2",
          "time_obj",
      ]
  
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 6 for calling a global function with example usage: test_find_or_check_datetime_variables_when_numeric_is_cast_as_category_or_object(df_datetime, _num_var, _cat_type) without return types