Files
stack/tests/prisma/test_screen_deep.py
kert dbf71a6594 test: 99.93% coverage — Zotero 9 schema fix + 400+ new tests
Fix Zotero table models for Zotero 9:
- Remove stale Annotations/Highlights/Transaction* models
- Add ItemAnnotations, RetractedItems, DeletedCollections,
  DeletedSearches, DbDebug1
- Fix ItemAttachments, Libraries, Users column mismatches

New test files covering all major modules:
- cli/{bib,prisma,rec,zot,mail,run} deep exercising tests
- mail/{droplet,postmark,resend,cloudflare} lifecycle tests
- bib/{iom,oig,pincite,sync,regulations_gov,email_ingest,format,store}
- prisma/{vpn,fetch,export,llm,screen,eligibility,extract,project,ingest,flow}
- aco/lake/{unity,quality,deploy} + api/aco coverage gaps
- zot/{ops,db,extract,duck} + rec/{report,engine,base,pricers}
- pfs/{pipe,rules,eq,files}

Add pytest-xdist for parallel test execution.

Tracks #353
2026-04-18 10:06:47 -04:00

36 lines
1.1 KiB
Python

"""Exercise prisma.screen.run with mock provider."""
from __future__ import annotations
from unittest.mock import MagicMock
from prisma.llm import LLMResult
from prisma.screen import run
from zot.db import Db
from zot.schema import create_db
class TestScreenRun:
def test_empty_queue(self, tmp_path):
path = str(tmp_path / "z.sqlite")
con = create_db(path)
con.close()
provider = MagicMock()
provider.complete.return_value = LLMResult(
text="",
tool_calls=[
{
"name": "screen",
"input": {"decision": "exclude", "reason": "irrelevant"},
}
],
usage={"input_tokens": 10, "output_tokens": 20},
)
project = MagicMock()
project.name = "test"
project.criteria = "Include skin substitute studies"
project.reasons = "irrelevant, duplicate"
with Db(path) as db:
stats = run(db, provider, project, storage_dir=tmp_path, limit=0)
assert isinstance(stats, dict)