Ticket #24833: 24833-test.diff

File 24833-test.diff, 933 bytes (added by Tim Graham, 9 years ago)
  • tests/expressions_case/tests.py

    diff --git a/tests/expressions_case/tests.py b/tests/expressions_case/tests.py
    index 58dc7ca..8c081dd 100644
    a b class CaseExpressionTests(TestCase):  
    240240            transform=itemgetter('integer', 'max', 'test')
    241241        )
    242242
     243    def test_annotate_exclude(self):
     244        self.assertQuerysetEqual(
     245            CaseTestModel.objects.annotate(test=Case(
     246                When(integer=1, then=Value('one')),
     247                When(integer=2, then=Value('two')),
     248                default=Value('other'),
     249                output_field=models.CharField(),
     250            )).exclude(test='other').order_by('pk'),
     251            [(1, 'one'), (2, 'two'), (2, 'two')],
     252            transform=attrgetter('integer', 'test')
     253        )
     254
    243255    def test_combined_expression(self):
    244256        self.assertQuerysetEqual(
    245257            CaseTestModel.objects.annotate(
Back to Top