"""152-3 도수로 · 돌붙임 띠 — 묻힌 유출 끝 3도 절토선(내림 · 수평)에도 띠 · 오르막 복합경사 절토엔 없음. 화면 TS 를 그 자리에서 돌린 값(`helper_152_3_chute_cut.cjs`) · B06 관 · 흙막이 띠와 3D 띠가 같은 거름. """ import json import subprocess from pathlib import Path import pytest ROOT = Path(__file__).resolve().parents[2] HELPER = Path(__file__).parent / "helper_152_3_chute_cut.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 _src(relative: str) -> str: return (ROOT / relative).read_text(encoding="utf-8") def test_묻힌_흙막이_유출_3도_선에_띠(out: dict) -> None: (cut,) = out["box"]["segments"] assert cut["kind"] == "cut" and not cut["rises"] assert cut["band"] and cut["topIsLine"] # 윗면 = 3도 선 assert cut["below"] == pytest.approx(0.3, abs=0.01) # 선 아래 두께 assert out["box"]["bands3d"] == 1 and out["box"]["bands3dFillOnly"] == 0 def test_배관_묻힌_끝_내림이면_띠_오르막이면_없음(out: dict) -> None: down = out["pipeDown"]["segments"] assert [s["kind"] for s in down] == ["fill", "cut"] assert all(s["band"] for s in down) up = out["pipeUp"]["segments"] assert up[-1]["kind"] == "cut" and up[-1]["rises"] and not up[-1]["band"] assert out["pipeDown"]["bands3d"] == 2 and out["pipeUp"]["bands3d"] == 1 def test_성토만인_측점은_그대로(out: dict) -> None: base = out["pipeBase"] assert base["bands3d"] == base["bands3dFillOnly"] == 2 def test_거름_한_벌_배선() -> None: culvert = _src("B06_Section/B06_Section_UI_Cross_Culvert.ts") assert "layout.outletFill.segments.filter(isChuteSegment)," in culvert corridor = _src("B05_Profile/B05_Profile_UI_Corridor_Structures.ts") flat = " ".join(corridor.split()) assert "chuteBands( layout.outletFill.segments, section.culvert?.chute, isChuteSegment," in flat hatch = _src("B06_Section/B06_Section_UI_Cross_Wall_Hatch.ts") assert '"3도 절토선"' in hatch # 박스 · 세월교 본체 끝은 성토만(3도 규칙 안 넓힘) for name in ("B06_Section_UI_Cross_Box.ts", "B06_Section_UI_Cross_Ford.ts"): assert 'side.fillSegments.filter((s) => s.kind !== "cut")' in _src(f"B06_Section/{name}")