Files
Aislo/resources/tester/test_b05_structures_define.py
T
eomsangdonandClaude Opus 5.5 4b796e508e merge: main_laptop_1 665ccf777 — 52-7 충돌 = 양쪽 다 살림
- Panel_Options = 메인 hidesTypeSummary 세 조건(명세 · 정의 그룹 · 종단배수) + 가드레일 solveSplit · 옛 hasSpecContainers 걷음
- 구조물정의.json = 대피로 · 가드레일 · 맹암거 그룹 다 · 판 9
- 이력 판_6 = 메인 것(바탕 판 6 그대로) · 네 판_6 은 판_8 로
- 52-8 숨김(군 단위)과 대피로 목록 빼기(종류 단위)는 자리가 달라 둘 다 둠
- 시험 수 = B05 선택지 28 · 정의 종류 42

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

81 lines
2.7 KiB
Python

# -*- coding: utf-8 -*-
"""B05/B06 「구조물 배치」 칸 = 구조물 정의대로 — PLAN 48-3 · 48-4 (2026-10-05).
정의(`구조물정의.json`)가 주는 차례 · 배치 격자 · 안 씀(`enabled:false`) · 규칙(상위 값 → 하위
선택지 · 보이기 · 기본값) · 지난 정의 값 · 그룹 형상 칸 · 정의 덧칸 얹기를 본다.
판 1 정의로는 지금 화면과 같음(차례 그대로 · 2열 · 기준 측점 보임).
순수 규칙은 Node 헬퍼(`helper_b05_structures_define.cjs`)가 돌림 · 화면은 ORCA `ui_checks/48-3_구조물배치_정의그리기.js`.
"""
import json
import os
import subprocess
import pytest
HERE = os.path.dirname(os.path.abspath(__file__))
@pytest.fixture(scope="module")
def out():
proc = subprocess.run(
["node", os.path.join(HERE, "helper_b05_structures_define.cjs")],
capture_output=True,
text=True,
encoding="utf-8",
timeout=60,
)
assert proc.returncode == 0, proc.stderr
return json.loads(proc.stdout)
def test_차례는_배치_줄_칸_뒤는_정의_차례_안씀_숨김_뺌(out):
assert out["order"] == ["t", "p", "q"]
def test_격자_칸수와_자리(out):
assert out["columns"] == 2
assert out["columnsNone"] == 2
assert out["placeT"] == {"row": "1", "column": "1 / span 2"}
assert out["placeNone"] is None
def test_규칙_선택지_보이기_사슬(out):
assert out["stateA"]["q"]["choices"] == ["b", "c"]
assert out["stateA"]["t"]["visible"] is False # q=c → t 가림
assert out["stateB"]["q"]["visible"] is False # p=b → q 가림
assert out["stateB"]["t"]["visible"] is True # 가려진 q 에 매인 줄은 안 걸림
def test_규칙_기본값(out):
assert out["defaultsA"] == {"q": "c"}
assert out["defaultsB"] == {}
def test_지난_정의_값(out):
assert out["stale"] == [["old_key", 3]]
def test_그룹_형상_칸(out):
assert [s["suffix"] for s in out["shapes"]] == ["length_m", "after_m"]
assert out["shapes"][0]["meaning"] == "연장"
assert out["shapeKey"] == "g1__length_m"
def test_정의_덧칸_얹기(out):
assert out["withNull"] == [{"type_id": "a", "group": "A"}]
t = out["withDef"][0]
assert t["group_name"] == "가 군"
assert t["show_anchor"] is False
assert t["behaviors"] == ["계곡통과시설"]
assert t["spots"] == {"k": {"줄": 1, "칸": 1}}
assert [r["종류"] for r in t["rules"]] == ["a"]
assert t["groups"][0]["shape"] == {"길이": {"받기": True}}
def test_판1_정의는_지금_화면과_같음(out):
assert out["v1Types"] == 42 # 52-6 맹암거 · 52-7 대피로 · 경계석 · 위험표시 · 취수정
assert out["v1Same"] is True
assert out["v1Columns"] == [2]
assert out["v1Anchor"] is True