diff options
| author | Hasan Ramezani <hasan.r67@gmail.com> | 2021-02-18 14:01:48 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-02-18 22:20:36 +0100 |
| commit | f2bef2b7bc6c817af0f5fa77e1052a1f5ce12f71 (patch) | |
| tree | 581b8ed4f6aaeb9533153855412711c645598a6d /tests/expressions | |
| parent | efce21497cc21140c5fe2b133064cd815c97b3f5 (diff) | |
Fixed #32455 -- Allowed right combining Q() with boolean expressions.
Diffstat (limited to 'tests/expressions')
| -rw-r--r-- | tests/expressions/tests.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py index 770a57d66e..9ecc033b6b 100644 --- a/tests/expressions/tests.py +++ b/tests/expressions/tests.py @@ -815,6 +815,14 @@ class BasicExpressionsTests(TestCase): Employee.objects.filter(Exists(is_poc) | Q(salary__lt=15)), [self.example_inc.ceo, self.max], ) + self.assertCountEqual( + Employee.objects.filter(Q(salary__gte=30) & Exists(is_ceo)), + [self.max], + ) + self.assertCountEqual( + Employee.objects.filter(Q(salary__lt=15) | Exists(is_poc)), + [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')) @@ -822,7 +830,9 @@ class BasicExpressionsTests(TestCase): self.gmbh.save() tests = [ Exists(is_poc) & Q(), + Q() & Exists(is_poc), Exists(is_poc) | Q(), + Q() | Exists(is_poc), ] for conditions in tests: with self.subTest(conditions): |
