scripts/regression: в снимке документов locator OCR без id задания (#179)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Andrey Epifancev 2026-10-28 12:36:42 +04:00
parent 9bc2b26c1c
commit 44e0fd8229

View File

@ -29,6 +29,8 @@ from pathlib import Path
MONEY = ("opening_debit", "opening_credit", "turnover_debit", "turnover_credit", "closing_debit", "closing_credit")
PENDING_FILE = {"UPLOADED", "PROCESSING"}
# locator документов из OCR содержит id задания (file:<uuid>.json;table:0) — в снимке заменяется
UUID_RE = re.compile(r"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}")
TO_CONFIRM = {"RECOGNIZED", "NEEDS_CHECK"}
@ -218,7 +220,7 @@ def run_scenario(api: Api, sc: dict, ctx: dict, fixtures: Path, rep: Report, out
sorted(
[
{k: d.get(k) for k in ("document_type", "osv_account_code", "period_year", "period_quarter", "is_cumulative", "period_check", "counterparty_check", "locator", "issue_counts")}
| {"file": n, "status_after_recognition": d["status"]}
| {"file": n, "status_after_recognition": d["status"], "locator": UUID_RE.sub("<uuid>", str(d["locator"]))}
for n, d in docs
],
key=lambda x: (x["file"], str(x["locator"])),