summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndriy Sokolovskiy <me@asokolovskiy.com>2015-06-05 11:04:45 +0100
committerTim Graham <timograham@gmail.com>2015-06-05 11:03:41 -0400
commit469f1e362bb9670b174b37da9edd4631aff7badb (patch)
treeae6d169a9f579b504dc4d17bdf6b2ad45cb3ccd0 /tests
parent7dcfbb2ef38bb806531d6e73dd179d5266f48d7a (diff)
[1.8.x] Fixed #24833 -- Fixed Case expressions with exclude().
Diffstat (limited to 'tests')
-rw-r--r--tests/expressions_case/tests.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/expressions_case/tests.py b/tests/expressions_case/tests.py
index 58dc7ca80d..8c081dde9a 100644
--- a/tests/expressions_case/tests.py
+++ b/tests/expressions_case/tests.py
@@ -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(