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

Function test_screen_update

tests/test_console.py:737–749  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

735
736@pytest.mark.skipif(sys.platform == "win32", reason="does not run on windows")
737def test_screen_update() -> None:
738 console = Console(
739 width=20, height=4, color_system="truecolor", force_terminal=True, _environ={}
740 )
741 with console.capture() as capture:
742 with console.screen() as screen:
743 screen.update("foo", style="blue")
744 screen.update("bar")
745 screen.update()
746 result = capture.get()
747 print(repr(result))
748 expected = "\x1b[?1049h\x1b[H\x1b[?25l\x1b[34mfoo\x1b[0m\x1b[34m \x1b[0m\n\x1b[34m \x1b[0m\n\x1b[34m \x1b[0m\n\x1b[34m \x1b[0m\x1b[34mbar\x1b[0m\x1b[34m \x1b[0m\n\x1b[34m \x1b[0m\n\x1b[34m \x1b[0m\n\x1b[34m \x1b[0m\x1b[34mbar\x1b[0m\x1b[34m \x1b[0m\n\x1b[34m \x1b[0m\n\x1b[34m \x1b[0m\n\x1b[34m \x1b[0m\x1b[?1049l\x1b[?25h"
749 assert result == expected
750
751
752def test_height() -> None:

Callers

nothing calls this directly

Calls 6

captureMethod · 0.95
screenMethod · 0.95
ConsoleClass · 0.90
printFunction · 0.50
updateMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected