Skip to content

Commit

Permalink
feat(test): test CounterLock repr
Browse files Browse the repository at this point in the history
  • Loading branch information
BobTheBuidler committed Dec 18, 2024
1 parent a9ccfac commit 6f2caee
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/primitives/test_counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@
@pytest.mark.asyncio_cooperative
async def test_counter_lock():
counter = CounterLock(name="test")
assert await counter.wait_for(0)
assert counter._name == "test"
assert repr(counter) == "<CounterLock name=test value=0 waiters={}>"
coro = counter.wait_for(1)
task = asyncio.create_task(coro)
await asyncio.sleep(0)
assert repr(counter) == "<CounterLock name=test value=0 waiters={1: 1}>"
counter.set(1)
await asyncio.sleep(0)
assert task.done() and task.result() is True
assert repr(counter) == "<CounterLock name=test value=1 waiters={}>"


@pytest.mark.asyncio_cooperative
Expand Down

0 comments on commit 6f2caee

Please sign in to comment.