Files
Aislo/resources/tester/test_52_structure_spec_box.py
T
eomsangdonandClaude Opus 5.5 d7faee1cd2 feat(structure): 65-1~5 세월교 · 박스암거 유입 · 유출 흙막이 양식 공통 · 없음 = 램프 뺌 · 세월교 기본값 · 물넘이 월류 폭 · 높이
- 흙막이 양식 한 벌(design_structure_guard) — 배관 · 박스 · 세월교가 같은 칸(형태 · 길이 · 높이 · 측점 전후) · 추가 흙막이 · 도수로/돌붙임 상자
- 세월교 · 박스 유입 · 유출: 흙막이 고르면 흙막이 칸(키 {side}_revet_* · 기본 찰 10 · 1.5 · 5 · 5) · [연동][경사] 옵션 줄
- B06 측벽 높이 · 좌우 · 상하 · 바닥판 읽기 줄을 세월교 · 박스 유입 · 유출 칸에 안 옮김(강조만)
- 유입 · 유출 「없음」 = 목록 램프 · 구조물 조합 잇기 줄 없음(명세 none)
- 세월교: 수량(련) 관경 바로 뒤 · 련 기본 2 · 새 시설 빈 월류 높이 = 유량 오면 필요 수심 · 종류 바꿀 때 유량 넘김
- 물넘이 포장: 경사각 기본 3° · 월류 폭 · 높이 칸(세월교와 같은 키 ford_width_m · ford_height_m · 같은 계산)
- 구조물정의 판 18(판_17 이력) · 이름 표 · 집계표 선택 컨테이너 짝 · 저장 병합 키
- 시험: 세월교 · 박스 · 물넘이 명세 기대값 · 흙막이 짝 자리 옮김

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

111 lines
4.0 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 -*-
"""횡단배수 › 박스암거(표 02 고친 판) 명세 — PLAN 52-2.
순수 규칙은 Node 헬퍼(`helper_52_structure_spec_box.cjs`)가 돌림 · 화면은 ORCA `ui_checks/52-2_박스암거_컨테이너.js`.
"""
import json
import os
import subprocess
import pytest
HERE = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.dirname(os.path.dirname(HERE))
def _node(*args):
proc = subprocess.run(
["node", os.path.join(HERE, "helper_52_structure_spec_box.cjs"), *args],
capture_output=True,
text=True,
encoding="utf-8",
timeout=60,
)
assert proc.returncode == 0, proc.stderr
return json.loads(proc.stdout)
@pytest.fixture(scope="module")
def out():
return _node()
def test_컨테이너_셋_모두_필수(out):
assert out["containers"] == [
["body", "본체", True],
["inlet", "유입 구조", True],
["outlet", "유출 구조", True],
["soil_add", "흙막이", False],
["chute_add", "도수로/돌붙임", False],
]
assert out["links"] == ["gboxbody", "gboxin", "gboxout", "gsoiladd1", "gchuteadd1"]
def test_선택지_표_02_그대로(out):
assert out["sizes"] == ["2.0×2.0", "3.0×3.0", "사용자 입력"]
assert out["structures"] == ["없음", "날개벽", "흙막이"]
def test_사용자_입력일_때만_가로_세로_칸(out):
assert out["customHidden"] is None
assert out["customShown"] == {"key": "body_width_m"}
def test_옛_값_읽기_규격_밖은_사용자_입력_있음은_날개벽(out):
st = out["old"]["state"]
assert st["body"][0] == {"size": "사용자 입력", "width": "3", "height": "2.5"}
assert st["inlet"][0]["structure"] == "날개벽"
back = out["old"]["out"]
assert back == {"body_width_m": 3, "body_height_m": 2.5, "wing_in": "날개벽"}
# 옛 날개벽 치수는 폼이 안 적음(병합이 이어 붙임 = 지난 정의 값)
assert "wing_in_length_m" not in back
assert "wing_in_length_m" in out["retired"]
def test_규격은_폭_높이_수로_저장_규격_칸은_저장_안_함(out):
assert out["preset"]["state"]["body"][0]["size"] == "2.0×2.0"
assert out["preset"]["out"] == {"body_width_m": 2, "body_height_m": 2, "wing_out": "없음"}
to = out["toPreset"]["out"]
assert to["body_width_m"] == 3 and to["body_height_m"] == 3
assert to["wing_out"] == "흙막이"
assert out["toCustom"]["out"] == {"body_width_m": 2.4, "body_height_m": 1.8}
assert "size" not in json.dumps(out["keys"])
def test_빈_값은_빈_채로(out):
assert out["blank"]["out"] == {}
assert out["blank"]["state"]["body"][0]["size"] == ""
def test_사용자_입력_빈_칸은_다시_열어도_사용자_입력(out):
# 52-19 — 가로만 비움: 세로 손 값이 남아 사용자 입력 + 빈 가로
assert out["oneBlank"]["state"]["body"][0] == {
"size": "사용자 입력",
"width": "",
"height": "2.5",
}
assert out["oneBlank"]["out"] == {"body_height_m": 2.5}
# 둘 다 비움: 표시 키만 적고 다시 열면 사용자 입력 + 빈 칸 둘
assert out["bothBlank"]["out"] == {"body_custom": "사용자 입력"}
assert out["bothBlankAgain"]["state"]["body"][0] == {
"size": "사용자 입력",
"width": "",
"height": "",
}
assert out["bothBlankAgain"]["out"] == {"body_custom": "사용자 입력"}
def test_정의_파일에_이름_표_그룹_선택지가_올라_있음():
names = _node("names")
with open(
os.path.join(ROOT, "resources", "master_template", "구조물정의.json"), encoding="utf-8"
) as f:
doc = json.load(f)
assert set(names) == set(doc["종류"]["box_culvert"]["이름"])
assert [g["id"] for g in doc["그룹"]["box_culvert"]] == ["gboxbody", "gboxin", "gboxout"]
box = next(t for t in doc["types"] if t["type_id"] == "box_culvert")
wing = {o["key"]: o for o in box["options"]}
for key in ("wing_in", "wing_out"):
assert wing[key]["choices"] == ["없음", "날개벽", "흙막이"]