diff options
| author | Tim Graham <timograham@gmail.com> | 2017-05-25 08:36:09 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-05-25 09:02:13 -0400 |
| commit | 1c3a6cec2ae35c4326971e62acbc1891506e7e72 (patch) | |
| tree | eefc72460b295c98ab814f80540b7150c2b788f9 | |
| parent | 67e1afb4a8478af6725e45a9fdcd2a511b2eb005 (diff) | |
Refs #28211 -- Added a test for ANDing empty Q()'s.
This test passes to due some logic in Node.add().
| -rw-r--r-- | tests/queries/test_q.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/queries/test_q.py b/tests/queries/test_q.py index 9b9fba6ba1..7be2361f04 100644 --- a/tests/queries/test_q.py +++ b/tests/queries/test_q.py @@ -3,6 +3,14 @@ from django.test import SimpleTestCase class QTests(SimpleTestCase): + def test_combine_and_empty(self): + q = Q(x=1) + self.assertEqual(q & Q(), q) + self.assertEqual(Q() & q, q) + + def test_combine_and_both_empty(self): + self.assertEqual(Q() & Q(), Q()) + def test_deconstruct(self): q = Q(price__gt=F('discounted_price')) path, args, kwargs = q.deconstruct() |
