mirror of
https://github.com/django/django.git
synced 2025-10-27 07:36:08 +00:00
[3.2.x] Fixed #32793 -- Fixed loss of precision for temporal operations with DecimalFields on MySQL.
Regression in1e38f1191d. Thanks Mohsen Tamiz for the report. Backport ofe703b152c6from main
This commit is contained in:
@@ -1176,6 +1176,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