@@ -1090,6 +1090,15 @@ def test_formatting(self):
10901090 ('07_' , '1234.56' , '1_234.56' ),
10911091 ('_' , '1.23456789' , '1.23456789' ),
10921092 ('_%' , '123.456789' , '12_345.6789%' ),
1093+ # and now for something completely different...
1094+ ('.,' , '1.23456789' , '1.234,567,89' ),
1095+ ('._' , '1.23456789' , '1.234_567_89' ),
1096+ ('.6_f' , '12345.23456789' , '12345.234_568' ),
1097+ (',._%' , '123.456789' , '12,345.678_9%' ),
1098+ (',._e' , '123456' , '1.234_56e+5' ),
1099+ (',.4_e' , '123456' , '1.234_6e+5' ),
1100+ (',.3_e' , '123456' , '1.235e+5' ),
1101+ (',._E' , '123456' , '1.234_56E+5' ),
10931102
10941103 # negative zero: default behavior
10951104 ('.1f' , '-0' , '-0.0' ),
@@ -1163,6 +1172,10 @@ def test_formatting(self):
11631172 # bytes format argument
11641173 self .assertRaises (TypeError , Decimal (1 ).__format__ , b'-020' )
11651174
1175+ # precision or fractional part separator should follow after dot
1176+ self .assertRaises (ValueError , format , Decimal (1 ), '.f' )
1177+ self .assertRaises (ValueError , format , Decimal (1 ), '._6f' )
1178+
11661179 def test_negative_zero_format_directed_rounding (self ):
11671180 with self .decimal .localcontext () as ctx :
11681181 ctx .rounding = ROUND_CEILING
0 commit comments