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

Function test_capture_and_record

tests/test_console.py:1026–1044  ·  view source on GitHub ↗

Regression test for https://github.com/Textualize/rich/issues/2563

()

Source from the content-addressed store, hash-verified

1024
1025
1026def test_capture_and_record() -> None:
1027 """Regression test for https://github.com/Textualize/rich/issues/2563"""
1028
1029 console = Console(record=True)
1030 print("Before Capture started:")
1031 console.print("[blue underline]Print 0")
1032 with console.capture() as capture:
1033 console.print("[blue underline]Print 1")
1034 console.print("[blue underline]Print 2")
1035 console.print("[blue underline]Print 3")
1036 console.print("[blue underline]Print 4")
1037
1038 capture_content = capture.get()
1039 print(repr(capture_content))
1040 assert capture_content == "Print 1\nPrint 2\nPrint 3\nPrint 4\n"
1041
1042 recorded_content = console.export_text()
1043 print(repr(recorded_content))
1044 assert recorded_content == "Print 0\n"
1045
1046
1047def test_tty_interactive() -> None:

Callers

nothing calls this directly

Calls 6

printMethod · 0.95
captureMethod · 0.95
export_textMethod · 0.95
ConsoleClass · 0.90
printFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected