@@ -80,7 +80,9 @@ def __init__(self):
8080 self ._events : list [tuple [StreamId , EventId , types .JSONRPCMessage | None ]] = []
8181 self ._event_id_counter = 0
8282
83- async def store_event (self , stream_id : StreamId , message : types .JSONRPCMessage | None ) -> EventId :
83+ async def store_event ( # pragma: no cover
84+ self , stream_id : StreamId , message : types .JSONRPCMessage | None
85+ ) -> EventId :
8486 """Store an event and return its ID."""
8587 self ._event_id_counter += 1
8688 event_id = str (self ._event_id_counter )
@@ -1817,10 +1819,10 @@ async def test_streamablehttp_client_auto_reconnects(
18171819 async def message_handler (
18181820 message : RequestResponder [types .ServerRequest , types .ClientResult ] | types .ServerNotification | Exception ,
18191821 ) -> None :
1820- if isinstance (message , Exception ):
1821- return
1822- if isinstance (message , types .ServerNotification ):
1823- if isinstance (message .root , types .LoggingMessageNotification ):
1822+ if isinstance (message , Exception ): # pragma: no branch
1823+ return # pragma: no cover
1824+ if isinstance (message , types .ServerNotification ): # pragma: no branch
1825+ if isinstance (message .root , types .LoggingMessageNotification ): # pragma: no branch
18241826 captured_notifications .append (str (message .root .params .data ))
18251827
18261828 async with streamablehttp_client (f"{ server_url } /mcp" ) as (
@@ -1893,10 +1895,10 @@ async def test_streamablehttp_sse_polling_full_cycle(
18931895 async def message_handler (
18941896 message : RequestResponder [types .ServerRequest , types .ClientResult ] | types .ServerNotification | Exception ,
18951897 ) -> None :
1896- if isinstance (message , Exception ):
1897- return
1898- if isinstance (message , types .ServerNotification ):
1899- if isinstance (message .root , types .LoggingMessageNotification ):
1898+ if isinstance (message , Exception ): # pragma: no branch
1899+ return # pragma: no cover
1900+ if isinstance (message , types .ServerNotification ): # pragma: no branch
1901+ if isinstance (message .root , types .LoggingMessageNotification ): # pragma: no branch
19001902 all_notifications .append (str (message .root .params .data ))
19011903
19021904 async with streamablehttp_client (f"{ server_url } /mcp" ) as (
@@ -1941,10 +1943,10 @@ async def test_streamablehttp_events_replayed_after_disconnect(
19411943 async def message_handler (
19421944 message : RequestResponder [types .ServerRequest , types .ClientResult ] | types .ServerNotification | Exception ,
19431945 ) -> None :
1944- if isinstance (message , Exception ):
1945- return
1946- if isinstance (message , types .ServerNotification ):
1947- if isinstance (message .root , types .LoggingMessageNotification ):
1946+ if isinstance (message , Exception ): # pragma: no branch
1947+ return # pragma: no cover
1948+ if isinstance (message , types .ServerNotification ): # pragma: no branch
1949+ if isinstance (message .root , types .LoggingMessageNotification ): # pragma: no branch
19481950 notification_data .append (str (message .root .params .data ))
19491951
19501952 async with streamablehttp_client (f"{ server_url } /mcp" ) as (
@@ -2025,7 +2027,7 @@ async def on_resumption_token(token: str) -> None:
20252027 assert "Completed 3 checkpoints" in result .content [0 ].text
20262028
20272029 # 4 priming + 3 notifications + 1 response = 8 tokens
2028- assert len (resumption_tokens ) == 8 , (
2030+ assert len (resumption_tokens ) == 8 , ( # pragma: no cover
20292031 f"Expected 8 resumption tokens (4 priming + 3 notifs + 1 response), "
20302032 f"got { len (resumption_tokens )} : { resumption_tokens } "
20312033 )
0 commit comments