Files
Aislo/resources/tester/test_m02_so_def_spec.py
T
eomsangdonandClaude Opus 5.5 103a207cee feat(M02): 구조물 옵션 정의 = 명세 이름 고치기 칸(명세 있는 종류 · 52-11)
- 명세가 있는 종류(STRUCTURE_SPECS)는 컨테이너 제목 › 항목 이름 › 값 이름 나무 · 이름만 고침 · 키 · 필수/선택 · 꼴은 읽기만
- 필수 컨테이너 제목 = 정의 그룹 이름 자리 · 나머지 = 종류.이름 표(B05 · B06 그리기와 같은 차례)
- 미리보기 = B05 · B06 명세 폼에 고친 이름 · 빈 이름은 저장 막음 · [저장] = 새 판 + 이력(48장 길 그대로)
- 옛 편집기(옵션 · 배치 · 그룹 · 규칙 · 기준 측점)는 명세 종류에서 숨김 · 명세 없는 종류는 그대로
- 시험: test_m02_so_def_spec(정의 사본) · ui_checks/52-11_정의_이름고치기

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

59 lines
2.0 KiB
Python

"""M02 구조물 명세 이름 고치기(`M02_SO_Def_Spec_Model.ts` · PLAN 52-11) 단위검증.
Node 헬퍼(`helper_m02_so_def_spec.cjs`)가 TS 를 트랜스파일해 진짜 정의 사본(메모리)으로 돌리고
pytest 는 그 결과(JSON)를 판정.
못박는 것
- 배관 명세 나무: 컨테이너 5 · 항목 · 값 줄 · 이름 키 겹침 없음 · 필수/선택 · 꼴 표시.
- 필수 컨테이너 제목은 정의 그룹 이름에 씀 · 항목 · 값 · 선택 컨테이너는 이름 표에 씀.
- 이름만 바뀜 — types(옵션 · 키) 그대로 · 이름 표에 없는 키를 새로 만들지 않음.
- 이름 표가 빈 종류는 명세 글로 읽음.
"""
from __future__ import annotations
import json
import subprocess
from pathlib import Path
import pytest
HERE = Path(__file__).resolve().parent
@pytest.fixture(scope="module")
def r() -> dict:
proc = subprocess.run(
["node", str(HERE / "helper_m02_so_def_spec.cjs")],
capture_output=True,
text=True,
encoding="utf-8",
timeout=60,
)
assert proc.returncode == 0, proc.stderr
return json.loads(proc.stdout)
def test_배관_나무(r) -> None:
assert r["levels"][0] == 5
assert r["levels"][1] > 5 and r["levels"][2] > 10
assert r["unique"] is True
assert r["pipeTitle"]["tag"] == "required" and r["pipeTitle"]["group"] == "grv6lny"
assert r["optional"]["tag"] == "optional" and r["optional"]["group"] is None
assert r["basinForm"]["label"] == "I형" and r["basinForm"]["key"] == "I"
def test_이름_고침_자리(r) -> None:
assert r["groupName"] == "관 본체"
assert r["names"] == [None, "관 지름", "Ø800", "흙막이 더"]
assert r["reread"] == ["관 본체", "관 지름", "Ø800", "흙막이 더"]
def test_구조는_그대로(r) -> None:
assert r["sameTypes"] is True and r["sameKeys"] is True
def test_이름_표_없는_종류(r) -> None:
assert r["bareLabel"] == "흙막이"
assert r["bareGroup"] == "유입"