Skip to content

Commit 6e7b2fe

Browse files
lguerardehrenfeu
authored andcommitted
test: Add docstrings to byte conversion tests
* Ensure common sizes are formatted into human-readable strings. * Verify formatting for large sizes such as terabytes.
1 parent 7635330 commit 6e7b2fe

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

tests/test_misc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44

55

66
def test_bytes_to_human_readable_simple():
7+
"""Ensure common sizes are formatted into human-readable strings."""
78
assert bytes_to_human_readable(500) == "500.0 bytes"
89
assert bytes_to_human_readable(2048) == "2.0 KB"
910
assert bytes_to_human_readable(1024 * 1024) == "1.0 MB"
1011
assert bytes_to_human_readable(5 * 1024**3) == "5.0 GB"
1112

1213

1314
def test_bytes_to_human_readable_large():
15+
"""Verify formatting for large sizes such as terabytes."""
1416
# 1.5 TB in bytes should format as 1.5 TB
1517
size = int(1.5 * (1024**4))
1618
assert bytes_to_human_readable(size) == "1.5 TB"

0 commit comments

Comments
 (0)