Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EYJJRCfHfdCGNhmXTjQKV7
93 lines
3.7 KiB
Python
93 lines
3.7 KiB
Python
"""배관 유출 「추가 흙막이(단)」 칸 (PLAN 54-27).
|
|
|
|
짝: `B05_Profile/B05_Profile_UI_Drainage_Facility.ts`(유출 상자 안 단 칸 · 흙막이 상자 구조 「흙막이 (기본)」) ·
|
|
`A00_Common/design/design_structure_pipe_calc.ts`(`setPipeExtraCount` = 횡단 조정 단 수와 같은 자리).
|
|
실제 TS 를 `helper_54_27_soil_tier_field.cjs` 가 Node 로 돌린다.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import os
|
|
import subprocess
|
|
|
|
import pytest
|
|
|
|
HERE = os.path.dirname(__file__)
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def out() -> dict:
|
|
proc = subprocess.run( # noqa: S603 — 고정 실행 파일
|
|
["node", os.path.join(HERE, "helper_54_27_soil_tier_field.cjs")],
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
timeout=60,
|
|
)
|
|
assert proc.returncode == 0, proc.stderr
|
|
return json.loads(proc.stdout)
|
|
|
|
|
|
def test_유출_상자_안에_단_칸이_있음(out) -> None:
|
|
assert out["label"] == "추가 흙막이(단)"
|
|
assert out["start"] == {"value": "0", "boxes": 0, "structures": []}
|
|
|
|
|
|
def test_단_수_N_이면_흙막이_상자_N(out) -> None:
|
|
assert (out["set2"]["value"], out["set2"]["boxes"]) == ("2", 2)
|
|
assert (out["set1"]["value"], out["set1"]["boxes"]) == ("1", 1)
|
|
assert (out["set0"]["value"], out["set0"]["boxes"]) == ("0", 0)
|
|
|
|
|
|
def test_지형_한도를_넘으면_세운_만큼(out) -> None:
|
|
assert (out["set5"]["value"], out["set5"]["boxes"]) == ("2", 2)
|
|
|
|
|
|
def test_좌측_칸은_횡단_단_수_자리에_씀(out) -> None:
|
|
assert out["writes"][:4] == [[100, 2], [100, 1], [100, 5], [100, 0]]
|
|
|
|
|
|
@pytest.mark.parametrize("facility", ["ford_bridge", "box_culvert"])
|
|
def test_세월교_박스_유출도_같은_단_칸(out, facility) -> None:
|
|
"""90-1 — 단 수 = 흙막이 상자 수 · 「+ 흙막이」 없음 · 유출이 흙막이 아니면 칸 · 옛 상자 숨김(값 남김)."""
|
|
steps = out[facility]
|
|
assert (steps["set2"]["value"], steps["set2"]["boxes"]) == ("2", 2)
|
|
assert (steps["set0"]["value"], steps["set0"]["boxes"]) == ("0", 0)
|
|
assert steps["set2"]["structures"] == ["형태", "형태"]
|
|
assert not steps["set2"]["hidden"] and not steps["set2"]["add"]
|
|
assert steps["wing"] == {"boxes": 0, "hidden": True, "add": False, "kept": 3}
|
|
assert out["writes"][4:] == [[100, 2], [100, 0]] * 2
|
|
|
|
|
|
def test_횡단에서_바꾸면_좌측_칸이_따라감(out) -> None:
|
|
assert (out["fromCross"]["value"], out["fromCross"]["boxes"]) == ("2", 2)
|
|
|
|
|
|
def test_늘어난_흙막이_상자는_구조_칸_없이_형태부터(out) -> None:
|
|
"""54-30 — 사면안정 흙막이와 같은 칸(형태 · 길이 · 높이 · 전 · 후) · 구조 고르기 없음."""
|
|
assert out["set2"]["structures"] == ["형태", "형태"]
|
|
|
|
|
|
def test_흙막이_아닌_구조면_칸을_가림(out) -> None:
|
|
assert out["otherHidden"] is True
|
|
|
|
|
|
def _src(rel: str) -> str:
|
|
with open(os.path.join(HERE, "..", "..", rel), encoding="utf-8") as f:
|
|
return f.read()
|
|
|
|
|
|
def test_자동_자리_읽기_글이_없음() -> None:
|
|
"""54-28 — 관 길이 · 좌우 바깥 · 상하(사면) 자동 자리 글을 만드는 뿌리(문구 · 줄)가 없음."""
|
|
locale = _src("ui_template/ui_template_locale_b2.ts")
|
|
for key in ("B06_Cross_Revet_Auto", "B06_Cross_Revet_Pipe", "B06_Cross_Lateral_Label"):
|
|
assert key not in locale
|
|
assert "lateralLine" not in _src("B06_Section/B06_Section_UI_Cross_Structure_Panel.ts")
|
|
|
|
|
|
def test_배관_유출_칸은_옛_단_수_줄을_안_받음() -> None:
|
|
dock = _src("B06_Section/B06_Section_UI_Adjust_Dock.ts")
|
|
# 54-29 — 배관 유출 칸 = 집수정 내공 줄만(단 수 · 읽기 · 옵션 줄 안 받음)
|
|
assert 'const PIPE_OUTLET_ROWS = ".b06-structure-panel__struct--basin-size";' in dock
|