code: def test_max_n_categories(df_enc_big):
      # test case 6: user provides the maximum number of categories they want
      rare_encoder = RareLabelEncoder(
          tol=0.10, max_n_categories=4, n_categories=5
      )
      X = rare_encoder.fit_transform(df_enc_big)
      df = {
          "var_A": ["A"] * 6
          + ["B"] * 10
          + ["Rare"] * 4
          + ["D"] * 10
          + ["Rare"] * 4
          + ["G"] * 6,
          "var_B": ["A"] * 10
          + ["B"] * 6
          + ["Rare"] * 4
          + ["D"] * 10
          + ["Rare"] * 4
          + ["G"] * 6,
          "var_C": ["Rare"] * 4
          + ["B"] * 6
          + ["C"] * 10
          + ["D"] * 10
          + ["Rare"] * 4
          + ["G"] * 6,
      }
      df = pd.DataFrame(df)
      pd.testing.assert_frame_equal(X, df)
  
file_path: feature_engine/tests/test_encoding/test_rare_label_encoder.py
imports: import pandas
  import pytest
  from feature_engine.encoding import RareLabelEncoder
label_desc: Use image node_id 8 for calling a global function with example usage: test_max_n_categories(df_enc_big) without return types