MCPcopy
hub / github.com/Textualize/rich / test_tree

Function test_tree

tests/test_layout.py:70–83  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

68
69
70def test_tree():
71 layout = Layout(name="root")
72 layout.split(Layout("foo", size=2), Layout("bar", name="bar"))
73 layout["bar"].split_row(Layout(), Layout())
74
75 console = Console(width=60, color_system=None)
76
77 with console.capture() as capture:
78 console.print(layout.tree, height=10)
79 result = capture.get()
80 print(repr(result))
81 expected = "⬍ Layout(name='root')\n├── ⬍ Layout(size=2)\n└── ⬌ Layout(name='bar')\n ├── ⬍ Layout()\n └── ⬍ Layout()\n"
82 print(result, "\n", expected)
83 assert result == expected
84
85
86@pytest.mark.skipif(sys.platform == "win32", reason="does not run on windows")

Callers

nothing calls this directly

Calls 8

splitMethod · 0.95
captureMethod · 0.95
printMethod · 0.95
LayoutClass · 0.90
ConsoleClass · 0.90
split_rowMethod · 0.80
printFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected