feat: require offline PaddleOCR model assets
This commit is contained in:
@@ -6,7 +6,7 @@ from docx import Document
|
||||
from pptx import Presentation
|
||||
from pptx.util import Inches
|
||||
|
||||
from wisegrade.parsing import parse_document
|
||||
from wisegrade.parsing import _ocr_engine, parse_document
|
||||
|
||||
|
||||
def test_pdf_pages_and_images(tmp_path):
|
||||
@@ -20,6 +20,11 @@ def test_pdf_pages_and_images(tmp_path):
|
||||
assert (tmp_path / "assets" / "page-1.png").exists()
|
||||
|
||||
|
||||
def test_scanned_pdf_requires_offline_ocr_package(tmp_path):
|
||||
with pytest.raises(RuntimeError, match="离线OCR模型目录"):
|
||||
_ocr_engine(str(tmp_path / "missing-ocr"))
|
||||
|
||||
|
||||
@pytest.mark.skipif(not shutil.which("libreoffice"), reason="LibreOffice is installed in the deployment image")
|
||||
def test_docx_and_pptx_render(tmp_path):
|
||||
word = Document()
|
||||
|
||||
Reference in New Issue
Block a user