

def test_queryset_and(self):
    tournament = self.t1
    organiser = self.o1
    with self.assertNumQueries(1):
        pools = (tournament.pool_set.all() & organiser.pool_set.all())
        first = pools.filter(pk=self.p1.pk)[0]
        self.assertIs(first.tournament, tournament)
        self.assertIs(first.organiser, organiser)

dataset/ETHPy150Open django/django/tests/known_related_objects/tests.py ExistingRelatedInstancesTests.test_queryset_and/original