Ticket #28378: 28378.diff

File 28378.diff, 1.7 KB (added by Mariusz Felisiak, 7 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 e1ff860bf0..0bc1d053f3 100644
    a b class QuerySetSetOperationTests(TestCase):  
    4646    def test_intersection_with_empty_qs(self):
    4747        qs1 = Number.objects.all()
    4848        qs2 = Number.objects.none()
     49        qs3 = Number.objects.filter(pk__in=[])
    4950        self.assertEqual(len(qs1.intersection(qs2)), 0)
    5051        self.assertEqual(len(qs2.intersection(qs1)), 0)
    5152        self.assertEqual(len(qs2.intersection(qs2)), 0)
     53        self.assertEqual(len(qs1.intersection(qs3)), 0)
     54        self.assertEqual(len(qs3.intersection(qs1)), 0)
    5255
    5356    @skipUnlessDBFeature('supports_select_difference')
    5457    def test_difference_with_empty_qs(self):
    5558        qs1 = Number.objects.all()
    5659        qs2 = Number.objects.none()
     60        qs3 = Number.objects.filter(pk__in=[])
    5761        self.assertEqual(len(qs1.difference(qs2)), 10)
     62        self.assertEqual(len(qs1.difference(qs3)), 10)
    5863        self.assertEqual(len(qs2.difference(qs1)), 0)
     64        self.assertEqual(len(qs3.difference(qs1)), 0)
    5965        self.assertEqual(len(qs2.difference(qs2)), 0)
    6066
    6167    def test_union_with_empty_qs(self):
    6268        qs1 = Number.objects.all()
    6369        qs2 = Number.objects.none()
     70        qs3 = Number.objects.filter(pk__in=[])
    6471        self.assertEqual(len(qs1.union(qs2)), 10)
    6572        self.assertEqual(len(qs2.union(qs1)), 10)
     73        self.assertEqual(len(qs1.union(qs3)), 10)
     74        self.assertEqual(len(qs3.union(qs1)), 10)
    6675        self.assertEqual(len(qs2.union(qs1, qs1, qs1)), 10)
    6776        self.assertEqual(len(qs2.union(qs1, qs1, all=True)), 20)
    6877        self.assertEqual(len(qs2.union(qs2)), 0)
Back to Top