Skip to content

Commit

Permalink
update test case
Browse files Browse the repository at this point in the history
  • Loading branch information
lidong committed May 10, 2024
1 parent 32e580f commit cadb5aa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)]
Expand All @@ -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)]
Expand Down
12 changes: 6 additions & 6 deletions morebuiltins/functools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)]
Expand All @@ -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)]
Expand Down Expand Up @@ -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:
Expand All @@ -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)]
Expand All @@ -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)]
Expand Down

0 comments on commit cadb5aa

Please sign in to comment.