1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Replaced set([foo, ...]) by {foo, ...} literals. Refs PR 3282.

Thanks Collin Anderson for the review.
This commit is contained in:
Thomas Chaumeny
2014-09-26 14:31:50 +02:00
committed by Loic Bistuer
parent caf5cd7ba7
commit b2aad7b836
37 changed files with 123 additions and 122 deletions

View File

@@ -34,7 +34,7 @@ class ExistingRelatedInstancesTests(TestCase):
with self.assertNumQueries(1):
pools = tournament_1.pool_set.all() | tournament_2.pool_set.all()
related_objects = set(pool.tournament for pool in pools)
self.assertEqual(related_objects, set((tournament_1, tournament_2)))
self.assertEqual(related_objects, {tournament_1, tournament_2})
def test_queryset_or_different_cached_items(self):
tournament = Tournament.objects.get(pk=1)
@@ -52,12 +52,12 @@ class ExistingRelatedInstancesTests(TestCase):
with self.assertNumQueries(2):
pools = tournament_1.pool_set.all() | Pool.objects.filter(pk=3)
related_objects = set(pool.tournament for pool in pools)
self.assertEqual(related_objects, set((tournament_1, tournament_2)))
self.assertEqual(related_objects, {tournament_1, tournament_2})
# and the other direction
with self.assertNumQueries(2):
pools = Pool.objects.filter(pk=3) | tournament_1.pool_set.all()
related_objects = set(pool.tournament for pool in pools)
self.assertEqual(related_objects, set((tournament_1, tournament_2)))
self.assertEqual(related_objects, {tournament_1, tournament_2})
def test_queryset_and(self):
tournament = Tournament.objects.get(pk=1)