@@ -1334,6 +1334,8 @@ def test_format_e_presentation_type(self):
13341334 # Thousands separators
13351335 (F ('1234567.123456' ), ',.5e' , '1.23457e+06' ),
13361336 (F ('123.123456' ), '012_.2e' , '0_001.23e+02' ),
1337+ # Thousands separators for fractional part (or for integral too)
1338+ (F ('1234567.123456' ), '.5_e' , '1.234_57e+06' ),
13371339 # z flag is legal, but never makes a difference to the output
13381340 (F (- 1 , 7 ** 100 ), 'z.6e' , '-3.091690e-85' ),
13391341 ]
@@ -1459,6 +1461,12 @@ def test_format_f_presentation_type(self):
14591461 (F ('1234567' ), ',.2f' , '1,234,567.00' ),
14601462 (F ('12345678' ), ',.2f' , '12,345,678.00' ),
14611463 (F ('12345678' ), ',f' , '12,345,678.000000' ),
1464+ # Thousands separators for fractional part (or for integral too)
1465+ (F ('123456.789123123' ), '._f' , '123456.789_123' ),
1466+ (F ('123456.789123123' ), '.7_f' , '123456.789_123_1' ),
1467+ (F ('123456.789123123' ), '.9_f' , '123456.789_123_123' ),
1468+ (F ('123456.789123123' ), '.,f' , '123456.789,123' ),
1469+ (F ('123456.789123123' ), '_.,f' , '123_456.789,123' ),
14621470 # Underscore as thousands separator
14631471 (F (2 , 3 ), '_.2f' , '0.67' ),
14641472 (F (2 , 3 ), '_.7f' , '0.6666667' ),
@@ -1639,6 +1647,11 @@ def test_invalid_formats(self):
16391647 '.f' ,
16401648 '.g' ,
16411649 '.%' ,
1650+ # Thousands separators before precision
1651+ '._6e' ,
1652+ '._6f' ,
1653+ '._6g' ,
1654+ '._6%' ,
16421655 # Z instead of z for negative zero suppression
16431656 'Z.2f'
16441657 # z flag not supported for general formatting
0 commit comments