Skip to content

Commit 77e03a3

Browse files
STiFLeR7claude
andcommitted
test(client): cover protocol_version_override's unknown-version branch
cubic flagged the hint expression's else branch (neither handshake-era nor modern) as uncovered, which this repo's CI enforces at 100% branch coverage. Existing tests only exercised the modern-version-override and mode-pin-conflict branches. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent bbef3cf commit 77e03a3

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎tests/client/test_client.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,13 @@ def test_client_rejects_modern_protocol_version_override(app: MCPServer):
157157
Client(app, mode="auto", protocol_version_override=LATEST_MODERN_VERSION)
158158

159159

160+
def test_client_rejects_unknown_protocol_version_override(app: MCPServer):
161+
"""A `protocol_version_override` that is neither a handshake-era nor a modern version
162+
is rejected with no extra hint, unlike the modern-version case above."""
163+
with pytest.raises(ValueError, match=r"protocol_version_override must be one of .*got '1999-01-01'$"):
164+
Client(app, mode="auto", protocol_version_override="1999-01-01")
165+
166+
160167
def test_client_rejects_protocol_version_override_with_a_version_pin_mode(app: MCPServer):
161168
"""`protocol_version_override` has no effect once `mode` already pins a version, so it's
162169
rejected at construction instead of being silently ignored."""

0 commit comments

Comments
 (0)