summaryrefslogtreecommitdiff
path: root/tests/expressions
diff options
context:
space:
mode:
authorMatthijs Kooijman <matthijs@stdin.nl>2021-11-04 18:24:19 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-11-08 18:02:56 +0100
commit1a5023883bf4c8cccb34a830edcc3c82aa862455 (patch)
treeab3d3cdf1dd163ad365af1d611b142ab7948b6d9 /tests/expressions
parent4f8c7fd9d91b35e2c2922de4bb50c8c8066cbbc6 (diff)
downloaddjango-1a5023883bf4c8cccb34a830edcc3c82aa862455.tar.gz
Fixed #33257 -- Fixed Case() and ExpressionWrapper() with decimal values on SQLite.
Diffstat (limited to 'tests/expressions')
-rw-r--r--tests/expressions/tests.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py
index 4bb65c9031..dab5474ef4 100644
--- a/tests/expressions/tests.py
+++ b/tests/expressions/tests.py
@@ -1178,6 +1178,13 @@ class ExpressionsNumericTests(TestCase):
ordered=False
)
+ def test_filter_decimal_expression(self):
+ obj = Number.objects.create(integer=0, float=1, decimal_value=Decimal('1'))
+ qs = Number.objects.annotate(
+ x=ExpressionWrapper(Value(1), output_field=DecimalField()),
+ ).filter(Q(x=1, integer=0) & Q(x=Decimal('1')))
+ self.assertSequenceEqual(qs, [obj])
+
def test_complex_expressions(self):
"""
Complex expressions of different connection types are possible.