"""등록부 칸 채우기 A2·A3 (2026-09-14) — 표가 읽는 칸이 등록부에 없어 영영 안 서던 자리. A2 개거(점 배치) — 연장 칸 · A3 물넘이포장(관 지점 시설) — 두께·노폭 방향 길이 칸. ⚠ 옛 저장본(칸 없음)은 안 깨지고 **사유가 보임** — 「값이 없으면 표가 안 선다」가 아니라 「사유를 보인다」. """ from __future__ import annotations import sys from pathlib import Path ROOT = Path(__file__).resolve().parents[2] if str(ROOT) not in sys.path: sys.path.insert(0, str(ROOT)) from B05_Profile.B05_Profile_Structures_Repository import _validate_types # noqa: E402 from B05_Profile.B05_Profile_Structures_Schema import StructureInstance, structure_type_map # noqa: E402 from B08_Quantity.B08_Quantity_Engine_Pipe import facility_structures # noqa: E402 from B08_Quantity.B08_Quantity_Engine_UnitQuantity import build_table # noqa: E402 def _ditch(**options) -> dict: return build_table( [{"structure_id": "d", "type_id": "open_ditch", "chainage_m": 10.0, "options": options}] )["structures"][0] def test_개거_연장_칸이_등록부에_서고_구조물_목록에_저장된다() -> None: keys = {option.key for option in structure_type_map()["open_ditch"].options} assert "length_m" in keys item = StructureInstance( type_id="open_ditch", placement="point", chainage_m=10.0, options={"length_m": 12} ) _validate_types([item]) # 등록부에 없는 칸이면 여기서 거절됨 def test_개거_연장이_있으면_표가_서고_없으면_어디서_적는지_사유() -> None: assert _ditch(length_m=12)["components"] old = _ditch() # 옛 저장본 — 칸이 없음 assert not old["components"] assert old["notes"][0].startswith("개거(겉도랑) 연장(m)이(가) 아직 입력되지 않았습니다") def _ford(**options) -> dict: point = {"facility": "ford_pavement", "chainage_m": 30.0, "options": options} return build_table(facility_structures([point]))["structures"][0] def test_물넘이포장_두께_길이_칸이_있으면_면적으로_선다() -> None: keys = {option.key: option for option in structure_type_map()["ford_pavement"].options} assert keys["thickness_cm"].phase == "detail" and keys["length_m"].phase == "detail" row = _ford(ford_width_m=5, thickness_cm=20, length_m=8) assert row["components"] and (row["billing_unit"], row["billing_quantity"]) == ("㎡", 40.0) def test_물넘이포장_칸이_비면_무엇을_적을지_사유() -> None: old = _ford(ford_width_m=5) assert not old["components"] and "포장 두께(㎝)" in old["notes"][0] no_length = _ford(ford_width_m=5, thickness_cm=20) assert not no_length["components"] and "포장 길이" in no_length["notes"][0]