mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
[1.8.x] Fixed #24833 -- Fixed Case expressions with exclude().
This commit is contained in:
committed by
Tim Graham
parent
7dcfbb2ef3
commit
469f1e362b
@@ -240,6 +240,18 @@ class CaseExpressionTests(TestCase):
|
||||
transform=itemgetter('integer', 'max', 'test')
|
||||
)
|
||||
|
||||
def test_annotate_exclude(self):
|
||||
self.assertQuerysetEqual(
|
||||
CaseTestModel.objects.annotate(test=Case(
|
||||
When(integer=1, then=Value('one')),
|
||||
When(integer=2, then=Value('two')),
|
||||
default=Value('other'),
|
||||
output_field=models.CharField(),
|
||||
)).exclude(test='other').order_by('pk'),
|
||||
[(1, 'one'), (2, 'two'), (2, 'two')],
|
||||
transform=attrgetter('integer', 'test')
|
||||
)
|
||||
|
||||
def test_combined_expression(self):
|
||||
self.assertQuerysetEqual(
|
||||
CaseTestModel.objects.annotate(
|
||||
|
||||
Reference in New Issue
Block a user