summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio/test_taskgroups.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_asyncio/test_taskgroups.py')
-rw-r--r--Lib/test/test_asyncio/test_taskgroups.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/Lib/test/test_asyncio/test_taskgroups.py b/Lib/test/test_asyncio/test_taskgroups.py
index ea6ee2e..aab1fd1 100644
--- a/Lib/test/test_asyncio/test_taskgroups.py
+++ b/Lib/test/test_asyncio/test_taskgroups.py
@@ -368,10 +368,10 @@ class TestTaskGroup(unittest.IsolatedAsyncioTestCase):
raise ValueError(t)
async def runner():
- async with taskgroups.TaskGroup(name='g1') as g1:
+ async with taskgroups.TaskGroup() as g1:
g1.create_task(crash_after(0.1))
- async with taskgroups.TaskGroup(name='g2') as g2:
+ async with taskgroups.TaskGroup() as g2:
g2.create_task(crash_after(0.2))
r = asyncio.create_task(runner())
@@ -387,10 +387,10 @@ class TestTaskGroup(unittest.IsolatedAsyncioTestCase):
raise ValueError(t)
async def runner():
- async with taskgroups.TaskGroup(name='g1') as g1:
+ async with taskgroups.TaskGroup() as g1:
g1.create_task(crash_after(10))
- async with taskgroups.TaskGroup(name='g2') as g2:
+ async with taskgroups.TaskGroup() as g2:
g2.create_task(crash_after(0.1))
r = asyncio.create_task(runner())
@@ -407,7 +407,7 @@ class TestTaskGroup(unittest.IsolatedAsyncioTestCase):
1 / 0
async def runner():
- async with taskgroups.TaskGroup(name='g1') as g1:
+ async with taskgroups.TaskGroup() as g1:
g1.create_task(crash_soon())
try:
await asyncio.sleep(10)
@@ -430,7 +430,7 @@ class TestTaskGroup(unittest.IsolatedAsyncioTestCase):
1 / 0
async def nested_runner():
- async with taskgroups.TaskGroup(name='g1') as g1:
+ async with taskgroups.TaskGroup() as g1:
g1.create_task(crash_soon())
try:
await asyncio.sleep(10)
@@ -692,3 +692,10 @@ class TestTaskGroup(unittest.IsolatedAsyncioTestCase):
self.assertEqual(get_error_types(cm.exception), {ZeroDivisionError})
self.assertGreaterEqual(nhydras, 10)
+
+ async def test_taskgroup_task_name(self):
+ async def coro():
+ await asyncio.sleep(0)
+ async with taskgroups.TaskGroup() as g:
+ t = g.create_task(coro(), name="yolo")
+ self.assertEqual(t.get_name(), "yolo")