"""PLAN 323-5 고름 한 칸 — 관 세션 id(옮겨도 그대로 · 저장 안 함) · 고름 강조 한 규칙(`pickLights`). - 관 id = 자리마다 차례(`pipe-s1` …) · 같은 자리(PIPE_MATCH_M 안)면 같은 id · 프로젝트 없으면 옛 자리 이름. - 관을 옮기면 id 가 새 자리로 · 그 관을 고른 고름은 자리만 새로(부재키 그대로) · 다른 고름은 그대로. - 강조 = id 둘 다 있으면 id · 아니면 같은 자리 · 고른 부분이 있으면 그 부분만 — 카드 형상 · 3D 같은 함수. - 카드 통째 형상 칠하기는 부분(조정창 부재) · 관 계열 · 포장층을 안 건드림(307). TS 쪽 = `helper_323_5_pick.cjs`(Node). """ from __future__ import annotations import json import subprocess from pathlib import Path import pytest HERE = Path(__file__).parent ROOT = HERE.parent.parent pytestmark = pytest.mark.skipif( not (ROOT / "config" / "node_modules").is_dir(), reason="프론트엔드 의존성 미설치" ) @pytest.fixture(scope="module") def out() -> dict: run = subprocess.run( ["node", str(HERE / "helper_323_5_pick.cjs")], capture_output=True, text=True, encoding="utf-8", timeout=120, check=True, ) return json.loads(run.stdout) def test_session_ids(out: dict) -> None: assert out["ids"] == ["pipe-s1", "pipe-s1", "pipe-s2", 85.05] assert out["legacy"] == ["pipe-85.00", 85, None] def test_move_keeps_id_and_pick(out: dict) -> None: picked, at90, moved_to = out["moved"] assert picked == {"chainageM": 90, "structureId": "pipe-s1", "partKey": "inlet"} assert (at90, moved_to) == ("pipe-s1", 90) other, same = out["other"] assert other["structureId"] == "w1" and other["chainageM"] == 300 and same is True def test_one_highlight_rule(out: dict) -> None: assert out["lights"] == { "idOverPlace": True, "idDiffers": False, "placeNear": True, "placeFar": False, "partOnly": False, "partSame": True, "partNoTag": False, "wholePick": True, "none": False, } def test_card_paint_whole_shapes_only(out: dict) -> None: assert out["paint"] == [[True, False, False, False], [False, False, False, False]]