Skip to content

Commit 01cb5b2

Browse files
author
BrokenDuck
committed
Finish PR
1 parent 6ad82c6 commit 01cb5b2

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

mcp-run-python/test_mcp_servers.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -514,15 +514,15 @@ async def test_run_python_code_with_file(
514514
match content_type:
515515
case 'bytes':
516516
filename = 'image.png'
517-
# output_file = 'image-gray.png'
518-
# ctype = 'image/png'
517+
output_file = 'image-gray.png'
518+
ctype = 'image/png'
519519
data_file = tmp_path / filename
520520
data_file.write_bytes(base64.b64decode(BASE_64_IMAGE))
521521

522522
case 'text':
523523
filename = 'data.csv'
524-
# output_file = 'data-processed.csv'
525-
# ctype = 'text/csv'
524+
output_file = 'data-processed.csv'
525+
ctype = 'text/csv'
526526
data_file = tmp_path / filename
527527
data_file.write_text(CSV_DATA)
528528

@@ -538,16 +538,16 @@ async def test_run_python_code_with_file(
538538
assert isinstance(content, types.TextContent)
539539
assert content.text == expected_output
540540

541-
# result = await mcp_session.read_resource(FileUrl(f'file:///{output_file}'))
542-
# assert len(result.contents) == 1
543-
# resource = result.contents[0]
544-
# assert resource.mimeType is not None
545-
# assert resource.mimeType.startswith(ctype)
546-
# assert (
547-
# isinstance(resource, types.BlobResourceContents)
548-
# if content_type == 'bytes'
549-
# else isinstance(resource, types.TextResourceContents)
550-
# )
541+
result = await mcp_session.read_resource(FileUrl(f'file:///{output_file}'))
542+
assert len(result.contents) == 1
543+
resource = result.contents[0]
544+
assert resource.mimeType is not None
545+
assert resource.mimeType.startswith(ctype)
546+
assert (
547+
isinstance(resource, types.BlobResourceContents)
548+
if content_type == 'bytes'
549+
else isinstance(resource, types.TextResourceContents)
550+
)
551551

552552

553553
async def test_install_run_python_code() -> None:

0 commit comments

Comments
 (0)