From b942441a27df4ff649296cbbb63312270cdae3f1 Mon Sep 17 00:00:00 2001 From: anor Date: Wed, 18 Nov 2026 04:41:16 +1000 Subject: [PATCH] =?UTF-8?q?test(=D0=A2=D0=A1=D0=9D):=20=D0=BF=D1=80=D0=B8?= =?UTF-8?q?=D1=91=D0=BC=D0=BA=D0=B0=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80?= =?UTF-8?q?=D1=8F=D0=B5=D1=82=20=D0=9D=D0=A0/=D0=A1=D0=9F=20=D1=81=D0=B1?= =?UTF-8?q?=D0=BE=D1=80=D0=BD=D0=B8=D0=BA=D0=B0=20.8=20=D0=BD=D0=B0=20?= =?UTF-8?q?=D0=BD=D0=B0=D1=81=D1=82=D0=BE=D1=8F=D1=89=D0=B5=D0=BC=20=D0=BE?= =?UTF-8?q?=D0=B1=D1=80=D0=B0=D0=B7=D1=86=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Code --- scripts/tsn_acceptance.py | 16 ++++++++++++++++ tests/fixtures/tsn_golden.json | 14 ++++++++++++++ 2 files changed, 30 insertions(+) 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