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

Function test_refresh_screen

tests/test_layout.py:87–100  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

85
86@pytest.mark.skipif(sys.platform == "win32", reason="does not run on windows")
87def test_refresh_screen():
88 layout = Layout()
89 layout.split_row(Layout(name="foo"), Layout(name="bar"))
90 console = Console(force_terminal=True, width=20, height=5, _environ={})
91 with console.capture():
92 console.print(layout)
93 with console.screen():
94 with console.capture() as capture:
95 layout.refresh_screen(console, "foo")
96 result = capture.get()
97 print()
98 print(repr(result))
99 expected = "\x1b[1;1H\x1b[34m╭─\x1b[0m\x1b[34m \x1b[0m\x1b[32m'foo'\x1b[0m\x1b[34m─╮\x1b[0m\x1b[2;1H\x1b[34m│\x1b[0m \x1b[1;35mLayout\x1b[0m \x1b[34m│\x1b[0m\x1b[3;1H\x1b[34m│\x1b[0m \x1b[1m(\x1b[0m \x1b[34m│\x1b[0m\x1b[4;1H\x1b[34m│\x1b[0m \x1b[33mna\x1b[0m \x1b[34m│\x1b[0m\x1b[5;1H\x1b[34m╰────────╯\x1b[0m"
100 assert result == expected

Callers

nothing calls this directly

Calls 9

split_rowMethod · 0.95
captureMethod · 0.95
printMethod · 0.95
screenMethod · 0.95
refresh_screenMethod · 0.95
LayoutClass · 0.90
ConsoleClass · 0.90
printFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected