@@ -1082,6 +1082,15 @@ def test_formatting(self):
10821082 (',%' , '123.456789' , '12,345.6789%' ),
10831083 (',e' , '123456' , '1.23456e+5' ),
10841084 (',E' , '123456' , '1.23456E+5' ),
1085+ # and now for something completely different...
1086+ ('.,' , '1.23456789' , '1.234,567,89' ),
1087+ ('._' , '1.23456789' , '1.234_567_89' ),
1088+ ('.6_f' , '1.23456789' , '1.234_568' ),
1089+ (',._%' , '123.456789' , '12,345.678_9%' ),
1090+ (',._e' , '123456' , '1.234_56e+5' ),
1091+ (',.4_e' , '123456' , '1.234_6e+5' ),
1092+ (',.3_e' , '123456' , '1.235e+5' ),
1093+ (',._E' , '123456' , '1.234_56E+5' ),
10851094
10861095 # negative zero: default behavior
10871096 ('.1f' , '-0' , '-0.0' ),
@@ -1155,6 +1164,9 @@ def test_formatting(self):
11551164 # bytes format argument
11561165 self .assertRaises (TypeError , Decimal (1 ).__format__ , b'-020' )
11571166
1167+ # precision or fractional part separator should follow after dot
1168+ self .assertRaises (ValueError , format , Decimal (1 ), '.f' )
1169+
11581170 def test_negative_zero_format_directed_rounding (self ):
11591171 with self .decimal .localcontext () as ctx :
11601172 ctx .rounding = ROUND_CEILING
0 commit comments