Skip to content

Commit 82e0f2f

Browse files
committed
Test: Modify test_initialize_without_context_manager_raises_error
1 parent fb11722 commit 82e0f2f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tests/client/test_session.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any
1+
from typing import Any, cast
22

33
import anyio
44
import pytest
@@ -775,13 +775,13 @@ async def test_initialize_without_context_manager_raises_error():
775775
"""
776776
Test that calling initialize() without entering the context manager raises RuntimeError.
777777
"""
778-
# Create dummy streams for session initialization
779-
read_stream, write_stream = anyio.create_memory_object_stream(0)
778+
send_stream, receive_stream = anyio.create_memory_object_stream[Any](0)
780779

781-
async with read_stream, write_stream:
782-
# Instantiate the session object directly
780+
read_stream = cast(Any, receive_stream)
781+
write_stream = cast(Any, send_stream)
782+
783+
async with send_stream, receive_stream:
783784
session = ClientSession(read_stream, write_stream)
784785

785-
# Verify that calling initialize() raises a RuntimeError
786786
with pytest.raises(RuntimeError, match="must be used within"):
787787
await session.initialize()

0 commit comments

Comments
 (0)