diff --git a/tests/postgres_tests/test_json.py b/tests/postgres_tests/test_json.py
index 333ed46bf1..459324e938 100644
a
|
b
|
from decimal import Decimal
|
6 | 6 | from django.core import checks, exceptions, serializers |
7 | 7 | from django.core.serializers.json import DjangoJSONEncoder |
8 | 8 | from django.db import connection |
9 | | from django.db.models import Count, F, Q |
| 9 | from django.db.models import Count, F, OuterRef, Q, Subquery |
10 | 10 | from django.db.models.expressions import RawSQL |
11 | 11 | from django.db.models.functions import Cast |
12 | 12 | from django.forms import CharField, Form, widgets |
… |
… |
class TestQuerying(PostgreSQLTestCase):
|
303 | 303 | [self.objs[7], self.objs[8]] |
304 | 304 | ) |
305 | 305 | |
| 306 | def test_obj_subquery_lookup(self): |
| 307 | qs = JSONModel.objects.annotate( |
| 308 | value=Subquery(JSONModel.objects.filter(pk=OuterRef('pk')).values('field')), |
| 309 | ).filter(value__a='b') |
| 310 | self.assertSequenceEqual( |
| 311 | qs, |
| 312 | [self.objs[7], self.objs[8]] |
| 313 | ) |
| 314 | |
306 | 315 | def test_deep_lookup_objs(self): |
307 | 316 | self.assertSequenceEqual( |
308 | 317 | JSONModel.objects.filter(field__k__l='m'), |