Files
Aislo/resources/tester/test_52_7_safety.py
T
eomsangdonandClaude Opus 5.5 5a85e0b321 feat(B05): 안전부대용지 = 구조물 표 07 — 대피로 · 가드레일 컨테이너 · 점형 일곱 (PLAN 52-7)
- 정의 판 7(판 6 이력) — 대피로(evac_road · 점형 · 상세 = 대피소 · 정차/작업장 · 차돌림곳) · 경계석 · 위험표시 · 취수정 새 키 · 가드레일 = 형태(손 입력) · 길이 · 기준측점 전 · 후 · 대피로 · 가드레일 「상세 내용」 컨테이너(정의 그룹 · 잇기 1)
- 반사경 방향 · 가드레일 옛 종류(kind)는 화면에서 빼고 지난 정의 값으로 남김
- 옛 대피소 · 정차·작업장 · 차돌림곳 = 고르기 목록에서 빼고 대피로 + 상세로 읽음 · 고치기 전까지 옛 종류 그대로 · 고쳐도 옛 칸 값 남김
- 가드레일 길이 = 전 + 후 = 배관 맞물림 solveSplit 그대로
- 컨테이너 종류(정의 그룹 있음)는 종류 단위 잇기 줄 가림 · 가린 시설 폼 칸이 그룹 상자로 딸려 오던 흠 막음
- 집계 알림 「가드레일·경계석·위험표지 종류 미정」 걷음
- 시험 test_52_7_safety · 정책 시험 B05 선택지 27 · ORCA ui_checks/52-7_안전부대용지

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

102 lines
3.4 KiB
Python

# -*- coding: utf-8 -*-
"""안전부대용지(표 07) — PLAN 52-7.
정의(대피로 · 가드레일 컨테이너 · 점형 일곱) · 옛 대피 종류 읽기(`asRoad` · `pickable`) ·
화면은 ORCA `ui_checks/52-7_안전부대용지.js`.
"""
import json
import os
import subprocess
from B05_Profile.B05_Profile_Structures_Schema import structure_type_map
from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition
HERE = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.dirname(os.path.dirname(HERE))
POINTS = [
"mirror",
"curb",
"hazard_sign",
"position_sign",
"water_intake",
"completion_sign",
"barrier_gate",
]
def test_정의_검사_통과():
assert definition.check(definition.read()) == []
def test_컨테이너_없는_일곱은_점형_옵션_없음():
types = structure_type_map()
for tid in POINTS:
t = types[tid]
assert (t.group, t.placement, t.options) == ("E", "point", []), tid
assert [types[t].name for t in ("curb", "hazard_sign", "water_intake")] == [
"경계석",
"위험표시",
"취수정",
]
def test_대피로_가드레일_상세_내용_컨테이너():
doc = definition.read()
groups = doc["그룹"]
assert groups["evac_road"] == [
{"id": "gevacdetail", "이름": "상세 내용", "옵션": ["detail"], "형상": {}}
]
assert groups["guardrail"][0]["옵션"] == ["form", "length_m", "before_m", "after_m"]
types = structure_type_map()
road = types["evac_road"]
assert road.placement == "point"
assert road.options[0].choices == ["대피소", "정차/작업장", "차돌림곳"]
guard = types["guardrail"]
assert guard.name == "가드레일" and guard.placement == "interval"
assert [(o.key, o.input) for o in guard.options] == [
("form", "text"),
("length_m", "number"),
("before_m", "number"),
("after_m", "number"),
]
# 옛 대피 종류는 정의에 그대로(옛 기록 도면 · 집계)
assert {"refuge", "work_yard", "turnaround"} <= set(types)
NODE = r"""
const fs = require("fs"), path = require("path");
const ts = require(path.join(process.argv[1], "config", "node_modules", "typescript"));
const src = fs.readFileSync(
path.join(process.argv[1], "B05_Profile", "B05_Profile_UI_Structures_Define.ts"), "utf8");
const js = ts.transpileModule(src, {
compilerOptions: { module: ts.ModuleKind.CommonJS } }).outputText;
const m = { exports: {} };
new Function("exports", "module", js)(m.exports, m);
const d = m.exports;
process.stdout.write(JSON.stringify({
old: d.asRoad({ type_id: "turnaround", options: { width_m: 10 } }),
other: d.asRoad({ type_id: "mirror", options: { facing: "좌" } }),
pick: ["refuge", "work_yard", "turnaround", "evac_road", "guardrail"].map(
(type_id) => d.pickable({ type_id })),
}));
"""
def test_옛_대피_종류는_대피로_상세로_읽고_목록에서_뺌():
proc = subprocess.run(
["node", "-e", NODE, ROOT],
capture_output=True,
text=True,
encoding="utf-8",
timeout=60,
)
assert proc.returncode == 0, proc.stderr
out = json.loads(proc.stdout)
assert out["old"] == {
"type_id": "evac_road",
"options": {"detail": "차돌림곳", "width_m": 10},
}
assert out["other"] == {"type_id": "mirror", "options": {"facing": "좌"}}
assert out["pick"] == [False, False, False, True, True]