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

Function test_open

tests/test_progress.py:592–613  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

590
591
592def test_open() -> None:
593 console = Console(
594 file=io.StringIO(),
595 force_terminal=True,
596 width=60,
597 color_system="truecolor",
598 legacy_windows=False,
599 _environ={},
600 )
601 progress = Progress(
602 console=console,
603 )
604
605 fd, filename = tempfile.mkstemp()
606 with os.fdopen(fd, "wb") as f:
607 f.write(b"Hello, World!")
608 try:
609 with rich.progress.open(filename) as f:
610 assert f.read() == "Hello, World!"
611 assert f.closed
612 finally:
613 os.remove(filename)
614
615
616def test_open_text_mode() -> None:

Callers

nothing calls this directly

Calls 5

ConsoleClass · 0.90
ProgressClass · 0.90
openMethod · 0.80
writeMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected