@@ -195,7 +195,6 @@ def test_can_parse_decimals(self):
195195 with pytest .raises (numbers .UnsupportedNumberingSystemError ):
196196 numbers .parse_decimal ('2,109,998' , locale = 'de' , numbering_system = "unknown" )
197197
198-
199198 def test_parse_decimal_strict_mode (self ):
200199 # Numbers with a misplaced grouping symbol should be rejected
201200 with pytest .raises (numbers .NumberFormatError ) as info :
@@ -221,8 +220,19 @@ def test_parse_decimal_strict_mode(self):
221220 assert str (numbers .parse_decimal ('1.001' , locale = 'de' , strict = True )) == '1001'
222221 # Trailing zeroes should be accepted
223222 assert str (numbers .parse_decimal ('3.00' , locale = 'en_US' , strict = True )) == '3.00'
223+ # Numbers with a grouping symbol and no trailing zeroes should be accepted
224+ assert str (numbers .parse_decimal ('3,400.6' , locale = 'en_US' , strict = True )) == '3400.6'
225+ # Numbers with a grouping symbol and trailing zeroes (not all zeroes after decimal) should be accepted
226+ assert str (numbers .parse_decimal ('3,400.60' , locale = 'en_US' , strict = True )) == '3400.60'
227+ # Numbers with a grouping symbol and trailing zeroes (all zeroes after decimal) should be accepted
228+ assert str (numbers .parse_decimal ('3,400.00' , locale = 'en_US' , strict = True )) == '3400.00'
229+ assert str (numbers .parse_decimal ('3,400.0000' , locale = 'en_US' , strict = True )) == '3400.0000'
230+ # Numbers with a grouping symbol and no decimal part should be accepted
231+ assert str (numbers .parse_decimal ('3,800' , locale = 'en_US' , strict = True )) == '3800'
224232 # Numbers without any grouping symbol should be accepted
225233 assert str (numbers .parse_decimal ('2000.1' , locale = 'en_US' , strict = True )) == '2000.1'
234+ # Numbers without any grouping symbol and no decimal should be accepted
235+ assert str (numbers .parse_decimal ('2580' , locale = 'en_US' , strict = True )) == '2580'
226236 # High precision numbers should be accepted
227237 assert str (numbers .parse_decimal ('5,000001' , locale = 'fr' , strict = True )) == '5.000001'
228238
0 commit comments