16 lines
569 B
Python
16 lines
569 B
Python
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()
|