18 lines
524 B
Python
18 lines
524 B
Python
|
|
import sys
|
||
|
|
from pathlib import Path
|
||
|
|
from fastapi.testclient import TestClient
|
||
|
|
|
||
|
|
root = Path(__file__).resolve().parents[2] / "docling"
|
||
|
|
sys.path.insert(0, str(root))
|
||
|
|
import app.server as server
|
||
|
|
|
||
|
|
from docling.tests.test_api_prd import setup_module, PNG
|
||
|
|
setup_module()
|
||
|
|
|
||
|
|
app = server.app
|
||
|
|
c = TestClient(app)
|
||
|
|
files = {"file": ("管理端使用说明 (1).pdf", b"%PDF-1.4\n")}
|
||
|
|
data = {"export": "markdown", "save": "true", "filename": "管理端使用说明 (1)"}
|
||
|
|
r = c.post("/api/convert", files=files, data=data)
|
||
|
|
print(r.json())
|