code: def test_categorical_methods_mixin_raises_warning_when_nan_introduced():
      input_df = pd.DataFrame({"words": ["dog", "dig", "bird"]})
      output_df = pd.DataFrame({"words": [1, 0.66, np.nan]})
      enc = MockClass(unseen="ignore")
      msg = "During the encoding, NaN values were introduced in the feature(s) words."
  
      with pytest.warns(UserWarning) as record:
          enc.transform(input_df)
      assert record[0].message.args[0] == msg
  
      with pytest.warns(UserWarning) as record:
          enc._check_nan_values_after_transformation(output_df)
      assert record[0].message.args[0] == msg
  
file_path: feature_engine/tests/test_encoding/test_base_encoder.py
imports: import numpy
  import pandas
  import pytest
  from feature_engine.encoding.base_encoder import CategoricalInitMixin, CategoricalMethodsMixin
label_desc: Use image node_id 7 for calling a global function with example usage: test_categorical_methods_mixin_raises_warning_when_nan_introduced() without return types