@@ -1530,6 +1530,8 @@ def test_format_e_presentation_type(self):
1530
1530
# Thousands separators
1531
1531
(F ('1234567.123456' ), ',.5e' , '1.23457e+06' ),
1532
1532
(F ('123.123456' ), '012_.2e' , '0_001.23e+02' ),
1533
+ # Thousands separators for fractional part (or for integral too)
1534
+ (F ('1234567.123456' ), '.5_e' , '1.234_57e+06' ),
1533
1535
# z flag is legal, but never makes a difference to the output
1534
1536
(F (- 1 , 7 ** 100 ), 'z.6e' , '-3.091690e-85' ),
1535
1537
]
@@ -1655,6 +1657,12 @@ def test_format_f_presentation_type(self):
1655
1657
(F ('1234567' ), ',.2f' , '1,234,567.00' ),
1656
1658
(F ('12345678' ), ',.2f' , '12,345,678.00' ),
1657
1659
(F ('12345678' ), ',f' , '12,345,678.000000' ),
1660
+ # Thousands separators for fractional part (or for integral too)
1661
+ (F ('123456.789123123' ), '._f' , '123456.789_123' ),
1662
+ (F ('123456.789123123' ), '.7_f' , '123456.789_123_1' ),
1663
+ (F ('123456.789123123' ), '.9_f' , '123456.789_123_123' ),
1664
+ (F ('123456.789123123' ), '.,f' , '123456.789,123' ),
1665
+ (F ('123456.789123123' ), '_.,f' , '123_456.789,123' ),
1658
1666
# Underscore as thousands separator
1659
1667
(F (2 , 3 ), '_.2f' , '0.67' ),
1660
1668
(F (2 , 3 ), '_.7f' , '0.6666667' ),
@@ -1828,6 +1836,11 @@ def test_invalid_formats(self):
1828
1836
'.f' ,
1829
1837
'.g' ,
1830
1838
'.%' ,
1839
+ # Thousands separators before precision
1840
+ '._6e' ,
1841
+ '._6f' ,
1842
+ '._6g' ,
1843
+ '._6%' ,
1831
1844
# Z instead of z for negative zero suppression
1832
1845
'Z.2f'
1833
1846
# z flag not supported for general formatting
0 commit comments