Refs #32068 -- Added tests for get() following union(), intersection(), and difference().
This commit is contained in:
parent
c32d8f33d8
commit
7cfa40d872
|
@ -227,6 +227,22 @@ class QuerySetSetOperationTests(TestCase):
|
||||||
qs2 = Number.objects.filter(num__lte=5)
|
qs2 = Number.objects.filter(num__lte=5)
|
||||||
self.assertEqual(qs1.intersection(qs2).count(), 1)
|
self.assertEqual(qs1.intersection(qs2).count(), 1)
|
||||||
|
|
||||||
|
def test_get_union(self):
|
||||||
|
qs = Number.objects.filter(num=2)
|
||||||
|
self.assertEqual(qs.union(qs).get().num, 2)
|
||||||
|
|
||||||
|
@skipUnlessDBFeature('supports_select_difference')
|
||||||
|
def test_get_difference(self):
|
||||||
|
qs1 = Number.objects.all()
|
||||||
|
qs2 = Number.objects.exclude(num=2)
|
||||||
|
self.assertEqual(qs1.difference(qs2).get().num, 2)
|
||||||
|
|
||||||
|
@skipUnlessDBFeature('supports_select_intersection')
|
||||||
|
def test_get_intersection(self):
|
||||||
|
qs1 = Number.objects.all()
|
||||||
|
qs2 = Number.objects.filter(num=2)
|
||||||
|
self.assertEqual(qs1.intersection(qs2).get().num, 2)
|
||||||
|
|
||||||
@skipUnlessDBFeature('supports_slicing_ordering_in_compound')
|
@skipUnlessDBFeature('supports_slicing_ordering_in_compound')
|
||||||
def test_ordering_subqueries(self):
|
def test_ordering_subqueries(self):
|
||||||
qs1 = Number.objects.order_by('num')[:2]
|
qs1 = Number.objects.order_by('num')[:2]
|
||||||
|
|
Loading…
Reference in New Issue