Debian Codegraph @

tests/test_fancy_repr.py

raw symbols SCIP
1 from pytermgui.fancy_repr import FancyYield, build_fancy_repr
2
3
4 class SupportsFancyRepr:
5 def __fancy_repr__(self) -> str:
6 yield f"<{type(self).__name__} test: 123, no_highlight: "
7 yield {"text": "CapitalLetters", "highlight": False}
8 yield {"text": " always_highlight()", "highlight": True}
9 yield ">"
10
11
12 def test_fancy_repr():
13 assert build_fancy_repr(SupportsFancyRepr()) == (
14 "<[code.global]SupportsFancyRepr[/code.global]"
15 + " test: [code.number]123[/code.number], no_highlight: CapitalLetters"
16 + " [code.identifier]always_highlight[/code.identifier]()>"
17 )