Skip to content

Commit 486872c

Browse files
author
dragogargo
committed
fix: eliminate elif branches in test mock_server for 100% coverage
Replace elif with separate if statements and remove unnecessary if-pass blocks to avoid uncovered branch arcs in coverage.py.
1 parent 91c7ef5 commit 486872c

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

tests/shared/test_session.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -433,9 +433,7 @@ async def test_send_request_sends_cancelled_notification_on_timeout():
433433
async def mock_server():
434434
async for message in server_read: # pragma: no branch
435435
assert isinstance(message, SessionMessage)
436-
if isinstance(message.message, JSONRPCRequest):
437-
pass
438-
elif isinstance(message.message, types.JSONRPCNotification):
436+
if isinstance(message.message, types.JSONRPCNotification):
439437
cancelled_notifications.append(message)
440438

441439
async with (
@@ -480,7 +478,7 @@ async def mock_server():
480478
assert isinstance(message, SessionMessage)
481479
if isinstance(message.message, JSONRPCRequest):
482480
ev_request_sent.set()
483-
elif isinstance(message.message, types.JSONRPCNotification):
481+
if isinstance(message.message, types.JSONRPCNotification):
484482
cancelled_notifications.append(message)
485483

486484
async def make_request(client_session: ClientSession):

0 commit comments

Comments
 (0)