test(приёмка): сверка матрицы с региональным реестром (ловит отставание сборки)

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
anor
2026-11-22 00:08:01 +10:00
co-authored by Claude Code
parent f3bc8303bc
commit 8e24782004
2 changed files with 66 additions and 0 deletions
+29
View File
@@ -182,6 +182,35 @@ def _регион_строка(tmp_path, **к):
return базовая
def _запустить_с_реестром(tmp_path, rows, derived, entries):
p = tmp_path / "coverage.json"
p.write_text(json.dumps({"rows": rows}, ensure_ascii=False), encoding="utf-8")
reg = tmp_path / "regional_files.json"
reg.write_text(json.dumps({"entries": entries}, ensure_ascii=False), encoding="utf-8")
return cc.main(["--coverage", str(p), "--derived", str(derived), "--regional", str(reg)])
def test_реестр_нет_а_матрица_в_работе_ловится(tmp_path):
"""Калининград 21.11: в реестре «нет», а матрица осталась «в работе» — расхождение."""
d = _база_derived(tmp_path)
r = _строка(source="ter_region", kind="ТЕР", region="Область", period="2025",
status="в работе", reason="этап 3", url=None, sha256=None,
rows_count=0, subject_id=276, zone_id=None)
assert _запустить_с_реестром(tmp_path, [r], d, [{"subject_id": 276, "subject": "Область",
"kind": "ТЕР", "status": "нет",
"reason": "база отменена"}]) == 1
def test_реестр_и_матрица_совпадают_проходят(tmp_path):
d = _база_derived(tmp_path)
r = _строка(source="ter_region", kind="ТЕР", region="Область", period="2025",
status="есть", url="https://x", sha256="abc", rows_count=90,
subject_id=276, zone_id=None, provenance="реестр")
assert _запустить_с_реестром(tmp_path, [r], d, [{"subject_id": 276, "subject": "Область",
"kind": "ТЕР", "status": "есть",
"rows": 90, "sha256": "abc"}]) == 0
def test_региональный_отпечаток_сходится_с_манифестом(tmp_path):
d = _база_derived(tmp_path)
assert _запустить(tmp_path, [_регион_строка(tmp_path)], d) == 0