Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BW6Jdsh18WPtYUR6THZJqn
55 lines
2.5 KiB
Python
55 lines
2.5 KiB
Python
"""갈 곳(`destination`) 기본값 금지 — 명세 13장 「⛔ 기본값 금지(빠진 것이 조용해짐)」 (2026-09-14).
|
|
|
|
종전 `DESTINATION.get(name, "quantity")` 는 표에 없는 이름을 **아무 축에도 안 가는 칸**으로 떨어뜨려
|
|
L형수로 이형철근·면목 · 개거 유로폼·면목 · 떼흙막이 떼가 자재총괄에서 통째로 빠져 있었음.
|
|
|
|
지키는 것
|
|
① 표에 없는 이름은 성분이 안 서고 **사유가 뜸**(조용히 새지 않음)
|
|
② 정본 표(개거·떼흙막이·바닥막이)의 모든 줄 이름이 갈 곳 표에 있음 — 줄이 늘면 여기서 걸림
|
|
③ 드러난 넷이 제자리로 감(관측 원단위와 같은 갈 곳)
|
|
"""
|
|
|
|
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_UnitQuantity_Base import DESTINATION, routed # noqa: E402
|
|
from B08_Quantity.B08_Quantity_Engine_UnitQuantity_Revetment import ( # noqa: E402
|
|
BED_SILL_FORMS,
|
|
OPEN_DITCH_FORMS,
|
|
SOIL_GUARD_SOD,
|
|
open_ditch,
|
|
soil_guard,
|
|
)
|
|
|
|
|
|
def test_표에_없는_이름은_막히고_사유가_뜸() -> None:
|
|
notes: list[str] = []
|
|
assert routed("낯선성분", notes) is None
|
|
assert routed("낯선성분", notes) is None
|
|
assert len(notes) == 1 and "갈 곳이 표" in notes[0] and "기본값 금지" in notes[0]
|
|
assert routed("터파기", notes) == "earthwork" and len(notes) == 1
|
|
|
|
|
|
def test_정본_표의_줄_이름은_전부_갈_곳_표에_있음() -> None:
|
|
names = {row[0] for table in OPEN_DITCH_FORMS.values() for row in table["rows"]}
|
|
names |= {row[0] for row in SOIL_GUARD_SOD["rows"]}
|
|
names |= {table["stone_name"] for table in BED_SILL_FORMS.values()}
|
|
assert sorted(name for name in names if name not in DESTINATION) == []
|
|
|
|
|
|
def test_드러난_넷이_제자리로_감() -> None:
|
|
ditch, notes = open_ditch(10.0, {"ditch_spec": "L형수로 H=0.2"})
|
|
got = {component.name: component.destination for component in ditch}
|
|
assert got["이형철근 D13"] == "material" and got["면목"] == "material"
|
|
assert not [note for note in notes if "갈 곳이 표" in note]
|
|
plain, _ = open_ditch(10.0, {})
|
|
assert {c.name: c.destination for c in plain}["유로폼"] == "unit_price"
|
|
sod, sod_notes = soil_guard({"form": "떼"})
|
|
assert {c.name: c.destination for c in sod}["떼"] == "material"
|
|
assert not [note for note in sod_notes if "갈 곳이 표" in note]
|