Files
Aislo/resources/tester/test_80_ford_pipe.py
T

77 lines
2.8 KiB
Python

"""80 세월교 · 박스 흙막이 — 세월교 안은 관이라 1 m 단위 · 관이 흙막이 안까지 · 흙막이를 옮기면 본체가 따라감.
화면 TS 를 그 자리에서 돌린 값(`helper_80_ford_pipe.cjs`) · 픽스처 = 73-4 세월교 173.09 · 박스 352.14.
"""
import json
import subprocess
import sys
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[2]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
HELPER = Path(__file__).parent / "helper_80_ford_pipe.cjs"
NODE_MODULES = ROOT / "config" / "node_modules"
pytestmark = pytest.mark.skipif(not NODE_MODULES.is_dir(), reason="프론트엔드 의존성 미설치")
@pytest.fixture(scope="module")
def fit() -> dict:
done = subprocess.run( # noqa: S603 — 고정 실행 파일
["node", str(HELPER)], cwd=str(ROOT), capture_output=True, text=True, encoding="utf-8"
)
assert done.returncode == 0, done.stderr
return json.loads(done.stdout)
def _whole(length: float) -> bool:
return abs(length - round(length)) < 1e-3
def test_기본_자리_관_길이는_1m_단위(fit: dict) -> None:
for case in ("both", "inletOnly"):
assert _whole(fit[case]["lengthM"]), fit[case]
assert fit[case]["label"].endswith(f"L{round(fit[case]['lengthM'])}m")
def test_관은_흙막이_전면까지_바닥판은_배면까지(fit: dict) -> None:
for case in (fit[k] for k in ("both", "inletPlus1", "outletPlus2", "inletOnly")):
for side in case["sides"]:
if side["guard"]:
assert side["pipeGap"] == pytest.approx(0, abs=1e-3)
assert side["slabGap"] == pytest.approx(0, abs=1e-3)
def test_관_윗모서리도_흙막이_전면_사면에(fit: dict) -> None:
"""89-1 — 흙막이 사면 이용: 윗모서리가 그 높이 전면 자리라 벽 밖으로 안 튀어나감."""
leaned = 0
for case in (fit[k] for k in ("both", "inletPlus1", "outletPlus2", "inletOnly")):
for side in case["sides"]:
if side["guard"]:
assert side["topGap"] == pytest.approx(0, abs=1e-3)
leaned += side["lean"] > 0
assert leaned
def test_흙막이를_옮기면_관이_그만큼_따라감(fit: dict) -> None:
base = fit["both"]["lengthM"]
assert fit["inletPlus1"]["lengthM"] == pytest.approx(base + 1, abs=1e-3)
assert fit["outletPlus2"]["lengthM"] == pytest.approx(base + 2, abs=1e-3)
def test_흙막이_없는_쪽은_그대로(fit: dict) -> None:
assert [s["guard"] for s in fit["inletOnly"]["sides"]] == [True, False]
def test_박스도_흙막이를_밀면_본체가_따라감(fit: dict) -> None:
assert fit["boxAuto"]["gaps"] == [0, 0]
assert fit["boxInletPlus1"]["gaps"] == [0, 0]
assert fit["boxInletPlus1"]["bodyLengthM"] == pytest.approx(
fit["boxAuto"]["bodyLengthM"] + 1, abs=1e-3
)