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