mirror of https://github.com/Textualize/rich.git
render test
This commit is contained in:
parent
f80601a93e
commit
365b8d7c11
|
@ -51,3 +51,20 @@ def test_render_ascii():
|
|||
result = console.end_capture()
|
||||
expected = "foo \n+-- bar \n`-- baz \n"
|
||||
assert result == expected
|
||||
|
||||
|
||||
def test_render():
|
||||
tree = Tree("foo")
|
||||
tree.add("bar", style="italic")
|
||||
baz_tree = tree.add("baz", guide_style="bold red", style="on blue")
|
||||
baz_tree.add("1")
|
||||
baz_tree.add("2")
|
||||
tree.add("egg")
|
||||
|
||||
console = Console(width=20, force_terminal=True, color_system="standard")
|
||||
console.begin_capture()
|
||||
console.print(tree)
|
||||
result = console.end_capture()
|
||||
print(repr(result))
|
||||
expected = "foo \n├── \x1b[3mbar\x1b[0m\x1b[3m \x1b[0m\n\x1b[44m├── \x1b[0m\x1b[44mbaz\x1b[0m\x1b[44m \x1b[0m\n\x1b[44m│ \x1b[0m\x1b[1;31;44m┣━━ \x1b[0m\x1b[44m1\x1b[0m\x1b[44m \x1b[0m\n\x1b[44m│ \x1b[0m\x1b[1;31;44m┗━━ \x1b[0m\x1b[44m2\x1b[0m\x1b[44m \x1b[0m\n└── egg \n"
|
||||
assert result == expected
|
||||
|
|
Loading…
Reference in New Issue