code: def test_ansi_interpolation():
      # %-style interpolation.
      value = ANSI("\x1b[1m%s\x1b[0m") % "hello\x1b"
      assert to_formatted_text(value) == [
          ("bold", "h"),
          ("bold", "e"),
          ("bold", "l"),
          ("bold", "l"),
          ("bold", "o"),
          ("bold", "?"),
      ]
  
      value = ANSI("\x1b[1m%s\x1b[0m") % ("\x1bhello",)
      assert to_formatted_text(value) == [
          ("bold", "?"),
          ("bold", "h"),
          ("bold", "e"),
          ("bold", "l"),
          ("bold", "l"),
          ("bold", "o"),
      ]
  
      value = ANSI("\x1b[32m%s\x1b[45m%s") % ("He", "\x1bllo")
      assert to_formatted_text(value) == [
          ("ansigreen", "H"),
          ("ansigreen", "e"),
          ("ansigreen bg:ansimagenta", "?"),
          ("ansigreen bg:ansimagenta", "l"),
          ("ansigreen bg:ansimagenta", "l"),
          ("ansigreen bg:ansimagenta", "o"),
      ]
  
      # Format function.
      value = ANSI("\x1b[32m{0}\x1b[45m{1}").format("He\x1b", "llo")
      assert to_formatted_text(value) == [
          ("ansigreen", "H"),
          ("ansigreen", "e"),
          ("ansigreen", "?"),
          ("ansigreen bg:ansimagenta", "l"),
          ("ansigreen bg:ansimagenta", "l"),
          ("ansigreen bg:ansimagenta", "o"),
      ]
  
      value = ANSI("\x1b[32m{a}\x1b[45m{b}").format(a="\x1bHe", b="llo")
      assert to_formatted_text(value) == [
          ("ansigreen", "?"),
          ("ansigreen", "H"),
          ("ansigreen", "e"),
          ("ansigreen bg:ansimagenta", "l"),
          ("ansigreen bg:ansimagenta", "l"),
          ("ansigreen bg:ansimagenta", "o"),
      ]
  
      value = ANSI("\x1b[32m{:02d}\x1b[45m{:.3f}").format(3, 3.14159)
      assert to_formatted_text(value) == [
          ("ansigreen", "0"),
          ("ansigreen", "3"),
          ("ansigreen bg:ansimagenta", "3"),
          ("ansigreen bg:ansimagenta", "."),
          ("ansigreen bg:ansimagenta", "1"),
          ("ansigreen bg:ansimagenta", "4"),
          ("ansigreen bg:ansimagenta", "2"),
      ]
  
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 6 for calling a global function with example usage: test_ansi_interpolation() without return types