summaryrefslogtreecommitdiff
path: root/tests/expressions
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2021-03-17 11:44:09 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-03-17 21:53:36 +0100
commit54f60bc85df7fe38ba6ef6779996d8544d340d3e (patch)
tree8e5d4bb7226720842d7fe2bd9277ed72312b7309 /tests/expressions
parent45814af6197cfd8f4dc72ee43b90ecde305a1d5a (diff)
Refs #32548 -- Added tests for passing conditional expressions to Q().
Diffstat (limited to 'tests/expressions')
-rw-r--r--tests/expressions/tests.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py
index 9ecc033b6b..82d8a9f351 100644
--- a/tests/expressions/tests.py
+++ b/tests/expressions/tests.py
@@ -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