code: def test_warning_when_df_contains_unseen_categories(
      df_enc, df_enc_rare
  ):
      # dataset to be transformed contains categories not present in
      # training dataset (unseen categories), unseen set to ignore.
  
      msg = "During the encoding, NaN values were introduced in the feature(s) var_A."
  
      # check for warning when unseen equals 'ignore'
      encoder = CountFrequencyEncoder(unseen="ignore")
      encoder.fit(df_enc)
      with pytest.warns(UserWarning) as record:
          encoder.transform(df_enc_rare)
  
      # check that only one warning was raised
      assert len(record) == 1
      # check that the message matches
      assert record[0].message.args[0] == msg
  
imports: import warnings
  import numpy
  import pandas
  import pytest
  from numpy import nan
  from feature_engine.encoding import CountFrequencyEncoder
label_desc: Use image node_id 4 for calling a global function with example usage: test_warning_when_df_contains_unseen_categories(df_enc, df_enc_rare) without return types