mirror of
https://github.com/aljazceru/mcp-python-sdk.git
synced 2025-12-19 14:54:24 +01:00
style: Fix imports and line length formatting
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from pydantic import BaseModel, AnyUrl
|
||||
import pytest
|
||||
from pydantic import AnyUrl, BaseModel
|
||||
|
||||
from mcp.server.fastmcp.resources import FunctionResource
|
||||
|
||||
|
||||
@@ -24,6 +25,7 @@ class TestFunctionResource:
|
||||
assert resource.mime_type == "text/plain" # default
|
||||
assert resource.fn == my_func
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_read_text(self):
|
||||
"""Test reading text from a FunctionResource."""
|
||||
|
||||
@@ -39,6 +41,7 @@ class TestFunctionResource:
|
||||
assert content == "Hello, world!"
|
||||
assert resource.mime_type == "text/plain"
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_read_binary(self):
|
||||
"""Test reading binary data from a FunctionResource."""
|
||||
|
||||
@@ -53,6 +56,7 @@ class TestFunctionResource:
|
||||
content = await resource.read()
|
||||
assert content == b"Hello, world!"
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_json_conversion(self):
|
||||
"""Test automatic JSON conversion of non-string results."""
|
||||
|
||||
@@ -68,6 +72,7 @@ class TestFunctionResource:
|
||||
assert isinstance(content, str)
|
||||
assert '"key": "value"' in content
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_error_handling(self):
|
||||
"""Test error handling in FunctionResource."""
|
||||
|
||||
@@ -82,6 +87,7 @@ class TestFunctionResource:
|
||||
with pytest.raises(ValueError, match="Error reading resource function://test"):
|
||||
await resource.read()
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_basemodel_conversion(self):
|
||||
"""Test handling of BaseModel types."""
|
||||
|
||||
@@ -96,6 +102,7 @@ class TestFunctionResource:
|
||||
content = await resource.read()
|
||||
assert content == '{"name": "test"}'
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_custom_type_conversion(self):
|
||||
"""Test handling of custom types."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user