Skip to content

Commit

Permalink
Added tests for already fixed #20101
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
akaariai committed Mar 20, 2013
1 parent a9ee0e2 commit 80e68ee
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/queries/tests.py
Expand Up @@ -2808,3 +2808,19 @@ def test_ticket_19964(self):
# 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))

0 comments on commit 80e68ee

Please sign in to comment.