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

Function test_wrap_file_task_total

tests/test_progress.py:647–670  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

645
646
647def test_wrap_file_task_total() -> None:
648 console = Console(
649 file=io.StringIO(),
650 force_terminal=True,
651 width=60,
652 color_system="truecolor",
653 legacy_windows=False,
654 _environ={},
655 )
656 progress = Progress(
657 console=console,
658 )
659
660 fd, filename = tempfile.mkstemp()
661 with os.fdopen(fd, "wb") as f:
662 total = f.write(b"Hello, World!")
663 try:
664 with progress:
665 with open(filename, "rb") as file:
666 task_id = progress.add_task("Reading", total=total)
667 with progress.wrap_file(file, task_id=task_id) as f:
668 assert f.read() == b"Hello, World!"
669 finally:
670 os.remove(filename)
671
672
673def test_task_progress_column_speed() -> None:

Callers

nothing calls this directly

Calls 7

add_taskMethod · 0.95
wrap_fileMethod · 0.95
ConsoleClass · 0.90
ProgressClass · 0.90
openFunction · 0.85
writeMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected