rich/tests/test_screen.py

13 lines
480 B
Python
Raw Normal View History

2021-02-13 18:17:14 +00:00
from rich.console import Console
from rich.screen import Screen
def test_screen():
2021-11-09 17:43:23 +00:00
console = Console(color_system=None, width=20, height=5, legacy_windows=False)
2021-02-13 18:17:14 +00:00
with console.capture() as capture:
console.print(Screen("foo\nbar\nbaz\nfoo\nbar\nbaz\foo"))
result = capture.get()
print(repr(result))
expected = "foo \nbar \nbaz \nfoo \nbar "
2021-02-13 18:25:47 +00:00
assert result == expected