Files
Aislo/resources/tester/test_346_2_station_swap.py
T
eomsangdonandClaude Opus 5.5 e51dd2a801 fix(450 B06 측점 갈아끼움): MC 곡선 열쇠 이음 · 자리 같은 단면 서버 표본 유지 · 구간값 죽은 길 걷음 · 표 위 CAD 한도
- 433-4 갈아끼움이 curveMoves 거꾸로 맵으로 옛 MC 횡단을 이어 받음 — 설계 · 측점 id · moves 짝 남음
- 433-11 자리 · 축 같은 앞 단면은 지반 표본 · 상단측 · 중심고 그대로 — 덧 측점 넣기 · 빼기 뒤 누가토량 = 서버
- 433-19 Span_Control.update(culvertopt 큐) 걷음 — 구간 줄은 다단 벽만
- 433-20 표 위 CAD 요소 2000 넘음 = 초안에 안 씀 · 알림(서버 max_length 짝)
- 시험 test_433_4 · test_433_11 · test_433_19_20 새로 · 346_2 단언 · 440 헬퍼 로더 맞춤

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 21:34:51 +09:00

133 lines
5.0 KiB
Python

# -*- coding: utf-8 -*-
"""346-2 4파 — 측점 수가 바뀔 때 횡단 목록 갈아끼움.
못박는 것
- 측점 셋 늘고 둘 빠진 목록 → 새 상세 객체(카드 8 · 종단 측점 8) · 이어 받은 측점은 설계 그대로 ·
새 측점은 지반 표본 + 기본 설계 · 옛 상세는 그대로 · 같은 목록이면 안 갈아끼움.
- 가게 `stations` → 캐시 상세 갈아끼움 · 듣는 쪽에 새 상세 + 누가거리 옮김 ·
카드 선택은 측점 열쇠로 새 자리(관 45.054 → 47 m) · 노선 모양이 바뀌면 넘김 규칙
(단면 유형 버림) · 사라진 측점 고침 버림 · 조정창 값도 옮긴 자리로.
- 종단 보기(B05) · 3D 측점선 — 횡단 보기를 안 열어도 가게 측점으로 갈아끼움 · 보일 때만 다시 그림.
- 보이는 카드 먼저 — 보이는 줄 + 한 줄만 바로.
- `formatStation` ↔ 파이썬 `format_station` 같은 글.
Node 헬퍼 `helper_346_2_station_swap.mjs` 가 vite ssr 로 묶은 진짜 모듈
(`helper_346_2_swap_entry.ts`)을 부름.
"""
import json
import shutil
import subprocess
import sys
from pathlib import Path
import pytest
HERE = Path(__file__).resolve().parent
ROOT = HERE.parents[1]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from B05_Profile.B05_Profile_Engine_Sections_Core import format_station # noqa: E402
@pytest.fixture(scope="module")
def out(tmp_path_factory):
work = tmp_path_factory.mktemp("b346")
build = subprocess.run(
[
"node",
str(ROOT / "config" / "node_modules" / "vite" / "bin" / "vite.js"),
"build",
"--configLoader",
"runner",
"--ssr",
"../resources/tester/helper_346_2_swap_entry.ts",
"--outDir",
str(work),
"--logLevel",
"error",
],
cwd=ROOT,
capture_output=True,
text=True,
encoding="utf-8",
timeout=300,
)
assert build.returncode == 0, build.stderr
bundle = work / "bundle.mjs"
shutil.copy(work / "helper_346_2_swap_entry.js", bundle)
proc = subprocess.run(
["node", str(HERE / "helper_346_2_station_swap.mjs"), str(bundle)],
cwd=ROOT,
capture_output=True,
text=True,
encoding="utf-8",
timeout=120,
)
assert proc.returncode == 0, proc.stderr
return json.loads(proc.stdout)
def test_셋_늘고_둘_빠진_목록으로_갈아끼움(out):
pure = out["pure"]
assert pure["count"] == 8 and pure["longCount"] == 8
assert pure["added"] == ["structure:st-1", "structure:st-2", "structure:st-3"]
assert pure["removed"] == ["grid:2", "grid:4"]
assert pure["moves"] == {"45.05": "47.00", "100.00": "90.00"}
assert pure["keptMark"] == [
"old-0",
"old-20",
"old-45.054",
None,
"old-60",
None,
None,
"old-100",
]
assert pure["kinds"] == [
"bp",
"regular",
"irregular",
"irregular",
"regular",
"irregular",
"irregular",
"ep",
]
assert pure["labels"] == ["STA.0+047.000", "STA.0+090.000"]
# 자리 같은 앞 단면 = 앞 표본(서버 정본 · 433-11) · 옮긴 측점 = 새 지반 표본
assert pure["samples"] == [0]
assert pure["movedSamples"] == [-0.5, 0, 0.5]
assert pure["oldUntouched"] is True and pure["length"] == 90
assert pure["same"] is False and pure["sameSelf"] is True
def test_측점_글_파이썬과_같음(out):
assert out["format"] == [format_station(c) for c in (0, 45.054, 1234.5)]
def test_가게_측점으로_상세_갈아끼움_열쇠로_이어_받기(out):
store = out["store"]
assert store["replaced"] is True and store["count"] == 8
assert store["heard"] == [{"count": 8, "moves": {"45.05": "47.00", "100.00": "90.00"}}]
# 관 고침은 47 m 로 · 노선 모양이 바뀌어 단면 유형은 버림 · 40 m(grid:2) 고침은 노선 밖
assert store["choices"] == [[20, "soil", None], [47, "blasting_rock", None]]
assert store["rawKeys"] == ["grid:1", "pipe:pipe-s1"]
assert store["widths"] == {"47.00": 12, "47.00:outlet": 3, "20.00": 8}
assert store["redraws"] == 1 # 보이는 횡단 보기 = 카드 · 그림 한 번 다시
assert store["again"] is True # 같은 목록 = 안 갈아끼움
def test_종단_보기_3D_측점선도_새_목록_보일_때만(out):
profile = out["profile"]
assert profile["afterShown"] == [7, 8] # 처음 7 → 가게 측점으로 갈아끼움 8(횡단 보기 없이)
assert profile["whileHidden"] == [7, 8] # 숨은 동안은 안 그림
assert profile["afterShow"] == [7, 8, 6] # 다시 보일 때 새 목록(6)
assert profile["lines"] == 3 # 3D 측점선도 같은 차례로 다시
def test_보이는_카드_먼저(out):
assert out["eager"] == [12, 27, 4] # 3열 · 600 px · (250+12) px 줄 = 3 줄 + 1
assert out["rename"] == {"47.00": 1, "b47.00": 2, "47.00:outlet": 3, "60.00": 4}