Files
Aislo/resources/tester/test_323_9_twin_cards_3d.py
T
2026-10-14 21:25:41 +09:00

46 lines
1.6 KiB
Python

"""PLAN 323-9 ④-② — 같은 시설을 그리는 카드 둘(같은 m · 노선 끝 EP 꼴 0.01 m 차)이면 3D 몸체가 둘 서던 흠.
3D 몸체는 시설(관 · 세월교 · BOX) 하나에 한 번 — 시설 자리에 가장 가까운 카드만 세움(`ownsBody`).
Node 헬퍼 = `helper_323_9_twin_cards_3d.cjs`(73-4 픽스처 · 진짜 `buildCorridorStructures`).
"""
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_9_twin_cards_3d.cjs")],
capture_output=True,
text=True,
encoding="utf-8",
timeout=120,
check=True,
)
return json.loads(run.stdout)
@pytest.mark.parametrize("at", ["173.087", "352.14"])
def test_twin_cards_build_bodies_once(out: dict, at: str) -> None:
got = out[at]
assert got["one"] and got["twin"] == got["one"]
assert len(got["before"]) == 2 * len(got["one"]) # 고치기 전 = 두 번(시험이 변경을 잼)
# 노선 끝 EP 꼴 — 같은 시설 카드가 소수 차(0.010813 m) · 차례가 바뀌어도 시설 자리에 가까운 카드 하나
assert got["epTwin"] == got["one"] and got["epFirst"] == got["one"]
assert len(got["epBefore"]) == 2 * len(got["one"])
if at == "173.087": # 세월교 관 두 련 — 관 몸체도 한 번
assert sum(k.startswith("pipe:") for k in got["twin"]) == 2