Files
Aislo/resources/tester/test_514_2_stale_flow.py
T

61 lines
2.2 KiB
Python

"""514-2 배수유역도 낡은 동안 관 카드 설계유량 「낡음」 가림(요구 328-3).
판정 한 곳 = 배수유역 판 `live.stale` → `setDrainageStale` · 세월교 · 물넘이 칸 안내 · 높이 자동값이 그것을 봄.
"""
import json
import subprocess
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[2]
HELPER = Path(__file__).with_name("helper_514_2_stale_flow.cjs")
STALE_HINT = "설계유량 낡음 — 배수유역도 [업데이트] 뒤 셈"
def _read(*parts: str) -> str:
return (ROOT.joinpath(*parts)).read_text(encoding="utf-8")
@pytest.fixture(scope="module")
def run() -> dict:
out = subprocess.run(["node", str(HELPER)], capture_output=True, check=True, cwd=ROOT).stdout
return json.loads(out.decode("utf-8"))
def test_안_낡으면_값(run):
assert run["fresh"]["hint"].startswith("필요 수심 ")
assert run["fresh"]["height"] != ""
def test_낡으면_가림_높이_안_채움(run):
stale = run["stale"]
assert stale["refreshed"] == 1 # 열린 폼 다시 그림
assert stale["hint"] == STALE_HINT
assert stale["height"] == "" and stale["afterFill"] == ""
assert stale["repaintSame"] == 0
def test_업데이트_뒤_값(run):
back = run["back"]
assert back["repaint"] == 1
assert back["hint"].startswith("필요 수심 ")
assert back["afterFill"] != "" # 기다리던 새 시설 높이 = 그때 채움
def test_판정은_배수유역_판_한_곳():
live = _read("B05_Profile", "B05_Profile_UI_Drainage_Live.ts")
assert "setDrainageStale(stale);" in live
panel = _read("B05_Profile", "B05_Profile_UI_Drainage_Panel.ts")
assert "!live.stale && fillFordHeights(" in " ".join(panel.split())
def test_B06_폼도_업데이트_뒤_새_유량():
b06 = " ".join(_read("B06_Section", "B06_Section_UI_Page_Structures_Panel.ts").split())
assert "design_flow_m3s: flowAt(pipe.chainage_m, pipeResponse.basins)," in b06
assert "const live = deps.shared.lastPipes;" in b06
assert "entry.design_flow_m3s = flow;" in b06 # adoptFordHeights 가 새 답 유량을 받음
view = _read("B06_Section", "B06_Section_UI_Section_View_Profile.ts")
assert "p.design_flow_m3s ?? null," in view # 유량만 바뀌어도 pipesChanged