code: def test_category_encoder_handles_missing():
      df_no_nas = pd.DataFrame({"col1": ["a", "b", "c"]})
      df_nas = pd.DataFrame({"col1": ["a", "b", None]})
      df_new = pd.DataFrame({"col1": ["a", "b", "d"]})
  
      # check that it fails for missing values when using 'raise'
      tr = MatchCategories(missing_values="raise")
      with pytest.raises(ValueError):
          tr.fit(df_nas)
  
      tr.fit(df_no_nas)
      with pytest.raises(ValueError):
          tr.transform(df_nas)
  
      # check that it doens't fail for missing values when using 'ignore'
      tr = MatchCategories(missing_values="ignore").fit(df_nas)
      with pytest.warns(UserWarning):
          tr.transform(df_nas)
  
      # check that it doesn't fail at transforming new values when using 'ignore'
      tr = MatchCategories(missing_values="ignore").fit(df_no_nas)
      with pytest.warns(UserWarning):
          tr.transform(df_new)
  
imports: import warnings
  import numpy
  import pandas
  import pytest
  from feature_engine.preprocessing import MatchCategories
label_desc: Use image node_id 2 for calling a global function with example usage: test_category_encoder_handles_missing() without return types