Files
mcp-example/pdf_server/test_pdf.py

16 lines
569 B
Python
Raw Permalink Normal View History

2025-08-15 19:50:11 +08:00
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()