From cadb5aaf085af04835d0caa700f3e3064bd2d0ac Mon Sep 17 00:00:00 2001 From: lidong Date: Sat, 11 May 2024 00:20:29 +0800 Subject: [PATCH] update test case --- doc.md | 6 +++--- morebuiltins/functools.py | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/doc.md b/doc.md index 888dd46..bb84ac7 100644 --- a/doc.md +++ b/doc.md @@ -514,7 +514,7 @@ def _test1(): with NamedLock("_test1", Lock, timeout=0.05) as lock: - time.sleep(0.1) + time.sleep(0.2) return bool(lock) with ThreadPoolExecutor(10) as pool: @@ -541,7 +541,7 @@ async def main(): async def _test1(): async with NamedLock("_test1", asyncio.Lock, timeout=0.05) as lock: - await asyncio.sleep(0.1) + await asyncio.sleep(0.2) return bool(lock) tasks = [asyncio.create_task(_test1()) for _ in range(3)] @@ -555,7 +555,7 @@ async with NamedLock( "_test2", lambda: asyncio.Semaphore(2), timeout=0.05 ) as lock: - await asyncio.sleep(0.1) + await asyncio.sleep(0.2) return bool(lock) tasks = [asyncio.create_task(_test2()) for _ in range(3)] diff --git a/morebuiltins/functools.py b/morebuiltins/functools.py index 6d2c8e7..f8b32bb 100644 --- a/morebuiltins/functools.py +++ b/morebuiltins/functools.py @@ -201,7 +201,7 @@ def test_sync(): def _test1(): with NamedLock("_test1", Lock, timeout=0.05) as lock: - time.sleep(0.1) + time.sleep(0.2) return bool(lock) with ThreadPoolExecutor(10) as pool: @@ -228,7 +228,7 @@ def test_async(): async def main(): async def _test1(): async with NamedLock("_test1", asyncio.Lock, timeout=0.05) as lock: - await asyncio.sleep(0.1) + await asyncio.sleep(0.2) return bool(lock) tasks = [asyncio.create_task(_test1()) for _ in range(3)] @@ -242,7 +242,7 @@ async def _test2(): async with NamedLock( "_test2", lambda: asyncio.Semaphore(2), timeout=0.05 ) as lock: - await asyncio.sleep(0.1) + await asyncio.sleep(0.2) return bool(lock) tasks = [asyncio.create_task(_test2()) for _ in range(3)] @@ -383,7 +383,7 @@ def test_sync(): def _test1(): with NamedLock("_test1", Lock, timeout=0.05) as lock: - time.sleep(0.1) + time.sleep(0.2) return bool(lock) with ThreadPoolExecutor(10) as pool: @@ -410,7 +410,7 @@ def test_async(): async def main(): async def _test1(): async with NamedLock("_test1", asyncio.Lock, timeout=0.05) as lock: - await asyncio.sleep(0.1) + await asyncio.sleep(0.2) return bool(lock) tasks = [asyncio.create_task(_test1()) for _ in range(3)] @@ -424,7 +424,7 @@ async def _test2(): async with NamedLock( "_test2", lambda: asyncio.Semaphore(2), timeout=0.05 ) as lock: - await asyncio.sleep(0.1) + await asyncio.sleep(0.2) return bool(lock) tasks = [asyncio.create_task(_test2()) for _ in range(3)]