From a0a2a8cf434b52a25b7737eb7779b080d31133a5 Mon Sep 17 00:00:00 2001 From: Charles Le Maux Date: Fri, 6 Sep 2024 17:37:41 +0200 Subject: [PATCH] [+] Optimized async test --- unit_test.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/unit_test.py b/unit_test.py index c4bd22d..35edac8 100644 --- a/unit_test.py +++ b/unit_test.py @@ -10,21 +10,21 @@ def ban_user(user_id: str): print("Error banning user " + user_id, "|", str(e), type(e).__name__) -async def one(nb: int) -> int: +async def one() -> int: return 1 -async def two(nb: int) -> int: +async def two() -> int: await asyncio.sleep(2) return 2 -async def three(nb: int) -> int: +async def three() -> int: await asyncio.sleep(3) return 3 coroutines = [ - two(1),one(0),three(2), - - + one(), + two(), + three() ] async def main() -> None: results = await asyncio.gather(*coroutines)