From 35104c0a34fe7cbd7e035eda7154889c37310189 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 17 Dec 2024 17:56:48 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/anyio/_backends/_asyncio.py | 7 +++---- tests/test_taskgroups.py | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/anyio/_backends/_asyncio.py b/src/anyio/_backends/_asyncio.py index 06419ec4..1d2be8d2 100644 --- a/src/anyio/_backends/_asyncio.py +++ b/src/anyio/_backends/_asyncio.py @@ -56,7 +56,8 @@ Any, Optional, TypeVar, - cast, Union, + Union, + cast, ) from weakref import WeakKeyDictionary @@ -692,9 +693,7 @@ def _extract_coro_from_task(self, key: Any) -> Coroutine[Any, Any, Any] | None: if asyncio.iscoroutine(coro): return coro except Exception as exc: - raise RuntimeError( - "The task's coroutine was not available" - ) from exc + raise RuntimeError("The task's coroutine was not available") from exc return None def __getitem__(self, key: TaskLike) -> TaskState: diff --git a/tests/test_taskgroups.py b/tests/test_taskgroups.py index 1f285db9..590ccec7 100644 --- a/tests/test_taskgroups.py +++ b/tests/test_taskgroups.py @@ -1796,7 +1796,7 @@ async def test_nest_asyncio_applied(): nest_asyncio.apply() async def coro_task(): - await sleep(0) + await asyncio.lowlevel.checkpoint() async with create_task_group() as tg: tg.start_soon(coro_task) @@ -1849,7 +1849,7 @@ def get_coro(self): original_task = asyncio.Task async def sample_coro(): - await sleep(0) + await asyncio.lowlevel.checkpoint() async def task_factory(loop, coro): return CustomTask(coro)