Files
Aislo/resources/tester/test_52_6_cross_underdrain.py
T
eomsangdonandClaude Opus 5.5 4c0174bf27 feat(structure): 횡단배수 맹암거 새 종류(표 06 · 52-6)
- 정의 판 8 — 새 종류 cross_underdrain(A 횡단배수 · 점형 · 이름 맹암거 · 약자 횡맹 · 색 따로) · 종단배수 underdrain 그대로
- 컨테이너 = 정의 그룹 gcrossud 「맹암거」 — 암거 높이(m) · 암거 경사(%) 손 입력 · 기본값 없음 · 그룹 잇기로 구조물 조합 항목
- 시험 test_52_6_cross_underdrain · 종류 수 기대값(B05 선택지 24 · 정의 38) · ORCA 시나리오 52-6_횡단맹암거

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013rJwJMVL4EE31y77TB11AP
2026-10-05 23:38:40 +09:00

92 lines
3.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
"""52-6 횡단배수 › 맹암거(표 06 · 새 종류) — 정의 · 컨테이너 · 서버 저장 왕복.
새 키 `cross_underdrain`(횡단배수 · 점형) — 종단배수 맹암거(`underdrain`)와 따로.
컨테이너 = 정의 그룹 「맹암거」(필수 · 늘 한 벌) — 암거 높이(m) · 암거 경사(%) 손 입력(비워 둘 수 있음) ·
그룹 잇기(`group_items`)로 구조물 조합 항목. 저장은 임시 storage 에서만.
"""
import pytest
from B05_Profile.B05_Profile_Structures_Schema import (
StructureInstance,
is_station_planting_type,
load_definition,
structure_type_map,
)
KEY = "cross_underdrain"
GROUP = "gcrossud"
def test_새_종류는_횡단배수_점형_종단배수_맹암거와_따로():
types = structure_type_map()
new, old = types[KEY], types["underdrain"]
assert (new.group, new.placement, new.name, new.enabled) == ("A", "point", "맹암거", True)
assert (old.group, old.placement) == ("B", "interval")
assert new.style["abbr"] != old.style["abbr"] and new.style["color"] != old.style["color"]
assert is_station_planting_type(new) # 횡단배수 = 그 측점에 횡단도
def test_컨테이너_맹암거_높이_경사_손_입력():
opts = {o.key: o for o in structure_type_map()[KEY].options}
assert list(opts) == ["culvert_height_m", "culvert_slope_pct"]
for key, label, unit in (
("culvert_height_m", "암거 높이", "m"),
("culvert_slope_pct", "암거 경사", "%"),
):
o = opts[key]
assert (o.label, o.input, o.unit, o.default, o.required) == (
label,
"number",
unit,
None,
False,
)
assert o.empty_means # 손 입력 · 기본값 근거 없음 — 비워 둘 수 있음(B05 단계 필수 금지)
groups = load_definition()["그룹"][KEY]
assert groups == [
{"id": GROUP, "이름": "맹암거", "옵션": list(opts), "형상": {}},
]
def test_정의_검사_통과():
from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition
assert definition.check(load_definition()) == []
def _item(**options):
return StructureInstance(
type_id=KEY,
placement="point",
chainage_m=63.5,
options=options,
group_items={
GROUP: {"layer": "system", "owner": None, "key": "SS000001", "name": "맹암거"}
},
)
def test_저장_다시_읽기_그대로(tmp_path):
from B05_Profile.B05_Profile_Structures_Repository import load_structures, save_structures
item = _item(culvert_height_m=0.6, culvert_slope_pct=2.5)
save_structures(str(tmp_path), [item], base_revision=0)
_, loaded = load_structures(str(tmp_path))
assert [(s.type_id, s.chainage_m, s.options) for s in loaded] == [
(KEY, 63.5, {"culvert_height_m": 0.6, "culvert_slope_pct": 2.5})
]
assert loaded[0].group_items == item.group_items
@pytest.mark.parametrize(
"options",
[{"culvert_height_m": -1}, {"culvert_slope_pct": -0.5}],
)
def test_음수는_서버가_막음(tmp_path, options):
from B05_Profile.B05_Profile_Structures_Repository import save_structures
with pytest.raises(ValueError):
save_structures(str(tmp_path), [_item(**options)], base_revision=0)