Ticket #29834: t29834.diff

File t29834.diff, 937 bytes (added by Tim Graham, 6 years ago)
  • tests/queries/test_qs_combinators.py

    diff --git a/tests/queries/test_qs_combinators.py b/tests/queries/test_qs_combinators.py
    index f1785dd783..b509d7d8fb 100644
    a b class QuerySetSetOperationTests(TestCase):  
    2323        qs3 = Number.objects.filter(num=5)
    2424        self.assertNumbersEqual(qs1.union(qs2, qs3), [0, 1, 5, 8, 9], ordered=False)
    2525
     26    def test_union_two_evaluations(self):
     27        qs = (
     28            Number.objects.filter(pk__in=[1, 2])
     29            .union(Number.objects.filter(pk__in=[4, 5]))
     30            .order_by('num')
     31        )
     32        self.assertEqual(list(qs.order_by().values_list('pk', flat=True)), [1, 2, 4, 5])
     33        self.assertCountEqual(list(qs.values_list('pk', flat=True)), [1, 2, 4, 5])
     34
    2635    @skipUnlessDBFeature('supports_select_intersection')
    2736    def test_simple_intersection(self):
    2837        qs1 = Number.objects.filter(num__lte=5)
Back to Top