code: def test_raises_error_when_input_not_a_df(estimator):
      # 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"),
      ]
  
      transformer = clone(estimator)
  
      # Error in fit param:
      for not_df in _not_a_df:
          # test fitting not a df
          with pytest.raises(TypeError):
              transformer.fit(not_df)
  
      # error in transform param:
      X, y = test_df(categorical=True, datetime=True)
  
      if transformer.__class__.__name__ == "TargetMeanRegressor":
          # y needs to be continuous
          y = X["var_1"]
          X.drop(["var_1"], axis=1, inplace=True)
  
      transformer.fit(X, y)
      for not_df in _not_a_df:
          if hasattr(transformer, "_predict"):
              with pytest.raises(TypeError):
                  transformer._predict(not_df)
          else:
              with pytest.raises(TypeError):
                  transformer.predict(not_df)
  
imports: import numpy
  import pandas
  import pytest
  from sklearn.base import clone
  from sklearn.exceptions import NotFittedError
  from sklearn.utils.estimator_checks import check_estimator
  from feature_engine._prediction.base_predictor import BaseTargetMeanEstimator
  from feature_engine._prediction.target_mean_classifier import TargetMeanClassifier
  from feature_engine._prediction.target_mean_regressor import TargetMeanRegressor
  from feature_engine.discretisation import EqualFrequencyDiscretiser, EqualWidthDiscretiser
  from feature_engine.encoding import MeanEncoder
  from tests.estimator_checks.dataframe_for_checks import test_df
  from tests.estimator_checks.fit_functionality_checks import check_error_if_y_not_passed
label_desc: Use image node_id 4 for calling a global function with example usage: test_raises_error_when_input_not_a_df(estimator) without return types