diff options
| author | Anssi Kääriäinen <akaariai@gmail.com> | 2013-08-19 16:24:45 +0300 |
|---|---|---|
| committer | Anssi Kääriäinen <akaariai@gmail.com> | 2013-08-19 16:24:45 +0300 |
| commit | 58c6d0209d71872f0682d478921db1e00496e16c (patch) | |
| tree | bb727fa0f9358959b2d236bd84c57f293243bd3b | |
| parent | 7bc57a6d71dd4d00bb09cfa67be547591fd759ce (diff) | |
Fixed #12807 -- EmptyResultSet ORed condition
The EmptyResultSet wasn't treated correctly so the end results was
incorrect, too. The bug had been already fixed in master so only tests
added.
| -rw-r--r-- | tests/queries/tests.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/queries/tests.py b/tests/queries/tests.py index a3558a06d4..4d9ffb353f 100644 --- a/tests/queries/tests.py +++ b/tests/queries/tests.py @@ -2952,6 +2952,16 @@ class Ticket20788Tests(TestCase): self.assertQuerysetEqual( sentences_not_in_pub, [book2], lambda x: x) +class Ticket12807Tests(TestCase): + def test_ticket_12807(self): + p1 = Paragraph.objects.create() + p2 = Paragraph.objects.create() + # The ORed condition below should have no effect on the query - the + # ~Q(pk__in=[]) will always be True. + qs = Paragraph.objects.filter((Q(pk=p2.pk) | ~Q(pk__in=[])) & Q(pk=p1.pk)) + self.assertQuerysetEqual(qs, [p1], lambda x: x) + + class RelatedLookupTypeTests(TestCase): def test_wrong_type_lookup(self): oa = ObjectA.objects.create(name="oa") |
