86 lines
3.3 KiB
Python
86 lines
3.3 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"
|
|
) # 셈 몫 = logic/B06_Section_Cross_Refresh_Calc.ts(511-B B-4 나눔)
|
|
refresh += _read("B06_Section", "logic", "B06_Section_Cross_Refresh_Calc.ts")
|
|
assert "Number(section.ford?.overflow_depth_m) > 0" in refresh
|
|
# 물넘이포장 옛 자리 걷고 새 자리(걸친 측점까지) 얹기 = 형상 얹기 한 벌(323-4 · 모든 열쇠 걷고 다시 ·
|
|
# 동작 시험 = test_323_4_attach_mirror)
|
|
drafts = _read("B06_Section", "B06_Section_Section_Drafts.ts")
|
|
assert "attachShapes(" in drafts
|
|
keys = _read("common_util", "common_util_structure_shape_keys.ts")
|
|
assert '"ford_pavement",' in keys
|