Skip to content

Commit

Permalink
Remove unnecessary branch.
Browse files Browse the repository at this point in the history
  • Loading branch information
aaugustin committed Nov 11, 2024
1 parent 083bcac commit 86bf0c5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
3 changes: 1 addition & 2 deletions src/websockets/asyncio/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ def put(self, item: T) -> None:
async def get(self) -> T:
"""Remove and return an item from the queue, waiting if necessary."""
if not self.queue:
if self.get_waiter is not None:
raise ConcurrencyError("get is already running")
assert self.get_waiter is None, "cannot call get() concurrently"
self.get_waiter = self.loop.create_future()
try:
await self.get_waiter
Expand Down
8 changes: 0 additions & 8 deletions tests/asyncio/test_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ async def test_get_then_put(self):
item = await getter_task
self.assertEqual(item, 42)

async def test_get_concurrently(self):
"""get cannot be called concurrently."""
getter_task = asyncio.create_task(self.queue.get())
await asyncio.sleep(0) # let the task start
with self.assertRaises(ConcurrencyError):
await self.queue.get()
getter_task.cancel()

async def test_reset(self):
"""reset sets the content of the queue."""
self.queue.reset([42])
Expand Down

0 comments on commit 86bf0c5

Please sign in to comment.