code: def test_substyles():
      style = Style(
          [
              ("a.b", "#ff0000 bold"),
              ("a", "#0000ff"),
              ("b", "#00ff00"),
              ("b.c", "#0000ff italic"),
          ]
      )
  
      # Starting with a.*
      expected = Attrs(
          color="0000ff",
          bgcolor="",
          bold=False,
          underline=False,
          strike=False,
          italic=False,
          blink=False,
          reverse=False,
          hidden=False,
      )
      assert style.get_attrs_for_style_str("class:a") == expected
  
      expected = Attrs(
          color="ff0000",
          bgcolor="",
          bold=True,
          underline=False,
          strike=False,
          italic=False,
          blink=False,
          reverse=False,
          hidden=False,
      )
      assert style.get_attrs_for_style_str("class:a.b") == expected
      assert style.get_attrs_for_style_str("class:a.b.c") == expected
  
      # Starting with b.*
      expected = Attrs(
          color="00ff00",
          bgcolor="",
          bold=False,
          underline=False,
          strike=False,
          italic=False,
          blink=False,
          reverse=False,
          hidden=False,
      )
      assert style.get_attrs_for_style_str("class:b") == expected
      assert style.get_attrs_for_style_str("class:b.a") == expected
  
      expected = Attrs(
          color="0000ff",
          bgcolor="",
          bold=False,
          underline=False,
          strike=False,
          italic=True,
          blink=False,
          reverse=False,
          hidden=False,
      )
      assert style.get_attrs_for_style_str("class:b.c") == expected
      assert style.get_attrs_for_style_str("class:b.c.d") == expected
  
imports: from __future__ import annotations
  from prompt_toolkit.styles import Attrs, Style, SwapLightAndDarkStyleTransformation
label_desc: Use image node_id 4 for calling a global function with example usage: test_substyles() without return types