@@ -188,7 +188,9 @@ async def test_ws_client_happy_request_and_response(
188188 initialized_ws_client_session : ClientSession ,
189189) -> None :
190190 """Test a successful request and response via WebSocket"""
191- result = await initialized_ws_client_session .read_resource ("foobar://example" )
191+ result = await initialized_ws_client_session .read_resource (
192+ AnyUrl ("foobar://example" )
193+ )
192194 assert isinstance (result , ReadResourceResult )
193195 assert isinstance (result .contents , list )
194196 assert len (result .contents ) > 0
@@ -202,7 +204,7 @@ async def test_ws_client_exception_handling(
202204) -> None :
203205 """Test exception handling in WebSocket communication"""
204206 with pytest .raises (McpError ) as exc_info :
205- await initialized_ws_client_session .read_resource ("unknown://example" )
207+ await initialized_ws_client_session .read_resource (AnyUrl ( "unknown://example" ) )
206208 assert exc_info .value .error .code == 404
207209
208210
@@ -214,11 +216,13 @@ async def test_ws_client_timeout(
214216 # Set a very short timeout to trigger a timeout exception
215217 with pytest .raises (TimeoutError ):
216218 with anyio .fail_after (0.1 ): # 100ms timeout
217- await initialized_ws_client_session .read_resource ("slow://example" )
219+ await initialized_ws_client_session .read_resource (AnyUrl ( "slow://example" ) )
218220
219221 # Now test that we can still use the session after a timeout
220222 with anyio .fail_after (5 ): # Longer timeout to allow completion
221- result = await initialized_ws_client_session .read_resource ("foobar://example" )
223+ result = await initialized_ws_client_session .read_resource (
224+ AnyUrl ("foobar://example" )
225+ )
222226 assert isinstance (result , ReadResourceResult )
223227 assert isinstance (result .contents , list )
224228 assert len (result .contents ) > 0
0 commit comments