mirror of
https://github.com/django/django.git
synced 2025-08-30 23:37:50 +00:00
Fixed #33257 -- Fixed Case() and ExpressionWrapper() with decimal values on SQLite.
This commit is contained in:
parent
4f8c7fd9d9
commit
1a5023883b
3 changed files with 18 additions and 2 deletions
|
@ -256,6 +256,15 @@ class CaseExpressionTests(TestCase):
|
|||
transform=attrgetter('integer', 'test')
|
||||
)
|
||||
|
||||
def test_annotate_filter_decimal(self):
|
||||
obj = CaseTestModel.objects.create(integer=0, decimal=Decimal('1'))
|
||||
qs = CaseTestModel.objects.annotate(
|
||||
x=Case(When(integer=0, then=F('decimal'))),
|
||||
y=Case(When(integer=0, then=Value(Decimal('1')))),
|
||||
)
|
||||
self.assertSequenceEqual(qs.filter(Q(x=1) & Q(x=Decimal('1'))), [obj])
|
||||
self.assertSequenceEqual(qs.filter(Q(y=1) & Q(y=Decimal('1'))), [obj])
|
||||
|
||||
def test_annotate_values_not_in_order_by(self):
|
||||
self.assertEqual(
|
||||
list(CaseTestModel.objects.annotate(test=Case(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue