diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-02-18 21:32:38 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-02-19 06:21:04 +0100 |
| commit | 732cf4c5b40def413a143b9449a9a9991fe0244f (patch) | |
| tree | 3e61ecd97c90569bfd09b35d0225f28bb96e925f /tests | |
| parent | 0e2979e95d0f68f28c92c84c14655e7510d4e789 (diff) | |
[3.2.x] Refs #32455 -- Added tests for left combining an empty Q() with boolean expressions.
Backport of efce21497cc21140c5fe2b133064cd815c97b3f5 from master
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/expressions/tests.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py index 463150f8a1..bb8aeda8b0 100644 --- a/tests/expressions/tests.py +++ b/tests/expressions/tests.py @@ -804,6 +804,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 |
