Skip to content

Commit 3a2584e

Browse files
fix: update test assertions for str URI type
With URI fields changed from AnyUrl to str, URIs are no longer normalized (e.g., trailing slashes not added). Update test assertions to match exact URIs being sent.
1 parent 9f417f3 commit 3a2584e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

tests/shared/test_streamable_http.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import requests
2222
import uvicorn
2323
from httpx_sse import ServerSentEvent
24-
from pydantic import AnyUrl
2524
from starlette.applications import Starlette
2625
from starlette.requests import Request
2726
from starlette.routing import Mount
@@ -1013,7 +1012,7 @@ async def test_streamable_http_client_resource_read(initialized_client_session:
10131012
"""Test client resource read functionality."""
10141013
response = await initialized_client_session.read_resource(uri="foobar://test-resource")
10151014
assert len(response.contents) == 1
1016-
assert response.contents[0].uri == AnyUrl("foobar://test-resource")
1015+
assert response.contents[0].uri == "foobar://test-resource"
10171016
assert isinstance(response.contents[0], TextResourceContents)
10181017
assert response.contents[0].text == "Read test-resource"
10191018

@@ -1132,7 +1131,7 @@ async def message_handler( # pragma: no branch
11321131
resource_update_found = False
11331132
for notif in notifications_received:
11341133
if isinstance(notif.root, types.ResourceUpdatedNotification): # pragma: no branch
1135-
assert str(notif.root.params.uri) == "http://test_resource/"
1134+
assert str(notif.root.params.uri) == "http://test_resource"
11361135
resource_update_found = True
11371136

11381137
assert resource_update_found, "ResourceUpdatedNotification not received via GET stream"
@@ -2237,10 +2236,10 @@ async def message_handler(
22372236
assert result.content[0].text == "Standalone stream close test done"
22382237

22392238
# Verify both notifications were received
2240-
assert "http://notification_1/" in received_notifications, (
2239+
assert "http://notification_1" in received_notifications, (
22412240
f"Should receive notification 1 (sent before GET stream close), got: {received_notifications}"
22422241
)
2243-
assert "http://notification_2/" in received_notifications, (
2242+
assert "http://notification_2" in received_notifications, (
22442243
f"Should receive notification 2 after reconnect, got: {received_notifications}"
22452244
)
22462245

0 commit comments

Comments
 (0)