mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-29 09:30:07 +03:00
Update test_fields.py
This commit is contained in:
parent
699125a4f7
commit
d0f15a9e99
|
@ -1168,6 +1168,12 @@ class TestQuantizedValueForDecimal(TestCase):
|
|||
value = field.to_internal_value('12.0').as_tuple()
|
||||
expected_digit_tuple = (0, (1, 2, 0, 0), -2)
|
||||
assert value == expected_digit_tuple
|
||||
|
||||
def test_rounding_value_for_decimal(self):
|
||||
field = serializers.DecimalField(max_digits=4, decimal_places=2, rounding=ROUND_HALF_UP)
|
||||
value = field.to_internal_value('12.004).as_tuple()
|
||||
expected_digit_tuple = (0, (1, 2, 0, 0), -2)
|
||||
assert value == expected_digit_tuple
|
||||
|
||||
|
||||
class TestNoDecimalPlaces(FieldValues):
|
||||
|
@ -1197,8 +1203,8 @@ class TestRoundingDecimalField(TestCase):
|
|||
with pytest.raises(AssertionError) as excinfo:
|
||||
serializers.DecimalField(max_digits=1, decimal_places=1, rounding='ROUND_UNKNOWN')
|
||||
assert 'Invalid rounding option' in str(excinfo.value)
|
||||
|
||||
|
||||
|
||||
|
||||
# Date & time serializers...
|
||||
class TestDateField(FieldValues):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue
Block a user