summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/queries/tests.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/queries/tests.py b/tests/queries/tests.py
index fa87e7859c..9c1b41a395 100644
--- a/tests/queries/tests.py
+++ b/tests/queries/tests.py
@@ -1663,6 +1663,12 @@ class Queries5Tests(TestCase):
'bar %s'
)
+ def test_queryset_reuse(self):
+ # Using querysets doesn't mutate aliases.
+ authors = Author.objects.filter(Q(name='a1') | Q(name='nonexistent'))
+ self.assertEqual(Ranking.objects.filter(author__in=authors).get(), self.rank3)
+ self.assertEqual(authors.count(), 1)
+
class SelectRelatedTests(TestCase):
def test_tickets_3045_3288(self):