code: def test_mode_imputation_and_single_variable(df_na):
      # set up imputer
      imputer = CategoricalImputer(
          imputation_method="frequent", variables="City"
      )
      X_transformed = imputer.fit_transform(df_na)
  
      # set up expected result
      X_reference = df_na.copy()
      X_reference["City"] = X_reference["City"].fillna("London")
  
      # test init, fit and transform params, attr and output
      assert imputer.imputation_method == "frequent"
      assert imputer.variables == "City"
      assert imputer.variables_ == ["City"]
      assert imputer.n_features_in_ == 6
      assert imputer.imputer_dict_ == {"City": "London"}
      assert X_transformed["City"].isnull().sum() == 0
      assert X_transformed[["Age", "Marks"]].isnull().sum().sum() > 0
      pd.testing.assert_frame_equal(X_transformed, X_reference)
  
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 3 for calling a global function with example usage: test_mode_imputation_and_single_variable(df_na) without return types