"""PLAN 371-2 — B06 횡단 카드 관 글 L 뒤 기울기(요구 240-16). 규칙: 「관매설 {관종}Φ…m/m, L=8 m (7.6), S=2.5%」(소수 한 자리 · 역경사 0.0) · 툴팁 「매설 경사」 지움 · 세월교 · 박스 흙막이 세트(hidden_pipe = 관 숨김)는 관 글 없음 · B07 덧그림(노폭 라벨 없음)도 없음(225-1). 짝 = `helper_371_2_pipe_slope.cjs`. """ from __future__ import annotations import json import subprocess from pathlib import Path import pytest ROOT = Path(__file__).resolve().parents[2] HELPER = Path(__file__).parent / "helper_371_2_pipe_slope.cjs" pytestmark = pytest.mark.skipif( not (ROOT / "config" / "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_관_글_L_뒤에_기울기_소수_한_자리(out: dict) -> None: slope = f"{out['slopePct']:.1f}" assert out["pipe"]["infos"] == [f"관매설 파형강관 Φ1000m/m, L=8 m (7.5), S={slope}%"] def test_역경사는_0_0(out: dict) -> None: assert out["reverse"]["infos"][0].endswith(", S=0.0%") def test_툴팁에_매설_경사_없음(out: dict) -> None: tips = out["pipe"]["pipeTips"] assert tips and all("매설 경사" not in tip for tip in tips) def test_관_숨김_세트는_관_글_없음(out: dict) -> None: assert out["hidden"] == {"infos": [], "pipeTips": []}