Files
Aislo/resources/tester/test_314_stale_structure.py
T
eomsangdonandClaude Opus 5.5 bbd6254892 feat(구조물표): 322-1 부품 상자 · 표 읽기 — 목록 · 측점 · 카드 이름 · 형상 고르기 · 3D 몸체 · 알약 띠가 종류 키 · 군 글자 · 자리꼴 · managed_by 대신 구조물 표(catalog) 한 줄을 읽음 · 코드 숨김 목록 걷음 · ★ 넷 + 관 공식 한 벌
- 부품 상자 common_util_structure_parts.json(갈래마다 부품 · 읽는 칸 · 자리꼴 · 정본 · 42종 처음값) · 표 읽기 common_util_structure_catalog.ts / .py 짝(정의 반영 ⊕ 처음값 ⊕ 부품 끔) · 거울 시험 test_322_1_catalog_mirror
- 목록: pickGroups 군 차례 = 구조물군 열쇠 · 페이지 거르기 listPick(B05 both · B06 both + b06) · HIDDEN_PICK_GROUPS · HIDDEN_PICK_TYPES · pickable 걷음(옛 대피 셋 asRoad 그대로)
- 측점: structureStationMarks · pipeStationMarks · is_station_planting_type · resolve_extra_stations = 표 횡단도(anchor · span3 · none)
- 카드 이름: cardTitle / card_title 한 공식(빈칸 = 그 종류 정의 기본값) · 표시 이름이 정의 관종도 앎
- 형상: 벽 = shape wall(형태 = 형상칸.form · 물빼기 = 형상칸.weep) · 포장 = shape pavement(「사용 중」 거르기 없앰) · 맹암거 · 사토 · 관 지점 시설 세트 = shape
- 3D 몸체 = 그림 자료 주인 종류의 표 3D 부품 · 알약 띠 = 표 자리꼴 구간(관 지점 시설은 알약만)
- ★1 노출형 · 개거 횡단도 none · ★2 쇄석 화면에서도 포장층 · ★3 기슭막이 표 자리꼴 interval(정의 파일 그대로) · ★4 코드 숨김 10종 list hidden · ★5 관 빈칸 D800 → 정의 기본 D1000
- 옛 시험: 도움 파일 로더 27개가 표 모듈 공용 한 벌(helper_322_catalog_module) 씀 · 기대값 고침(272_1 · b05_extra_stations · roundtrip · 314 · 52_7 · walls 거울 · wall_drain_pipe)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ji4nuyLVHcxrXWHTdb5nRD
2026-10-14 15:09:45 +09:00

82 lines
3.0 KiB
Python

"""PLAN 314 — 물넘이포장 · 맹암거 후속(요구 210 · 211).
- 314-1 · 314-2 · 314-4 저장 전에 놓거나 · 옮기거나 · 종류를 바꾼 구조물 자리 = 저장분 횡단 값(포장 · 기울기 ·
세월교 노면 하강)과 얹힌 제원이 다르면 낡음 → 다시 셈(서버 `_enforce_stored_designs` 짝) ·
물넘이포장 옛 자리 걷고 새 자리(걸친 기존 측점까지) 얹음
- 314-3 월류 높이 기다림 = 빈 글자도 빈칸(채우는 쪽과 같은 규칙)
실제 TS 를 `helper_314_stale_structure.cjs` 가 Node 로 돌린다.
"""
from __future__ import annotations
import json
import os
import subprocess
import pytest
HERE = os.path.dirname(__file__)
ROOT = os.path.join(HERE, "..", "..")
pytestmark = pytest.mark.skipif(
not os.path.isdir(os.path.join(ROOT, "config", "node_modules")),
reason="프론트엔드 의존성 미설치",
)
def _read(*parts: str) -> str:
with open(os.path.join(ROOT, *parts), encoding="utf-8") as handle:
return handle.read()
@pytest.fixture(scope="module")
def result() -> dict:
out = subprocess.run(
["node", os.path.join(HERE, "helper_314_stale_structure.cjs")],
capture_output=True,
text=True,
encoding="utf-8",
timeout=120,
check=True,
)
return json.loads(out.stdout)
def test_tilt_mismatch_is_stale(result: dict) -> None:
# 물넘이포장 · 맹암거 자리인데 저장분이 안 기울었음(측구 있음) = 낡음 · 맞으면 그대로
assert result["ford_untilted"] is True
assert result["ford_tilted"] is False
assert result["underdrain_tilted"] is False
# 구조물이 떠났는데 저장분이 아직 기울었음(옮김 · 종류 바꿈) = 낡음
assert result["left_tilted"] is True
def test_paved_and_surface_drop_mismatch_is_stale(result: dict) -> None:
assert result["pavement_unpaved"] is True
assert result["ford_drop_missing"] is True
assert result["ford_drop_kept"] is False
assert result["plain"] is False
def test_ford_height_wait_treats_blank_as_empty(result: dict) -> None:
waits = result["waits"]
assert waits["pave_empty"] is True
assert waits["pave_blank"] is True
assert waits["pave_set"] is False
assert waits["bridge_none"] is True
assert waits["pipe"] is False
def test_structure_change_reconciles_and_ford_reattach() -> None:
view = _read("A00_Common", "design", "design_view_cross.ts")
body = view.split("async function refreshDetailForStructures", 1)[1].split("\n }\n", 1)[0]
assert "void reconcileStaleDesigns();" in body
refresh = _read("B06_Section", "B06_Section_Cross_Refresh.ts")
assert "Number(section.ford?.overflow_depth_m) > 0" in refresh
store = _read("B06_Section", "B06_Section_Section_Store.ts")
kinds = store.split("async function withDraftPipeKinds", 1)[1].split("\n}\n", 1)[0]
assert "if (!pipes) return;" in kinds
assert "delete section.ford_pavement" in kinds
assert 'if (!here.length) return shapeOf(pipe.facility) === "ford_pavement";' in kinds