Skip to content

Commit ce45982

Browse files
committed
fix(tests): assert server_info is not None before .name access
pyright's pre-commit hook flagged reportOptionalMemberAccess on client.server_info.name in two new protocol_version_override tests. server_info is Implementation | None; every other call site in this file already asserts not-None first.
1 parent dce39ec commit ce45982

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

tests/client/test_client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ async def test_client_custom_protocol_version(app: MCPServer):
134134
"""Test that the client negotiates a custom protocol version when configured."""
135135
async with Client(app, mode="legacy", protocol_version_override="2024-11-05") as client:
136136
assert client.protocol_version == "2024-11-05"
137+
assert client.server_info is not None
137138
assert client.server_info.name == "test"
138139

139140

tests/interaction/lowlevel/test_client_connect.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ async def test_auto_mode_with_a_protocol_version_override_skips_discover_and_ini
199199
) as client,
200200
):
201201
assert client.protocol_version == "2024-11-05"
202+
assert client.server_info is not None
202203
assert client.server_info.name == "discoverable"
203204

204205
bodies = [json.loads(r.content)["method"] for r in requests if r.method == "POST"]

0 commit comments

Comments
 (0)