"""756-1 (요구 589-10) — 예정노선 수정 켬 때 등고선 띠: LAS = 자르지 않음 · 도엽 = 계획선 + 예정노선으로 넓힘. ./venv/Scripts/python.exe -m pytest resources/tester/test_756_1_contour_band.py -q """ import json import subprocess from pathlib import Path import pytest ROOT = Path(__file__).resolve().parents[2] B05 = ROOT / "B05_Profile" INPUT = B05 / "B05_Profile_UI_RouteEdit_Input.ts" TS = ROOT / "config" / "node_modules" / "typescript" NODE = """ const fs = require("fs"); const ts = require(process.argv[1]); const js = ts.transpileModule(fs.readFileSync(process.argv[2], "utf8"), { compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 }, }).outputText; const box = { exports: {} }; new Function("exports", "module", "require", js)(box.exports, box, () => new Proxy({}, { get: () => () => {} })); const { sceneContourBand } = box.exports; const toScreen = ([x, y]) => [x, -y]; // 1 px = 1 m const plan = [[0, 0], [100, 0]]; const expected = [[0, 0], [100, 0], [100, 1000]]; const run = (source, dim) => sceneContourBand({ hasMeta: true, contours: { source }, overAll: { dim: () => dim }, expected }, plan, toScreen, 300); console.log(JSON.stringify({ offSheet: run("sheet", 1), onSheet: run("sheet", 0.35), onLas: run("las", 0.35), offLas: run("las", 1), })); """ @pytest.fixture(scope="module") def bands() -> dict: run = subprocess.run( # noqa: S603 — 고정 실행 파일 ["node", "-e", NODE, str(TS), str(INPUT)], capture_output=True, text=True, encoding="utf-8", timeout=60, ) assert run.returncode == 0, run.stderr return json.loads(run.stdout) def test_끈_동안은_계획선_둘레_띠_그대로(bands) -> None: assert bands["offSheet"]["height"] == 600 # 계획선 y 0 ± 300 m assert bands["offLas"] is not None def test_켠_동안_도엽은_예정노선까지_넓힘(bands) -> None: assert bands["onSheet"]["height"] == 1600 # 예정노선 y 0~1000 ± 300 m def test_켠_동안_LAS는_자르지_않음(bands) -> None: assert bands["onLas"] is None