summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnssi Kääriäinen <akaariai@gmail.com>2013-03-21 00:38:23 +0200
committerAnssi Kääriäinen <akaariai@gmail.com>2013-03-21 00:43:26 +0200
commit80e68ee2ffb44d90c66b48e2db18ec4e16c025b4 (patch)
tree2ba037918a6f9f0defc88ee347e696d117b9ef22
parenta9ee0e2970b5dcff63dce9db6dac9681355fc69d (diff)
Added tests for already fixed #20101
The ticket dealt with a case where one query had .exclude() that produced a subquery, the other query had a join to the same model that was subqueried in the first query. This was already fixed in master, so only test added.
-rw-r--r--tests/queries/tests.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/queries/tests.py b/tests/queries/tests.py
index 31d4b4e1a4..806648aa54 100644
--- a/tests/queries/tests.py
+++ b/tests/queries/tests.py
@@ -2808,3 +2808,19 @@ class RelabelCloneTest(TestCase):
# not change results for the parents query.
self.assertEqual(list(children), [my2])
self.assertEqual(list(parents), [my1])
+
+class Ticket20101Tests(TestCase):
+ def test_ticket_20101(self):
+ """
+ Tests QuerySet ORed combining in exclude subquery case.
+ """
+ t = Tag.objects.create(name='foo')
+ a1 = Annotation.objects.create(tag=t, name='a1')
+ a2 = Annotation.objects.create(tag=t, name='a2')
+ a3 = Annotation.objects.create(tag=t, name='a3')
+ n = Note.objects.create(note='foo', misc='bar')
+ qs1 = Note.objects.exclude(annotation__in=[a1, a2])
+ qs2 = Note.objects.filter(annotation__in=[a3])
+ self.assertTrue(n in qs1)
+ self.assertFalse(n in qs2)
+ self.assertTrue(n in (qs1 | qs2))