code: def test_warn_imbalanced_completion():
      df_generation = pd.DataFrame(
          {
              "prompt": [f"prompt{i}" for i in range(100)],
              "completion": [f"completion{i}" for i in range(100)],
          }
      )
      assert warn_imbalanced_completion(df_generation) is None
  
      df_classification_balanced = pd.DataFrame(
          {
              "prompt": [f"prompt{i}" for i in range(100)],
              "completion": [f"completion{i}" for i in range(5)] * 20,
          }
      )
  
      msg_classification_balanced = f"There are {5} unique completions over {100} samples.\nThe five most common completions are:"
      for i in range(5):
          msg_classification_balanced += f"\n {20} samples ({20.0}%) with completion: completion{i}"
  
      assert (
          warn_imbalanced_completion(df_classification_balanced)
          == msg_classification_balanced
      )
  
      df_classification_imbalanced = pd.DataFrame(
          {
              "prompt": [f"prompt{i}" for i in range(100)],
              "completion": ["completion0"] * 95
              + [f"completion{i}" for i in range(5)],
          }
      )
  
      msg_classification_imbalanced = f"There are {5} unique completions over {100} samples.\nThe five most common completions are:"
      msg_classification_imbalanced += (
          f"\n {96} samples ({96.0}%) with completion: completion0"
      )
      for i in range(1, 5):
          msg_classification_imbalanced += (
              f"\n {1} samples ({1.0}%) with completion: completion{i}"
          )
  
      assert (
          warn_imbalanced_completion(df_classification_imbalanced)
          == msg_classification_imbalanced
      )
  
imports: import pandas
  import pytest
  from ..customization_dataset_preparation import convert_into_prompt_completion_only, convert_into_template, drop_duplicated_rows, drop_unrequired_fields, get_common_suffix, get_prepared_filename, parse_template, recommend_hyperparameters, show_first_example_in_df, split_into_train_validation, template_mapper, validate_template, warn_and_drop_long_samples, warn_completion_is_not_empty, warn_duplicated_rows, warn_imbalanced_completion, warn_low_n_samples, warn_missing_suffix
label_desc: Use image node_id 3 for calling a global function with example usage: test_warn_imbalanced_completion() without return types