code: def test_categorical_variables(df_classification):
      X, y = df_classification
  
      tr = TargetMeanClassifier(variables="cat_var_A")
      tr.fit(X, y)
  
      pred = tr.predict(X)
      prob = tr.predict_proba(X)
  
      exp_pred = np.array(
          [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
      )
      exp_prob = np.array(
          [
              [1.0, 0.0],
              [1.0, 0.0],
              [1.0, 0.0],
              [1.0, 0.0],
              [1.0, 0.0],
              [1.0, 0.0],
              [1.0, 0.0],
              [1.0, 0.0],
              [1.0, 0.0],
              [1.0, 0.0],
              [0.0, 1.0],
              [0.0, 1.0],
              [0.0, 1.0],
              [0.0, 1.0],
              [0.0, 1.0],
              [0.0, 1.0],
              [0.0, 1.0],
              [0.0, 1.0],
              [0.0, 1.0],
              [0.0, 1.0],
          ]
      )
  
      assert np.array_equal(pred, exp_pred)
      assert np.array_equal(prob, exp_prob)
  
      tr = TargetMeanClassifier(variables="cat_var_B")
      tr.fit(X, y)
  
      pred = tr.predict(X)
      prob = tr.predict_proba(X)
  
      exp_pred = np.array(
          [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]
      )
      exp_prob = np.array(
          [
              [1.0, 0.0],
              [1.0, 0.0],
              [1.0, 0.0],
              [1.0, 0.0],
              [1.0, 0.0],
              [1.0, 0.0],
              [0.5, 0.5],
              [0.5, 0.5],
              [0.5, 0.5],
              [0.5, 0.5],
              [0.5, 0.5],
              [0.5, 0.5],
              [0.5, 0.5],
              [0.5, 0.5],
              [0.0, 1.0],
              [0.0, 1.0],
              [0.0, 1.0],
              [0.0, 1.0],
              [0.0, 1.0],
              [0.0, 1.0],
          ]
      )
  
      assert np.array_equal(pred, exp_pred)
      assert np.array_equal(prob, exp_prob)
  
      tr = TargetMeanClassifier(variables=["cat_var_A", "cat_var_B"])
      tr.fit(X, y)
  
      pred = tr.predict(X)
      prob = tr.predict_proba(X)
  
      exp_pred = np.array(
          [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
      )
      exp_prob = np.array(
          [
              [1.0, 0.0],
              [1.0, 0.0],
              [1.0, 0.0],
              [1.0, 0.0],
              [1.0, 0.0],
              [1.0, 0.0],
              [0.75, 0.25],
              [0.75, 0.25],
              [0.75, 0.25],
              [0.75, 0.25],
              [0.25, 0.75],
              [0.25, 0.75],
              [0.25, 0.75],
              [0.25, 0.75],
              [0.0, 1.0],
              [0.0, 1.0],
              [0.0, 1.0],
              [0.0, 1.0],
              [0.0, 1.0],
              [0.0, 1.0],
          ]
      )
  
      assert np.array_equal(pred, exp_pred)
      assert np.array_equal(prob, exp_prob)
  
imports: import numpy
  import pandas
  from feature_engine._prediction.target_mean_classifier import TargetMeanClassifier
label_desc: Use image node_id 2 for calling a global function with example usage: test_categorical_variables(df_classification) without return types