| 645 | |
| 646 | |
| 647 | def 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 | |
| 673 | def test_task_progress_column_speed() -> None: |