Files
Aislo/resources/tester/test_b05_registry_fill_a2_a3.py
T
eomsangdonandClaude Opus 5 0eebb50c03 feat(b05,b08): 등록부 칸 채움 A2·A3 — 개거 연장 · 물넘이포장 두께·노폭 방향 길이
- 표가 읽는데 등록부에 없어 영영 안 서던 칸 — 옛 저장본은 안 깨지고 비면 사유(어디서 적는지)
- 개거(점 배치) length_m · 물넘이포장 thickness_cm·length_m(detail · 구조물 집계표에서도 고침)
- B05 시설 칸에 물넘이 두께·길이 입력 — 시설 저장이 칸을 통째로 갈아 끼워 집계표로 적은 값이 지워지던 길을 막음
- 700줄 한계로 유입구 형식 목록을 _Fields 로 옮김(부르는 쪽 그대로)
- 사유 문구: 「open_ditch 연장」 키 노출 · 「연장·면적이 0」 → 무엇을 적으면 서는지

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016VBGFXB9AbJBwXP19z75Qq
2026-09-14 08:40:49 +09:00

61 lines
2.7 KiB
Python

"""등록부 칸 채우기 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]