Skip to content

Commit c1a7020

Browse files
committed
fix: cover experimental property cache-hit branch and fix completion test
1 parent f61ca1f commit c1a7020

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

tests/experimental/tasks/server/test_server.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,9 @@ async def test_update_capabilities_partial_handlers() -> None:
299299
"""Test that update_capabilities skips list/cancel when only tasks/get is registered."""
300300
server = Server("test-partial")
301301
# Access .experimental to create the ExperimentalHandlers instance
302-
_ = server.experimental
302+
exp = server.experimental
303+
# Second access returns the same cached instance
304+
assert server.experimental is exp
303305

304306
async def noop_get(ctx: ServerRequestContext, params: GetTaskRequestParams) -> GetTaskResult:
305307
raise NotImplementedError

tests/server/mcpserver/test_server.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,10 +1412,9 @@ async def test_completion_decorator() -> None:
14121412
@mcp.completion()
14131413
async def handle_completion(
14141414
ref: PromptReference, argument: CompletionArgument, context: CompletionContext | None
1415-
) -> Completion | None:
1416-
if argument.name == "style":
1417-
return Completion(values=["bold", "italic", "underline"])
1418-
return None
1415+
) -> Completion:
1416+
assert argument.name == "style"
1417+
return Completion(values=["bold", "italic", "underline"])
14191418

14201419
async with Client(mcp) as client:
14211420
ref = PromptReference(type="ref/prompt", name="test")

0 commit comments

Comments
 (0)