code: def test_formatted_text_with_style():
      f = _Capture()
      style = Style.from_dict(
          {
              "hello": "#ff0066",
              "world": "#44ff44 italic",
          }
      )
      tokens = FormattedText(
          [
              ("class:hello", "Hello "),
              ("class:world", "world"),
          ]
      )
  
      # NOTE: We pass the default (8bit) color depth, so that the unit tests
      #       don't start failing when environment variables change.
      pt_print(
          tokens, style=style, file=f, color_depth=ColorDepth.DEFAULT
      )
      assert "\x1b[0;38;5;197mHello" in f.data
      assert "\x1b[0;38;5;83;3mworld" in f.data
  
file_path: catboost/contrib/python/prompt-toolkit/py3/tests/test_print_formatted_text.py
imports: from __future__ import annotations
  import pytest
  from prompt_toolkit import print_formatted_text
  from prompt_toolkit.formatted_text import HTML, FormattedText, to_formatted_text
  from prompt_toolkit.output import ColorDepth
  from prompt_toolkit.styles import Style
  from prompt_toolkit.utils import is_windows
label_desc: Use image node_id 3 for calling a global function with example usage: test_formatted_text_with_style() without return types