code: def test_ansi_formatting():
      value = ANSI("\x1b[32mHe\x1b[45mllo")
  
      assert to_formatted_text(value) == [
          ("ansigreen", "H"),
          ("ansigreen", "e"),
          ("ansigreen bg:ansimagenta", "l"),
          ("ansigreen bg:ansimagenta", "l"),
          ("ansigreen bg:ansimagenta", "o"),
      ]
  
      # Bold and italic.
      value = ANSI("\x1b[1mhe\x1b[0mllo")
  
      assert to_formatted_text(value) == [
          ("bold", "h"),
          ("bold", "e"),
          ("", "l"),
          ("", "l"),
          ("", "o"),
      ]
  
      # Zero width escapes.
      value = ANSI("ab\001cd\002ef")
  
      assert to_formatted_text(value) == [
          ("", "a"),
          ("", "b"),
          ("[ZeroWidthEscape]", "cd"),
          ("", "e"),
          ("", "f"),
      ]
  
      assert isinstance(to_formatted_text(value), FormattedText)
  
file_path: catboost/contrib/python/prompt-toolkit/py3/tests/test_formatted_text.py
imports: from __future__ import annotations
  from prompt_toolkit.formatted_text import ANSI, HTML, FormattedText, PygmentsTokens, Template, merge_formatted_text, to_formatted_text
  from prompt_toolkit.formatted_text.utils import split_lines
label_desc: Use image node_id 3 for calling a global function with example usage: test_ansi_formatting() without return types