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

Method test_filling_task_by_task

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

Source from the content-addressed store, hash-verified

1378 self.assertFalse(barrier.broken)
1379
1380 async def test_filling_task_by_task(self):
1381 self.N = 3
1382 barrier = asyncio.Barrier(self.N)
1383
1384 t1 = asyncio.create_task(barrier.wait())
1385 await asyncio.sleep(0)
1386 self.assertEqual(barrier.n_waiting, 1)
1387 self.assertIn("filling", repr(barrier))
1388
1389 t2 = asyncio.create_task(barrier.wait())
1390 await asyncio.sleep(0)
1391 self.assertEqual(barrier.n_waiting, 2)
1392 self.assertIn("filling", repr(barrier))
1393
1394 t3 = asyncio.create_task(barrier.wait())
1395 await asyncio.sleep(0)
1396
1397 await asyncio.wait([t1, t2, t3])
1398
1399 self.assertEqual(barrier.n_waiting, 0)
1400 self.assertFalse(barrier.broken)
1401
1402 async def test_filling_tasks_wait_twice(self):
1403 barrier = asyncio.Barrier(self.N)

Callers

nothing calls this directly

Calls 8

waitMethod · 0.95
BarrierMethod · 0.80
assertInMethod · 0.80
assertFalseMethod · 0.80
create_taskMethod · 0.45
sleepMethod · 0.45
assertEqualMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected