Add research overrides support

This commit is contained in:
scawful
2025-12-30 17:26:03 -05:00
parent f37ad164bc
commit 452ce64b11
6 changed files with 119 additions and 2 deletions

View File

@@ -24,3 +24,28 @@ def test_build_research_catalog_regex(tmp_path: Path) -> None:
assert entry["title"] == "Test Paper"
assert entry["author"] == "Jane Doe"
assert entry["metadata_source"] == "regex"
def test_build_research_catalog_overrides(tmp_path: Path) -> None:
research_root = tmp_path / "Research"
research_root.mkdir()
pdf_path = research_root / "paper.pdf"
pdf_path.write_bytes(b"%PDF-1.0 /Title (Ignored)")
overrides = {
"papers": {
"paper.pdf": {
"title": "Manual Title",
"author": "Manual Author",
}
}
}
catalog = build_research_catalog(
research_root,
overrides=overrides,
include_abstract=False,
)
entry = catalog["papers"][0]
assert entry["title"] == "Manual Title"
assert entry["author"] == "Manual Author"
assert entry["metadata_source"] == "override"