Files
Aislo/resources/tester/test_368_2_plus_stations.py
T
eomsangdonandClaude Opus 5.5 4b6800e387 feat(472-6 6-B 노선 바뀐 [저장] 한 본문): 노선 저장 · 관 · 구조물 다시 얹기 · 횡단 고침 넘김을 서버 한 창구로 — 전부 아니면 없음
- POST /design/save 에 route(노선 초안) · carry(옛 노선 세션 칸) 칸 · 서버 = 노선 저장 → Node facility.rebase(rebasePipeDraft · rebaseStructureDraft) → 6-A 차례(새 노선) → Node stations.carry(routeCarryPatches) → 횡단 저장
- 되돌림 범위 = 노선 행 · 자식 표 · 단계 · 배수 폴더 · 노선 파일 · 지표면 확정(설계 지형 바꿈)
- 손 상단측은 안 넘김(요구 274) · 노선 바뀐 [확정] = [저장](새 노선 본 뒤 다시)
- 브라우저 = 노선 초안 + 사용자 칸만 한 본문 · 옛 차례 길(saveRouteDraft 뒤 flush · carryAfterRouteSave · keepDraftsOnNewRoute) · 부름 0 된 flush 창구 여섯 · saveCachedCrossPatches 걷음
- 등록부 R9 stations.carry · F10 facility.rebase · 옛 차례 단언 시험 한 본문 꼴로 · test_472_6_route_save(옛 길 = 새 길 · 실패 되돌림)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 12:07:12 +09:00

50 lines
2.3 KiB
Python

"""368-2 추가 측점 정본(`plus_stations.json`) — 정수 m · 좌표 · 노선 바뀌면 좌표로 따라감 · 저장 차례."""
from __future__ import annotations
from pathlib import Path
from B05_Profile.B05_Profile_Plus_Stations import (
follow_plus_stations,
load_plus_stations,
plus_chainages,
save_plus_stations,
)
ROOT = Path(__file__).resolve().parents[2]
LINE = [(0.0, 0.0, 0.0), (100.0, 0.0, 0.0)]
def test_저장_정수_m_좌표_노선_안(tmp_path: Path) -> None:
saved = save_plus_stations(tmp_path, [12.4, 47.0, 47.2, -3.0, 140.0], LINE)
assert saved == [12.0, 47.0] # 반올림 · 같은 m 하나 · 노선 밖 버림
rows = load_plus_stations(tmp_path)
assert [(r["chainage_m"], r["x"], r["y"]) for r in rows] == [
(12.0, 12.0, 0.0),
(47.0, 47.0, 0.0),
]
assert save_plus_stations(tmp_path, [], LINE) == [] and plus_chainages(tmp_path) == []
def test_노선이_바뀌면_좌표로_따라감(tmp_path: Path) -> None:
save_plus_stations(tmp_path, [12.0, 47.0], LINE)
# 시점을 10 m 앞으로 늘린 새 노선 — 같은 땅 자리 = 누가거리 +10
moved = follow_plus_stations(tmp_path, [(-10.0, 0.0), (100.0, 0.0)])
assert moved == 2 and plus_chainages(tmp_path) == [22.0, 57.0]
def test_저장_차례_계획고_앞() -> None:
# 472-6 — 차례 = 한 본문 칸 차례(브라우저) · 서버 한 창구 차례
api = (ROOT / "A00_Common/design/design_save_api.ts").read_text(encoding="utf-8")
order = api[api.index("SAVE_PART_KEYS = [") :]
assert order.index('"structures"') < order.index('"plusStations"') < order.index('"alignment"')
server = (ROOT / "B06_Section/B06_Section_Router_DesignSave.py").read_text(encoding="utf-8")
assert server.index('step("structures"') < server.index('step("plusStations"')
assert server.index('step("plusStations"') < server.index('step("alignment"')
def test_옛_측점_옮기기는_추가_측점을_구조물로_안_만듦() -> None:
# 저장된 추가 측점 = 이름 "" 비정규 측점 — 옛 자유 글 옮기기가 「기타」 구조물로 바꾸면 안 됨
router = (ROOT / "B05_Profile/B05_Profile_Structures_Router.py").read_text(encoding="utf-8")
block = router[router.index("async def migrate_structures") :]
assert "plus_chainages(root)" in block[: block.index("migrate_irregular_stations(")]