summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/queries/tests.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/queries/tests.py b/tests/queries/tests.py
index 98d68d4092..7c306c9f15 100644
--- a/tests/queries/tests.py
+++ b/tests/queries/tests.py
@@ -2463,6 +2463,18 @@ class ToFieldTests(TestCase):
{lunch, dinner},
)
+ def test_in_subquery(self):
+ apple = Food.objects.create(name="apple")
+ lunch = Eaten.objects.create(food=apple, meal="lunch")
+ self.assertEqual(
+ set(Eaten.objects.filter(food__in=Food.objects.filter(name='apple'))),
+ {lunch}
+ )
+ self.assertEqual(
+ set(Eaten.objects.filter(food__in=Food.objects.filter(name='apple').values('eaten__meal'))),
+ set()
+ )
+
def test_reverse_in(self):
apple = Food.objects.create(name="apple")
pear = Food.objects.create(name="pear")