

def test_foreign_key_multiple_prefetch(self):
    with self.assertNumQueries(2):
        tournaments = list(Tournament.objects.prefetch_related('pool_set').order_by('pk'))
        pool1 = tournaments[0].pool_set.all()[0]
        self.assertIs(tournaments[0], pool1.tournament)
        pool2 = tournaments[1].pool_set.all()[0]
        self.assertIs(pool2[1], pool2.tournament)

dataset/ETHPy150Open django/django/tests/known_related_objects/tests.py ExistingRelatedInstancesTests.test_foreign_key_multiple_prefetch/VarMisuse@89/122 `tournaments`->`pool2`