summaryrefslogtreecommitdiff
path: root/tests/model_fields/test_decimalfield.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/model_fields/test_decimalfield.py')
-rw-r--r--tests/model_fields/test_decimalfield.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/model_fields/test_decimalfield.py b/tests/model_fields/test_decimalfield.py
index c8851c5d94..893d529ed5 100644
--- a/tests/model_fields/test_decimalfield.py
+++ b/tests/model_fields/test_decimalfield.py
@@ -81,3 +81,9 @@ class DecimalFieldTests(TestCase):
expected_message = validators.DecimalValidator.messages['max_whole_digits'] % {'max': 2}
with self.assertRaisesMessage(ValidationError, expected_message):
field.clean(Decimal('999'), None)
+
+ def test_roundtrip_with_trailing_zeros(self):
+ """Trailing zeros in the fractional part aren't truncated."""
+ obj = Foo.objects.create(a='bar', d=Decimal('8.320'))
+ obj.refresh_from_db()
+ self.assertEqual(obj.d.compare_total(Decimal('8.320')), Decimal('0'))