diff --git a/scripts/tsn_acceptance.py b/scripts/tsn_acceptance.py index baa1d48..b81ae36 100755 --- a/scripts/tsn_acceptance.py +++ b/scripts/tsn_acceptance.py @@ -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'])}") diff --git a/tests/fixtures/tsn_golden.json b/tests/fixtures/tsn_golden.json index b8aac5d..a136cd1 100644 --- a/tests/fixtures/tsn_golden.json +++ b/tests/fixtures/tsn_golden.json @@ -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 + } ] } \ No newline at end of file