0
0
mirror of https://github.com/django/django.git synced 2024-12-01 15:42:04 +01:00

Added test for intersection() when combining with a queryset raising EmptyResultSet.

This commit is contained in:
Mariusz Felisiak 2017-07-10 19:42:58 +02:00
parent 408ed9fea4
commit 9bca0d0b38

View File

@ -46,9 +46,13 @@ class QuerySetSetOperationTests(TestCase):
def test_intersection_with_empty_qs(self): def test_intersection_with_empty_qs(self):
qs1 = Number.objects.all() qs1 = Number.objects.all()
qs2 = Number.objects.none() qs2 = Number.objects.none()
qs3 = Number.objects.filter(pk__in=[])
self.assertEqual(len(qs1.intersection(qs2)), 0) self.assertEqual(len(qs1.intersection(qs2)), 0)
self.assertEqual(len(qs1.intersection(qs3)), 0)
self.assertEqual(len(qs2.intersection(qs1)), 0) self.assertEqual(len(qs2.intersection(qs1)), 0)
self.assertEqual(len(qs3.intersection(qs1)), 0)
self.assertEqual(len(qs2.intersection(qs2)), 0) self.assertEqual(len(qs2.intersection(qs2)), 0)
self.assertEqual(len(qs3.intersection(qs3)), 0)
@skipUnlessDBFeature('supports_select_difference') @skipUnlessDBFeature('supports_select_difference')
def test_difference_with_empty_qs(self): def test_difference_with_empty_qs(self):