code: def test_add_content_to_text(self):
      test_text = """all_configs = {
      "gpt": "GPTConfig",
      "bert": "BertConfig",
      "t5": "T5Config",
  }"""
  
      expected = """all_configs = {
      "gpt": "GPTConfig",
      "gpt2": "GPT2Config",
      "bert": "BertConfig",
      "t5": "T5Config",
  }"""
      line = '    "gpt2": "GPT2Config",'
  
      self.assertEqual(
          add_content_to_text(test_text, line, add_before="bert"),
          expected,
      )
      self.assertEqual(
          add_content_to_text(
              test_text, line, add_before="bert", exact_match=True
          ),
          test_text,
      )
      self.assertEqual(
          add_content_to_text(
              test_text,
              line,
              add_before='    "bert": "BertConfig",',
              exact_match=True,
          ),
          expected,
      )
      self.assertEqual(
          add_content_to_text(
              test_text, line, add_before=re.compile('^\s*"bert":')
          ),
          expected,
      )
  
      self.assertEqual(
          add_content_to_text(test_text, line, add_after="gpt"),
          expected,
      )
      self.assertEqual(
          add_content_to_text(
              test_text, line, add_after="gpt", exact_match=True
          ),
          test_text,
      )
      self.assertEqual(
          add_content_to_text(
              test_text,
              line,
              add_after='    "gpt": "GPTConfig",',
              exact_match=True,
          ),
          expected,
      )
      self.assertEqual(
          add_content_to_text(
              test_text, line, add_after=re.compile('^\s*"gpt":')
          ),
          expected,
      )
  
imports: import os
  import re
  import tempfile
  import unittest
  from pathlib import Path
  import transformers
  from transformers.commands.add_new_model_like import ModelPatterns, _re_class_func, add_content_to_file, add_content_to_text, clean_frameworks_in_init, duplicate_doc_file, duplicate_module, filter_framework_files, find_base_model_checkpoint, get_model_files, get_module_from_file, parse_module_content, replace_model_patterns, retrieve_info_for_model, retrieve_model_classes, simplify_replacements
  from transformers.testing_utils import require_flax, require_tf, require_torch
label_desc: Use image node_id 6 for calling the TestAddNewModelLike obj's underlying member method code with example usage: obj.test_add_content_to_text() without return types