Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F3mdb91125mPoC6tpsQx4P
61 lines
2.4 KiB
Python
61 lines
2.4 KiB
Python
"""139-6 노견을 넓힌 유출 쪽 관 길이 자리 — 사면 우선(물매 1:1.2 그대로) + 유출 벽 높이 역산(0.1 m).
|
|
|
|
설계선 엔진으로 노견 확장 설계를 내고 배수관 기하를 돌린 값(`helper_139_6_pipe_fit.cjs` · B07 픽스처
|
|
배관 85.052 · 유출 = 좌). 안 넓힌 측점은 종전 맞춤 그대로(나눔 전 코드와 같은 값 · 5.772 → 표기 6).
|
|
"""
|
|
|
|
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))
|
|
|
|
from config.config_system import STANDARD_CROSS_SECTION # noqa: E402
|
|
|
|
HELPER = Path(__file__).parent / "helper_139_6_pipe_fit.cjs"
|
|
|
|
pytestmark = pytest.mark.skipif(
|
|
not (ROOT / "config" / "node_modules").is_dir(), reason="프론트엔드 의존성 미설치"
|
|
)
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def out(tmp_path_factory) -> dict:
|
|
standard = tmp_path_factory.mktemp("std") / "standard.json"
|
|
standard.write_text(json.dumps(STANDARD_CROSS_SECTION), encoding="utf-8")
|
|
done = subprocess.run( # noqa: S603 — 고정 실행 파일
|
|
["node", str(HELPER), str(standard)],
|
|
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["edge"], base["pureHeight"], base["lengthM"]) == (2, 2, 6)
|
|
assert base["cut"] == pytest.approx(5.772)
|
|
|
|
|
|
@pytest.mark.parametrize("name, extend", [("shifted", 1.0), ("shifted2", 1.3)])
|
|
def test_넓힌_쪽은_물매_그대로_높이_역산(out: dict, name: str, extend: float) -> None:
|
|
case = out[name]
|
|
assert case["edge"] == pytest.approx(2 + extend) and case["extend"] == extend
|
|
assert case["slope"] == pytest.approx(1.2, abs=0.05) # 사면 우선 — 물매 그대로
|
|
assert round(case["pureHeight"] * 10) == pytest.approx(case["pureHeight"] * 10) # 0.1 m 눈금
|
|
assert case["lengthM"] - case["cut"] < 0.1 # 눈금 탓 남는 차만 표기 올림
|
|
assert float(case["lengthM"]).is_integer()
|
|
|
|
|
|
def test_높이가_실제로_바뀜(out: dict) -> None:
|
|
"""대조 — 1.3 m 넓히면 유출 벽 높이가 2.0 → 1.8 로 역산됨(시험이 높이 길을 실제로 잼)."""
|
|
assert out["shifted2"]["pureHeight"] == pytest.approx(1.8)
|