MCPcopy Index your code
hub / github.com/python/cpython / test_context_manager

Method test_context_manager

Lib/test/test_asyncio/test_locks.py:1336–1349  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1334 self.assertIsInstance(asyncio.Barrier(self.N), asyncio.Barrier)
1335
1336 async def test_context_manager(self):
1337 self.N = 3
1338 barrier = asyncio.Barrier(self.N)
1339 results = []
1340
1341 async def coro():
1342 async with barrier as i:
1343 results.append(i)
1344
1345 await self.gather_tasks(self.N, coro)
1346
1347 self.assertListEqual(sorted(results), list(range(self.N)))
1348 self.assertEqual(barrier.n_waiting, 0)
1349 self.assertFalse(barrier.broken)
1350
1351 async def test_filling_one_task(self):
1352 barrier = asyncio.Barrier(1)

Callers

nothing calls this directly

Calls 6

gather_tasksMethod · 0.95
listClass · 0.85
BarrierMethod · 0.80
assertListEqualMethod · 0.80
assertFalseMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected