summaryrefslogtreecommitdiff
path: root/tests/expressions/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/expressions/tests.py')
-rw-r--r--tests/expressions/tests.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py
index 08ea0a51d3..770a57d66e 100644
--- a/tests/expressions/tests.py
+++ b/tests/expressions/tests.py
@@ -816,6 +816,18 @@ class BasicExpressionsTests(TestCase):
[self.example_inc.ceo, self.max],
)
+ def test_boolean_expression_combined_with_empty_Q(self):
+ is_poc = Company.objects.filter(point_of_contact=OuterRef('pk'))
+ self.gmbh.point_of_contact = self.max
+ self.gmbh.save()
+ tests = [
+ Exists(is_poc) & Q(),
+ Exists(is_poc) | Q(),
+ ]
+ for conditions in tests:
+ with self.subTest(conditions):
+ self.assertCountEqual(Employee.objects.filter(conditions), [self.max])
+
class IterableLookupInnerExpressionsTests(TestCase):
@classmethod