summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTom <tom@tomforb.es>2017-05-18 19:03:30 +0100
committerTim Graham <timograham@gmail.com>2017-05-25 09:06:25 -0400
commitbb0b6e526340e638522e093765e534df4e4393d2 (patch)
tree235f8e2dbb41209b7fd82cc62554549266020695 /tests
parent1c3a6cec2ae35c4326971e62acbc1891506e7e72 (diff)
Fixed #28211 -- Prevented ORing an empty Q() from reducing query join efficiency.
Diffstat (limited to 'tests')
-rw-r--r--tests/queries/test_q.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/queries/test_q.py b/tests/queries/test_q.py
index 7be2361f04..a90d6794db 100644
--- a/tests/queries/test_q.py
+++ b/tests/queries/test_q.py
@@ -11,6 +11,14 @@ class QTests(SimpleTestCase):
def test_combine_and_both_empty(self):
self.assertEqual(Q() & Q(), Q())
+ def test_combine_or_empty(self):
+ q = Q(x=1)
+ self.assertEqual(q | Q(), q)
+ self.assertEqual(Q() | q, q)
+
+ def test_combine_or_both_empty(self):
+ self.assertEqual(Q() | Q(), Q())
+
def test_deconstruct(self):
q = Q(price__gt=F('discounted_price'))
path, args, kwargs = q.deconstruct()