summaryrefslogtreecommitdiff
path: root/tests/expressions
diff options
context:
space:
mode:
authorVIZZARD-X <vigneshanandmay13@gmail.com>2026-01-16 19:01:23 +0530
committerJacob Walls <jacobtylerwalls@gmail.com>2026-01-20 10:42:28 -0500
commite083c62f51f408aaacbf55684daf83c78d0d1bc1 (patch)
tree4d681dee94e4f61e0979498739aad9da924a92da /tests/expressions
parente5cbb8b4be04797deedc775a5143b5035e7dd3b7 (diff)
Fixed #36030 -- Fixed precision loss in division of Decimal literals on SQLite.
Thanks Bob Kline for the review.
Diffstat (limited to 'tests/expressions')
-rw-r--r--tests/expressions/tests.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py
index 981d84e9e8..02126fa896 100644
--- a/tests/expressions/tests.py
+++ b/tests/expressions/tests.py
@@ -137,6 +137,16 @@ class BasicExpressionsTests(TestCase):
)
self.assertEqual(companies["result"], 2395)
+ def test_decimal_division_literal_value(self):
+ """
+ Division with a literal Decimal value preserves precision.
+ """
+ num = Number.objects.create(integer=2)
+ obj = Number.objects.annotate(
+ val=F("integer") / Value(Decimal("3.0"), output_field=DecimalField())
+ ).get(pk=num.pk)
+ self.assertAlmostEqual(obj.val, Decimal("0.6667"), places=4)
+
def test_annotate_values_filter(self):
companies = (
Company.objects.annotate(