Files
stack/tests/rex/comments/test_init.py
kert d82bc4824f feat(comments): module skeleton + PDF extraction (refs #253)
- New deps: pymupdf>=1.24 (AGPL-3.0), python-docx>=1.1
- src/rex/comments/{__init__.py,extract.py} with ExtractResult dataclass
- PDF extraction via PyMuPDF with status taxonomy:
    ok | ocr_needed | failed | unsupported
- Tests cover happy path, image-only (ocr_needed), and corrupted PDF

Also fixes 19 pre-existing test failures in tests/zot/test_{duck,extract,
table}.py — all were opening data/zotero/data/zotero.sqlite directly,
which fails with "database is locked" while the Zotero container holds
the WAL lock. New tests/zot/conftest.py provides a session-scoped
host_db fixture that snapshots the live DB once via shutil.copy2;
schema rows (itemTypes/fields/creatorTypes) are stable so a hot copy
is fine for these read-only schema-parity checks.

DOCX/text handlers and combine.py land in the next batch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-23 14:54:08 -04:00

23 lines
589 B
Python

"""Public API surface tests for rex.comments."""
from __future__ import annotations
def test_public_api_exports():
from rex import comments
assert hasattr(comments, "extract_attachment")
assert hasattr(comments, "extract_comment")
def test_extract_attachment_returns_namedtuple_like():
from rex.comments import ExtractResult, extract_attachment
# Signature check only — implementation comes in Task 3.
assert callable(extract_attachment)
assert ExtractResult.__annotations__ == {
"text": str,
"status": str,
"chars": int,
}