diff --git a/tests/queries/test_qs_combinators.py b/tests/queries/test_qs_combinators.py
index e2ec18c034..32300fd985 100644
a
|
b
|
|
1 | | from django.db.models import F, IntegerField, Value |
| 1 | from django.db.models import Exists, F, IntegerField, OuterRef, Value |
2 | 2 | from django.db.utils import DatabaseError, NotSupportedError |
3 | 3 | from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature |
4 | 4 | |
… |
… |
class QuerySetSetOperationTests(TestCase):
|
130 | 130 | ).values_list('num', 'count') |
131 | 131 | self.assertCountEqual(qs1.union(qs2), [(1, 0), (2, 1)]) |
132 | 132 | |
| 133 | def test_union_with_two_annotated_queries(self): |
| 134 | ReservedName.objects.create(name='rn1', order=1) |
| 135 | qs1 = Number.objects.annotate( |
| 136 | has_reserved_name=Exists(ReservedName.objects.filter(order=OuterRef('num'))) |
| 137 | ).filter(has_reserved_name=True) |
| 138 | qs2 = Number.objects.filter(num=9) |
| 139 | self.assertCountEqual(qs1.union(qs2).values_list('num', flat=True), [1, 9]) |
| 140 | |
133 | 141 | def test_count_union(self): |
134 | 142 | qs1 = Number.objects.filter(num__lte=1).values('num') |
135 | 143 | qs2 = Number.objects.filter(num__gte=2, num__lte=3).values('num') |