"""지장목제거를 두 줄로 가름 (2026-09-09 사용자 확정 5차 2번). 실무(영월 설계내역서 1.9)는 **한 면적에 두 작업**을 얹는다 — 1.9.1 뿌리뽑기(장비+인력) 11,035㎡ @475 1.9.2 잡관목제거 벌목(5m미만) 11,035㎡ @882 ← **같은 11,035㎡** ⚠ 겨누는 것 다섯 ① 두 줄이 선다 ② ⚠ **같은 면적**이 두 줄에 그대로 들어간다 — **이중계상이 아니다**(다른 작업이 얹히는 것) ③ 그 사실이 사유에 적힌다 ④ ⚠ 작업 갈래(뿌리뽑기·잡관목제거)를 **지반 갈래로 읽지 않는다** — 읽으면 「시공법 미지정으로 공종을 못 고름」이라는 **틀린 사유**가 붙는다 ⑤ 잡관목제거는 **품셈에 이름이 없음**이 사유에 남는다(공종 보류 — 확정 5차 3번) """ from __future__ import annotations import sys from pathlib import Path ROOT = Path(__file__).resolve().parents[2] sys.path.insert(0, str(ROOT)) from B08_Quantity.B08_Quantity_Engine_EarthworkSummary import ( # noqa: E402 SummaryInput, build_table, ) from B08_Quantity.B08_Quantity_Engine_Handoff import build_handoff # noqa: E402 사면 = {"tree_removal_fill": 9000.0, "tree_removal_cut": 8873.8} def 집계() -> dict: return build_table( SummaryInput( earthwork_totals={}, slope_totals=사면, haul_rows=[], rock_classes=["토사"], rock_ratios_pct={}, application_ratios={}, ) ) def 줄들() -> list[dict]: return [row for row in build_handoff(summary_table=집계())["work_items"] if row["name"] == "지장목제거"] def test_두_줄이_선다() -> None: assert [row["spec"] for row in 줄들()] == ["뿌리뽑기", "잡관목제거"] def test_같은_면적이_두_줄에_들어간다() -> None: """⚠ 이중계상이 아니다 — 한 면적에 **다른 두 작업**이 얹히는 실무 서식이다.""" amounts = {row["quantity"] for row in 줄들()} assert amounts == {17873.8} def test_이중계상이_아님이_사유에_적힌다() -> None: for row in 줄들(): assert "이중계상 아님" in row["in_bill_reason"] or "이중계상 아님" in str(row["spec_detail"]) def test_작업_갈래를_지반_갈래로_읽지_않는다() -> None: """⚠ 읽으면 「시공법 미지정으로 공종을 못 고름」이라는 틀린 사유가 붙는다.""" for row in 줄들(): assert row["ground_class"] is None unmatched = build_handoff(summary_table=집계())["unmatched_work_items"] assert "지장목제거" in unmatched assert not any("지장목제거(" in item for item in unmatched) def test_잡관목제거는_품셈에_이름이_없음이_남는다() -> None: 잡관목 = next(row for row in 줄들() if row["spec"] == "잡관목제거") 사유 = str(잡관목["spec_detail"]) + str(잡관목["in_bill_reason"]) assert "품셈에 그 이름이 없어" in 사유