- 구조물정의.json → resources/master_data/구조물정의/구조물정의.json(git mv · 내용 그대로) - 구조물정의_이력/판_1 ~ 22 → resources/master_data/구조물정의/이력/(git mv · 내용 그대로) - 읽는 자리 = B05 Structures_Schema DEFINITION_PATH · HISTORY_DIRNAME · M01_SO_Definition HISTORY - M01 요소 로더 · check_master 는 첫 층 *.json 만 읽음 — 새 폴더는 요소로 안 읽힘(수식문서/ 와 같은 대접) - 시험 · 도우미 · ui_checks 경로 글 고침(파일 이름 그대로) - resources/master_template 에 구조물 정의 자료 남지 않음 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
80 lines
2.9 KiB
Python
80 lines
2.9 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""노면공 › 콘크리트 포장 명세 · 기타 이름(사용자 구조물 표 08) — PLAN 52-10.
|
|
|
|
순수 규칙은 Node 헬퍼(`helper_52_structure_spec.cjs road`)가 돌림 ·
|
|
화면은 ORCA `ui_checks/52-10_노면공_기타.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))
|
|
DEFINITION = os.path.join(ROOT, "resources", "master_data", "구조물정의", "구조물정의.json")
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def out():
|
|
proc = subprocess.run(
|
|
["node", os.path.join(HERE, "helper_52_structure_spec.cjs"), "road"],
|
|
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 {"pipe", "pavement_concrete"} <= set(out["registered"]) # 다른 창 명세도 함께 등록됨
|
|
assert out["same"] is True
|
|
assert out["containers"] == [["detail", "상세 내용", True, "gpavedetail"]]
|
|
|
|
|
|
def test_포장사양_선택지는_명세_한_곳(out):
|
|
assert out["choices"] == ["콘크리트", "아스콘", "쇄석"]
|
|
|
|
|
|
def test_상세내용_차례_포장사양_길이_출력_높이(out):
|
|
assert out["items"] == [
|
|
["spec", "포장사양", "select"],
|
|
["length", "길이 (m)", "auto"],
|
|
["height", "높이 (m)", "number"],
|
|
]
|
|
|
|
|
|
def test_저장_키_왕복_옛_칸은_명세_밖(out):
|
|
assert out["state"] == {"detail": [{"spec": "콘크리트", "height": "0.2"}]}
|
|
assert out["edited"] == {"pave_spec": "콘크리트", "height_m": 0.35}
|
|
assert out["cleared"] == {"pave_spec": "콘크리트"}
|
|
assert out["keys"] == {"keys": ["pave_spec", "height_m"], "prefixes": []}
|
|
# 길이 · 기준측점 전/후는 입력 없음 — 시작 · 종료만 받고 옛 값은 저장 때 뺌(87-1)
|
|
assert out["byRange"] is True
|
|
assert out["dropped"] == ["length_m", "before_m", "after_m"]
|
|
assert "length_m" not in out["retired"]
|
|
assert set(out["retired"]) == {
|
|
"thickness_cm",
|
|
"width_m",
|
|
"widening_area_m2",
|
|
"joint_spacing_m",
|
|
"separation_sheet",
|
|
"wire_mesh",
|
|
}
|
|
|
|
|
|
def test_기타_상세_종류_이름_글_칸():
|
|
with open(DEFINITION, encoding="utf-8") as f:
|
|
doc = json.load(f)
|
|
etc = next(t for t in doc["types"] if t["type_id"] == "etc")
|
|
name = next(o for o in etc["options"] if o["key"] == "name")
|
|
assert name["label"] == "상세 종류 이름" and name["input"] == "text"
|
|
pave = next(t for t in doc["types"] if t["type_id"] == "pavement_concrete")
|
|
keys = [o["key"] for o in pave["options"]]
|
|
assert not {"length_m", "before_m", "after_m"} & set(keys) # 87-1 시작 · 종료 직접 입력
|
|
height = next(o for o in pave["options"] if o["key"] == "height_m")
|
|
assert height["default"] == 0.2
|