@@ -195,7 +195,6 @@ def test_can_parse_decimals(self):
195
195
with pytest .raises (numbers .UnsupportedNumberingSystemError ):
196
196
numbers .parse_decimal ('2,109,998' , locale = 'de' , numbering_system = "unknown" )
197
197
198
-
199
198
def test_parse_decimal_strict_mode (self ):
200
199
# Numbers with a misplaced grouping symbol should be rejected
201
200
with pytest .raises (numbers .NumberFormatError ) as info :
@@ -221,8 +220,19 @@ def test_parse_decimal_strict_mode(self):
221
220
assert str (numbers .parse_decimal ('1.001' , locale = 'de' , strict = True )) == '1001'
222
221
# Trailing zeroes should be accepted
223
222
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'
224
232
# Numbers without any grouping symbol should be accepted
225
233
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'
226
236
# High precision numbers should be accepted
227
237
assert str (numbers .parse_decimal ('5,000001' , locale = 'fr' , strict = True )) == '5.000001'
228
238
0 commit comments