Fixed #33257 -- Fixed Case() and ExpressionWrapper() with decimal values on SQLite.

This commit is contained in:
Matthijs Kooijman 2021-11-04 18:24:19 +01:00 committed by Mariusz Felisiak
parent 4f8c7fd9d9
commit 1a5023883b
3 changed files with 18 additions and 2 deletions

View file

@ -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.