From d544bc9b607055ddf8f7cf512e1bc667a27c5ce9 Mon Sep 17 00:00:00 2001 From: Jeremiah Lowin <153965+jlowin@users.noreply.github.com> Date: Wed, 30 Apr 2025 18:09:52 -0400 Subject: [PATCH] Update test_server_interactions.py --- tests/server/test_server_interactions.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/server/test_server_interactions.py b/tests/server/test_server_interactions.py index 7c6a5979c..98025f0bb 100644 --- a/tests/server/test_server_interactions.py +++ b/tests/server/test_server_interactions.py @@ -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()