RedinGhost's picture
Publish curated reproducibility artifact
598316f verified
Raw
History Blame Contribute Delete
719 Bytes
diff --git a/tests/test_filesize.py b/tests/test_filesize.py
index e695639..c564bf2 100644
--- a/tests/test_filesize.py
+++ b/tests/test_filesize.py
@@ -103,3 +103,12 @@ def test_naturalsize(test_args: list[int] | list[int | bool], expected: str) ->
test_args[0] = f"-{test_args[0]}"
assert humanize.naturalsize(*test_args) == "-" + expected
+
+
+def test_naturalsize_can_keep_the_pre_rounding_suffix() -> None:
+ assert humanize.naturalsize(999_999, format="%.1f", rollover=False) == "1000.0 kB"
+ assert (
+ humanize.naturalsize(1024**2 - 1, binary=True, rollover=False)
+ == "1024.0 KiB"
+ )
+ assert humanize.naturalsize(1024**2 - 1, gnu=True, rollover=False) == "1024.0K"