#32657: Combining an empty Q with a negated Exists un-negates the Exists lookup
-------------------------------+--------------------------------------
Reporter: Jaap Roes | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 3.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Comment (by Jaap Roes):
Note, in Django 3.1 the code in the previous tests will raise a
`TypeError`, the following test case achieves the same and passes in
Django 3.1, main and (from what I understand) Django 3.2.1
{{{
class TestEmptyQExistsCombination(TestCase):
def test_combine(self):
q = Q() & Q(Exists(Book.objects.all()))
self.assertFalse(q.children[0].negated)
def test_combine_negated(self):
q = Q() & Q(~Exists(Book.objects.all()))
self.assertTrue(q.children[0].negated)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/32657#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/063.c5d321d4ecbcca00b96b35cb053dc6a1%40djangoproject.com.