Files
mcp-example/pdf_server/test_pdf.py
2025-08-15 19:50:11 +08:00

16 lines
569 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import asyncio
import os
from pdf import translate_pdf
def test_translate_pdf():
test_pdf_path = os.path.abspath("/Users/mengxin/Project/mcp-client/测试文档.pdf")
if not os.path.exists(test_pdf_path):
print("测试PDF文件不存在请放置测试文档.pdf 在当前目录下。")
return
result = asyncio.run(translate_pdf(test_pdf_path))
print("翻译结果:\n", result)
assert "翻译失败" not in result and "PDF解析失败" not in result, "翻译或解析失败"
if __name__ == "__main__":
test_translate_pdf()