diff --git a/tests/test_filesize.py b/tests/test_filesize.py index 645751b9..6a8e4f14 100644 --- a/tests/test_filesize.py +++ b/tests/test_filesize.py @@ -74,10 +74,10 @@ ([3000, False, True, "%.3f"], "2.930K"), ([3000000000, False, True, "%.0f"], "3G"), ([10**26 * 30, True, False, "%.3f"], "2.423 RiB"), - ([1.123456789], "1 Bytes"), + ([1.123456789], "1.1 Bytes"), ([1.123456789 * 10**3], "1.1 kB"), ([1.123456789 * 10**6], "1.1 MB"), - ([1.123456789, False, True], "1B"), + ([1.123456789, False, True], "1.1B"), ([1.123456789 * 10**3, False, True], "1.1K"), ([1.123456789 * 10**6, False, True], "1.1M"), # Rounding must not leave the mantissa at the base while a larger suffix @@ -89,6 +89,30 @@ ([1024**2 - 1, True], "1.0 MiB"), ([1024**3 - 1, True], "1.0 GiB"), ([1024**2 - 1, False, True], "1.0M"), + ([1.5], "1.5 Bytes"), + ([1.9], "1.9 Bytes"), + ([0.5], "0.5 Bytes"), + (["1.5"], "1.5 Bytes"), + ([999.5], "999.5 Bytes"), + ([999.94], "999.9 Bytes"), + ([1.5, True], "1.5 Bytes"), + ([1.123456789, True], "1.1 Bytes"), + ([1023.5, True], "1023.5 Bytes"), + ([1.5, False, True], "1.5B"), + ([1023.5, False, True], "1023.5B"), + ([1.25, False, False, "%.2f"], "1.25 Bytes"), + ([1.5, False, True, "%.3f"], "1.500B"), + ([2.04], "2.0 Bytes"), + ([1.04], "1.0 Bytes"), + ([0.96], "1.0 Bytes"), + ([2.0], "2 Bytes"), + ([999], "999 Bytes"), + ([999.0], "999 Bytes"), + ([1023, True], "1023 Bytes"), + ([1023, False, True], "1023B"), + ([300, False, False, "%.3f"], "300 Bytes"), + ([300, False, True, "%.3f"], "300B"), + ([1.0, False, False, "%.3f"], "1 Byte"), ], ) def test_naturalsize(test_args: list[int] | list[int | bool], expected: str) -> None: