test(ТСН): приёмка проверяет НР/СП сборника .8 на настоящем образце

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
anor
2026-11-18 04:41:16 +10:00
co-authored by Claude Code
parent e1029cdca3
commit b942441a27
2 changed files with 30 additions and 0 deletions
+16
View File
@@ -73,6 +73,22 @@ def main(argv=None) -> int:
bad.append(f"{spec['code']}: название {it['name']!r} без {spec['name_contains']!r}")
print(f"{spec['book']}: {spec['code']} = {it['price']} {it['unit']} (стр. {it['page']})")
nr_pdf = d / "nr8.pdf"
if nr_pdf.exists() and golden.get("nr_sp"):
spec = golden["nr_sp"][0]
items = tsn_parse.parse_nr_sp(str(nr_pdf), {"book": spec["book"]})["items"]
hit = next((i for i in items if i["work_type"] == spec["work_type"]), None)
if not hit:
bad.append(f"НР/СП: вид работ {spec['work_type']!r} не разобран")
else:
if abs(hit["overhead"] - spec["overhead"]) > 0.01 or \
abs(hit["profit"] - spec["profit"]) > 0.01:
bad.append(f"НР/СП {spec['work_type']}: {hit['overhead']}/{hit['profit']} "
f"≠ {spec['overhead']}/{spec['profit']}")
print(f"ТСН-2001.8: {hit['work_type']} — НР {hit['overhead']} %, СП {hit['profit']} %")
else:
print("Сборник НР/СП: образца нет — НЕ проверено")
rel = tsn_parse.parse_index_release(str(index_pdf), {"file": "index222.pdf"})
print(f"Выпуск {rel['issue_no']}: {rel['quarter']} кв. {rel['year']}, "
f"приказ {rel['decree']}, доп. {rel['addendum_no']}, значений {len(rel['values'])}")