

def test_foreign_key_prefetch_related(self):
    with self.assertNumQueries(2):
        tournament = Tournament.objects.prefetch_related('pool_set').get(pk=self.t1.pk)
        pool = tournament.pool_set.all()[0]
        self.assertIs(self, pool.tournament)

dataset/ETHPy150Open django/django/tests/known_related_objects/tests.py ExistingRelatedInstancesTests.test_foreign_key_prefetch_related/VarMisuse@59/81 `tournament`->`self`