Rebuild the docs around tested examples; shrink README.v2.md to a pitch (#2978)
This commit is contained in:
parent
4caa41f6d5
commit
411a6d3980
1 changed files with 9510 additions and 2639 deletions
23
tests/docs_src/test_testing.py
Normal file
23
tests/docs_src/test_testing.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
"""`docs/tutorial/testing.md`: the page's own test, run for real.
|
||||
|
||||
The page shows this test against a `server.py` next to it; here the import path
|
||||
is the only difference.
|
||||
"""
|
||||
|
||||
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})
|
||||
)
|
||||
Loading…
Reference in a new issue