code: def test_html_with_fg_bg():
      html = HTML('<style bg="ansired">hello</style>')
      assert to_formatted_text(html) == [
          ("bg:ansired", "hello"),
      ]
  
      html = HTML('<style bg="ansired" fg="#ff0000">hello</style>')
      assert to_formatted_text(html) == [
          ("fg:#ff0000 bg:ansired", "hello"),
      ]
  
      html = HTML(
          '<style bg="ansired" fg="#ff0000">hello <world fg="ansiblue">world</world></style>'
      )
      assert to_formatted_text(html) == [
          ("fg:#ff0000 bg:ansired", "hello "),
          ("class:world fg:ansiblue bg:ansired", "world"),
      ]
  
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 2 for calling a global function with example usage: test_html_with_fg_bg() without return types