code: def check_raises_error_when_input_not_a_df(estimator):
      """
      Checks if transformer raises error when user passes input other than a pandas
      dataframe or numpy array to fit() or transform() methods.
  
      Functionality is provided by `is_dataframe`.
      """
      # non-permitted inputs.
      _not_a_df = [
          "not_a_df",
          [1, 2, 3, "some_data"],
          pd.Series([-2, 1.5, 8.94], name="not_a_df"),
      ]
  
      # permitted input
      X, y = test_df(categorical=True, datetime=True)
  
      transformer = clone(estimator)
  
      for not_df in _not_a_df:
          # test fitting not a df
          with pytest.raises(TypeError):
              transformer.fit(not_df)
  
          transformer.fit(X, y)
          # test transforming not a df
          with pytest.raises(TypeError):
              transformer.transform(not_df)
  
file_path: feature_engine/tests/estimator_checks/estimator_checks.py
imports: import pandas
  import pytest
  from sklearn.base import clone
  from tests.estimator_checks.dataframe_for_checks import test_df
  from tests.estimator_checks.fit_functionality_checks import check_error_if_y_not_passed, check_feature_names_in
  from tests.estimator_checks.get_feature_names_out_checks import check_get_feature_names_out
  from tests.estimator_checks.init_params_allowed_values_checks import check_error_param_missing_values
  from tests.estimator_checks.init_params_triggered_functionality_checks import check_drop_original_variables, check_takes_cv_constructor
  from tests.estimator_checks.non_fitted_error_checks import check_raises_non_fitted_error
  from tests.estimator_checks.variable_selection_checks import check_all_types_variables_assignment, check_categorical_variables_assignment, check_datetime_variables_assignment, check_numerical_variables_assignment
label_desc: Use image node_id 2 for calling a global function with example usage: check_raises_error_when_input_not_a_df(estimator) without return types