Skip to content

Commit 2e55e12

Browse files
authored
Add intcomma regression tests for scientific-notation floats
Added test cases for floats in scientific notation to ensure correct formatting.
1 parent 15c1b2e commit 2e55e12

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎tests/test_number.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ def test_ordinal(test_input: str, expected: str) -> None:
7575
([-math.inf], "-Inf"),
7676
(["nan"], "NaN"),
7777
(["-inf"], "-Inf"),
78+
# Floats whose repr uses scientific notation stay expanded (issue #431)
79+
([1e16], "10,000,000,000,000,000.0"),
80+
([1.5e20], "150,000,000,000,000,000,000.0"),
81+
([-1e16], "-10,000,000,000,000,000.0"),
82+
([1e16, 0], "10,000,000,000,000,000"),
83+
([0.00001], "0.00001"),
84+
([1.23e-5], "0.0000123"),
85+
([1234.5e15], "1,234,500,000,000,000,000.0"),
7886
],
7987
)
8088
def test_intcomma(

0 commit comments

Comments
 (0)