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'])}")
+14
View File
@@ -28,6 +28,11 @@
"pages": 33,
"url": "https://niac.mos.ru/standards/tsn-2001/collectors-tsn-2001/",
"note": "сметные цены эксплуатации машин; в git файла нет"
},
"tsn_2001_8": {
"file": "tests/fixtures/tsn_local/nr8.pdf",
"pages": 4,
"note": "нормы накладных расходов и сметной прибыли; в git файла нет"
}
},
"rates": [
@@ -154,5 +159,14 @@
"price": 241.75,
"page": 5
}
],
"nr_sp": [
{
"book": "ТСН-2001.8",
"work_type": "Земляные работы, выполняемые: Механизированным способом",
"overhead": 98.0,
"profit": 77.0,
"page": 1
}
]
}