Skip to content

Commit 9ab66bd

Browse files
test: add test for client session _default_message_handler
1 parent 9a9e0a7 commit 9ab66bd

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

tests/client/test_session.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,3 +1476,14 @@ async def test_send_notification_after_close_is_dropped_silently():
14761476
finally:
14771477
for s in (s2c_send, s2c_recv, c2s_send, c2s_recv):
14781478
s.close()
1479+
1480+
1481+
@pytest.mark.anyio
1482+
async def test_default_message_handler():
1483+
from mcp.client.session import _default_message_handler
1484+
1485+
with pytest.raises(ValueError, match="test error"):
1486+
await _default_message_handler(ValueError("test error"))
1487+
1488+
# Should not raise for non-exception
1489+
await _default_message_handler(types.RootsListChangedNotification())

0 commit comments

Comments
 (0)