Files
Aislo/resources/tester/test_139_3_ford_level.py
T

56 lines
2.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""139-3 세월교 수평 — 바닥판 표고 하나 · 좌우만(도로 쪽 금지) · 내림 = 양쪽 한 값 · 아래로만 · 옛 값 옮김.
화면 TS(`_Cross_Ford_Geom`)를 그 자리에서 돌린 값(`helper_139_3_ford_level.cjs` · 73-4 픽스처 세월교 173.087).
"""
import json
import subprocess
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[2]
HELPER = Path(__file__).parent / "helper_139_3_ford_level.cjs"
NODE_MODULES = ROOT / "config" / "node_modules"
pytestmark = pytest.mark.skipif(not NODE_MODULES.is_dir(), reason="프론트엔드 의존성 미설치")
@pytest.fixture(scope="module")
def out() -> 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 test_바닥판_하나_관_수평_벽높이는_결과(out: dict) -> None:
base = out["base"]
assert base["slab"][0] == base["slab"][1] == base["pipeEnds"][0] == base["pipeEnds"][1]
# 낮은 노견 쪽 = 관경 + 토피(1.5) · 높은 쪽은 노견 차만큼 더 김 · 벽 윗면 = 그 쪽 노견
assert min(base["heights"]) == pytest.approx(1.5)
assert base["heights"][1] - base["heights"][0] == pytest.approx(
base["tops"][1] - base["tops"][0], abs=1e-3
)
def test_내림은_양쪽_한_값_아래로만(out: dict) -> None:
assert out["drop"]["slab"] == [pytest.approx(out["base"]["slab"][0] - 0.4)] * 2
assert out["drop"]["tops"] == out["base"]["tops"] # 벽 윗면은 노견에 그대로
assert out["up"] == out["base"] # 기본 자리 위 금지 — 음수 내림 = 0
def test_좌우만_도로_쪽_금지(out: dict) -> None:
lat, base = out["lateral"], out["base"]
assert lat["slab"] == base["slab"]
assert abs(lat["wallX"][0] - base["wallX"][0]) == pytest.approx(1.0) # 바깥 1 m
assert lat["wallX"][1] == base["wallX"][1] # 안쪽 −2 = 0 에서 멈춤
def test_옛_값은_평균_내림으로_옮김(out: dict) -> None:
"""유입 높이 2.1(기본 1.5 + 0.6) · 유출 대각 1.2(수직 1.0) + 노견 차 0.12 → (0.6 + 0.88) / 2 = 0.74."""
old = out["old"]
assert old["dropM"] == pytest.approx(0.74, abs=1e-3)
assert old["slab"][0] == old["slab"][1]