diff --git a/CHANGELOG.md b/CHANGELOG.md index d2c0af7d..3a05e681 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [8.0.1] - unreleased + +### Changed + +- Change the render prefix to correspond to the decimal units in progress + ## [8.0.0] - 2020-10-03 ### Added diff --git a/rich/progress.py b/rich/progress.py index 947f482c..95768598 100644 --- a/rich/progress.py +++ b/rich/progress.py @@ -299,7 +299,9 @@ class DownloadColumn(ProgressColumn): completed = int(task.completed) total = int(task.total) unit, suffix = filesize.pick_unit_and_suffix( - total, ["bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], 1024 + total, + ["bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], + 1000, ) completed_ratio = completed / unit total_ratio = total / unit diff --git a/tests/test_progress.py b/tests/test_progress.py index 34a8e8c1..e94d75ed 100644 --- a/tests/test_progress.py +++ b/tests/test_progress.py @@ -79,6 +79,15 @@ def test_time_remaining_column(): assert str(text) == "0:01:00" +def test_download_progress_uses_decimal_units() -> None: + + column = DownloadColumn() + test_task = Task(1, "test", 1000, 500, _get_time=lambda: 1.0) + rendered_progress = str(column.render(test_task)) + expected = "0.5/1.0 KB" + assert rendered_progress == expected + + def test_task_ids(): progress = make_progress() assert progress.task_ids == [0, 1, 2, 4]