1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Refs #32548 -- Added tests for passing conditional expressions to Q().

This commit is contained in:
Mariusz Felisiak
2021-03-17 11:44:09 +01:00
parent 45814af619
commit 54f60bc85d
2 changed files with 17 additions and 0 deletions

View File

@@ -838,6 +838,12 @@ class BasicExpressionsTests(TestCase):
with self.subTest(conditions):
self.assertCountEqual(Employee.objects.filter(conditions), [self.max])
def test_boolean_expression_in_Q(self):
is_poc = Company.objects.filter(point_of_contact=OuterRef('pk'))
self.gmbh.point_of_contact = self.max
self.gmbh.save()
self.assertCountEqual(Employee.objects.filter(Q(Exists(is_poc))), [self.max])
class IterableLookupInnerExpressionsTests(TestCase):
@classmethod