code: def test_error_when_variable_contains_multiple_modes(df_na):
      msg = "The variable Name contains multiple frequent categories."
      imputer = CategoricalImputer(
          imputation_method="frequent", variables="Name"
      )
      with pytest.raises(ValueError) as record:
          imputer.fit(df_na)
      # check that error message matches
      assert str(record.value) == msg
  
      msg = "The variable(s) Name contain(s) multiple frequent categories."
      imputer = CategoricalImputer(imputation_method="frequent")
      with pytest.raises(ValueError) as record:
          imputer.fit(df_na)
      # check that error message matches
      assert str(record.value) == msg
  
      df_ = df_na.copy()
      df_["Name_dup"] = df_["Name"]
      msg = "The variable(s) Name, Name_dup contain(s) multiple frequent categories."
      imputer = CategoricalImputer(imputation_method="frequent")
      with pytest.raises(ValueError) as record:
          imputer.fit(df_)
      # check that error message matches
      assert str(record.value) == msg
  
file_path: feature_engine/tests/test_imputation/test_categorical_imputer.py
imports: import pandas
  import pytest
  from feature_engine.imputation import CategoricalImputer
label_desc: Use image node_id 8 for calling a global function with example usage: test_error_when_variable_contains_multiple_modes(df_na) without return types