Skip to content

Commit

Permalink
Merge pull request #1986 from bhrutledge/normalize-kilobytes
Browse files Browse the repository at this point in the history
Use "kB" for `DownloadColumn`
  • Loading branch information
willmcgugan authored Feb 22, 2022
2 parents 21432b4 + 156c9c4 commit 4dc1d4c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion rich/progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,9 @@ def render(self, task: "Task") -> Text:
)
else:
unit, suffix = filesize.pick_unit_and_suffix(
total, ["bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], 1000
total,
["bytes", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"],
1000,
)
completed_ratio = completed / unit
total_ratio = total / unit
Expand Down
2 changes: 1 addition & 1 deletion tests/test_progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ 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"
expected = "0.5/1.0 kB"
assert rendered_progress == expected


Expand Down

0 comments on commit 4dc1d4c

Please sign in to comment.