1b74b06753
Cut comment and docstring volume roughly in half across src, tests, examples, and docs_src: removed comments that restate the adjacent code, leftover development narration, section banners, and self-evident Args/Returns blocks, and compressed the remaining docstrings to a Google-style summary line plus only the detail that earns its place. Kept (and tightened) the load-bearing content: Raises sections, deprecation and version-availability notes, spec/RFC/issue references, why-comments for non-obvious decisions, and all coverage pragmas. The generated mcp_types.v* wire modules are untouched.
20 lines
781 B
Python
20 lines
781 B
Python
"""`docs/tutorial/testing.md`: the page's own test, run for real; only the import path differs from the page."""
|
|
|
|
import pytest
|
|
from inline_snapshot import snapshot
|
|
from mcp_types import CallToolResult, TextContent
|
|
|
|
from docs_src.testing.tutorial001 import mcp
|
|
from mcp import Client
|
|
|
|
# See test_index.py for why this is a per-module mark and not a conftest hook.
|
|
pytestmark = [pytest.mark.anyio, pytest.mark.filterwarnings("error::mcp.MCPDeprecationWarning")]
|
|
|
|
|
|
async def test_call_add_tool() -> None:
|
|
async with Client(mcp, raise_exceptions=True) as client:
|
|
result = await client.call_tool("add", {"a": 1, "b": 2})
|
|
assert result == snapshot(
|
|
CallToolResult(content=[TextContent(type="text", text="3")], structured_content={"result": 3})
|
|
)
|