From 9b928c0a02227d2d905b8979433b618b5563d207 Mon Sep 17 00:00:00 2001 From: romain Date: Wed, 21 Oct 2026 15:25:54 -0400 Subject: [PATCH] Test #239: cover string and GNU float input below base in naturalsize Issue #239 was fixed on main by 11e62ee (#240) and a79fb3a. Add the two sub-base cases those commits don't cover: string input ("300") and a non-integer float on the GNU path (300.9 -> "300B", truncated). Both fail against the 4.12.0 f-string regression. Co-Authored-By: Claude Opus 5.5 --- tests/test_filesize.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_filesize.py b/tests/test_filesize.py index 645751b9..7535ec69 100644 --- a/tests/test_filesize.py +++ b/tests/test_filesize.py @@ -80,6 +80,8 @@ ([1.123456789, False, True], "1B"), ([1.123456789 * 10**3, False, True], "1.1K"), ([1.123456789 * 10**6, False, True], "1.1M"), + (["300"], "300 Bytes"), + ([300.9, False, True], "300B"), # Rounding must not leave the mantissa at the base while a larger suffix # is available: 999999 is 999.999 kB, which the "%.1f" format rounds to # 1000.0 and must carry into 1.0 MB rather than render as "1000.0 kB".