mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #32793 -- Fixed loss of precision for temporal operations with DecimalFields on MySQL.
Regression in 1e38f1191d.
Thanks Mohsen Tamiz for the report.
This commit is contained in:
@@ -1194,6 +1194,13 @@ class ExpressionsNumericTests(TestCase):
|
||||
self.assertEqual(Number.objects.get(pk=n.pk).integer, 10)
|
||||
self.assertEqual(Number.objects.get(pk=n.pk).float, Approximate(256.900, places=3))
|
||||
|
||||
def test_decimal_expression(self):
|
||||
n = Number.objects.create(integer=1, decimal_value=Decimal('0.5'))
|
||||
n.decimal_value = F('decimal_value') - Decimal('0.4')
|
||||
n.save()
|
||||
n.refresh_from_db()
|
||||
self.assertEqual(n.decimal_value, Decimal('0.1'))
|
||||
|
||||
|
||||
class ExpressionOperatorTests(TestCase):
|
||||
@classmethod
|
||||
|
||||
Reference in New Issue
Block a user