Update test_server_interactions.py

This commit is contained in:
Jeremiah Lowin 2025-04-30 18:09:52 -04:00
commit d544bc9b60

View file

@ -6,6 +6,7 @@ from enum import Enum
from pathlib import Path
from typing import Annotated, Literal
import pydantic_core
import pytest
from mcp.types import (
BlobResourceContents,
@ -144,7 +145,7 @@ class TestToolReturnTypes:
async with Client(mcp) as client:
result = await client.call_tool("uuid_tool", {})
assert isinstance(result[0], TextContent)
assert result[0].text == f'"{test_uuid}"'
assert result[0].text == pydantic_core.to_json(test_uuid).decode()
async def test_path(self):
mcp = FastMCP()
@ -158,7 +159,7 @@ class TestToolReturnTypes:
async with Client(mcp) as client:
result = await client.call_tool("path_tool", {})
assert isinstance(result[0], TextContent)
assert result[0].text == f'"{str(test_path)}"'
assert result[0].text == pydantic_core.to_json(test_path).decode()
async def test_datetime(self):
mcp = FastMCP()
@ -172,7 +173,7 @@ class TestToolReturnTypes:
async with Client(mcp) as client:
result = await client.call_tool("datetime_tool", {})
assert isinstance(result[0], TextContent)
assert result[0].text == f'"{dt.isoformat()}"'
assert result[0].text == pydantic_core.to_json(dt).decode()
async def test_image(self, tmp_path: Path):
mcp = FastMCP()