Files
Aislo/resources/tester/test_173_7_inlet_animal.py
T

52 lines
1.8 KiB
Python

"""173-7 · 177-2 집수정 「동물이동형」 칸 — 고르기 유 / 무 · 저장 키 inlet_basin_animal("true"/"false") · 빈 값 = 유.
공용 명세 폼(`design_structure_form.ts`)을 그 자리에서 돌린 값(`helper_173_7_inlet_animal.cjs`)
+ 배관 폼 키 목록(`B05_Profile_UI_Drainage_Facility_Merge.ts`).
"""
import json
import subprocess
from pathlib import Path
import pytest
HERE = Path(__file__).parent
ROOT = HERE.parents[1]
@pytest.fixture(scope="module")
def out() -> dict:
if not (ROOT / "config" / "node_modules").is_dir():
pytest.skip("의존성 미설치")
done = subprocess.run( # noqa: S603 — 고정 실행 파일
["node", str(HERE / "helper_173_7_inlet_animal.cjs")],
capture_output=True,
text=True,
encoding="utf-8",
)
assert done.returncode == 0, done.stderr
return json.loads(done.stdout)
YU_MU = [["true", "유"], ["false", "무"]]
def test_빈_값은_유_실제_값으로_적힘(out: dict) -> None:
# 177-2 — 필수 상자 빈 고르기 칸 = 기본값을 실제 값으로(54-43) · 옛 「저장 안 함」 뒤집음
assert out["blank"] == {"value": "true", "options": YU_MU, "saved": "true"}
def test_무면_false_다시_유면_true(out: dict) -> None:
assert out["off"] == {"value": "false", "options": YU_MU, "saved": "false"}
assert out["on"] == {"value": "true", "options": YU_MU, "saved": "true"}
assert out["storedOff"] == {"value": "false", "options": YU_MU, "saved": "false"}
def test_흙막이엔_칸_없음(out: dict) -> None:
assert out["soil"] == {"shown": False, "saved": None}
def test_배관_폼_키_목록에_새_키() -> None:
merge = (ROOT / "B05_Profile" / "B05_Profile_UI_Drainage_Facility_Merge.ts").read_text("utf-8")
assert '"inlet_basin_animal"' in merge