mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #28211 -- Prevented ORing an empty Q() from reducing query join efficiency.
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user