Ticket #25316: 25312-test.diff

File 25312-test.diff, 739 bytes (added by Tim Graham, 6 years ago)
  • tests/expressions_case/tests.py

    diff --git a/tests/expressions_case/tests.py b/tests/expressions_case/tests.py
    index 2b269b5..1d3a695 100644
    a b class CaseExpressionTests(TestCase): 
    252252            transform=attrgetter('integer', 'test')
    253253        )
    254254
     255    def test_25316(self):
     256        list(CaseTestModel.objects.annotate(test=Case(
     257            When(integer=1, then=Value('one')),
     258            When(integer=2, then=Value('two')),
     259            default=Value('other'),
     260            output_field=models.CharField(),
     261        )).order_by('test').values('id'))
     262
    255263    def test_combined_expression(self):
    256264        self.assertQuerysetEqual(
    257265            CaseTestModel.objects.annotate(
Back to Top