summaryrefslogtreecommitdiff
path: root/tests/queries
diff options
context:
space:
mode:
authorAnssi Kääriäinen <akaariai@gmail.com>2013-07-23 13:40:50 +0300
committerAnssi Kääriäinen <akaariai@gmail.com>2013-07-23 13:40:50 +0300
commitc00a8525c6a003b57afbe6cdef243ffad397dcbe (patch)
tree19a437288f446de33d17ec5b8c28a22ede79b145 /tests/queries
parent4bd55547214ae149acadffe60536c379d51e318f (diff)
Fixed #20788 -- exclude() generated subquery failure
"Fixed" by adding a test case, the original problem was already fixed by earlier ORM changes. Thanks to david@judicata.com for the report and test case.
Diffstat (limited to 'tests/queries')
-rw-r--r--tests/queries/tests.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/queries/tests.py b/tests/queries/tests.py
index 87d54b637e..4bacd9a1cc 100644
--- a/tests/queries/tests.py
+++ b/tests/queries/tests.py
@@ -2910,7 +2910,7 @@ class DoubleInSubqueryTests(TestCase):
self.assertQuerysetEqual(
qs, [lfb1], lambda x: x)
-class Ticket18785Tests(unittest.TestCase):
+class Ticket18785Tests(TestCase):
def test_ticket_18785(self):
# Test join trimming from ticket18785
qs = Item.objects.exclude(
@@ -2920,3 +2920,22 @@ class Ticket18785Tests(unittest.TestCase):
).order_by()
self.assertEqual(1, str(qs.query).count('INNER JOIN'))
self.assertEqual(0, str(qs.query).count('OUTER JOIN'))
+
+
+class Ticket20788Tests(TestCase):
+ def test_ticket_20788(self):
+ Paragraph.objects.create()
+ paragraph = Paragraph.objects.create()
+ page = paragraph.page.create()
+ chapter = Chapter.objects.create(paragraph=paragraph)
+ Book.objects.create(chapter=chapter)
+
+ paragraph2 = Paragraph.objects.create()
+ Page.objects.create()
+ chapter2 = Chapter.objects.create(paragraph=paragraph2)
+ book2 = Book.objects.create(chapter=chapter2)
+
+ sentences_not_in_pub = Book.objects.exclude(
+ chapter__paragraph__page=page)
+ self.assertQuerysetEqual(
+ sentences_not_in_pub, [book2], lambda x: x)