mirror of
https://github.com/debpalash/VoiceStudio.git
synced 2026-12-04 01:18:16 +00:00
- insertionSlot: falls back when the next segment has no finite start, and rounds a custom threshold to milliseconds before comparing (#4389). - New test modules resolve app code at test time (#4380, #4382, #4383).
24 lines
693 B
Python
24 lines
693 B
Python
"""PDF parser errors from lazy page-tree access."""
|
|
|
|
import pytest
|
|
|
|
|
|
|
|
def test_unreadable_pdf_page_tree_reports_import_error(monkeypatch):
|
|
import importlib
|
|
|
|
pdf_to_chapter_script = importlib.import_module("services.longform_import").pdf_to_chapter_script # resolved at test time
|
|
import pypdf
|
|
|
|
class BrokenPages:
|
|
def __len__(self):
|
|
raise pypdf.errors.PdfReadError("missing page tree")
|
|
|
|
class Reader:
|
|
is_encrypted = False
|
|
pages = BrokenPages()
|
|
|
|
monkeypatch.setattr(pypdf, "PdfReader", lambda _stream: Reader())
|
|
with pytest.raises(ValueError, match="not a valid PDF file: missing page tree"):
|
|
pdf_to_chapter_script(b"PDF")
|