Files
Aislo/resources/tester/test_509_2_sheet_grid.py
T
eomsangdonandClaude Opus 5.5 4eec3a4b37 feat(509-5 · 509-2 B05 추천 지형): 분석 지형 고르기 = 추천 노선 창 안 · 지형마다 추천 미리 셈 · [적용] = 창 지형이 설계 지형 · 평면은 지형 이름만 · 설계 지형 격자 하나(수치지형도 적용이면 그 격자)
- 전처리 미리 셈이 고를 수 있는 지형마다(설계 지형 먼저 · 수치지형도는 DB 모델 있을 때만) 다섯 갈래 + 초기 종단
- 창 지형 바꿈 = 그 지형 저장본만 · 없으면 409 안내(+[재계산]) · 기본값 판정에서 지형 뺌
- POST /route/initial terrain = 창 지형 · [적용] draft.terrain = 창 지형 · 손 [저장]은 지형 안 바꿈(서버도 as_initial 일 때만)
- 평면 분석 지형 고르기 · 화면 취향(routeedit-terrain) 걷음 · 지반고 · 묶음 초안 = 설계 지형(null) · 적용 뒤 받아 둔 격자 버림
- 시험 test_509_5 · test_509_2 · 걷은 고르기를 보던 옛 시험 새 동작으로(352_3 건너뜀)

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

57 lines
2.8 KiB
Python

"""509-2 수치지형도 격자 브라우저로 — 적용 지형(설계 지형) = 수치지형도일 때만 그 격자를 받음 · 노드
끌기 지반고 서버 묻기 걷음 · 횡단 비탈 넓힘도 같은 격자(509-4 G2).
./venv/Scripts/python.exe -m pytest resources/tester/test_509_2_sheet_grid.py -q
분석 지형 = 설계 지형 하나(509-5) — 받는 격자는 늘 설계 지형 것 · 추천 [적용]이 지형을 바꾸면 버림.
"""
from pathlib import Path
from B05_Profile.B05_Profile_Router_Terrain import _design_grid
from common_util.common_util_surface_confirmation import SHEET_ANALYSIS_FILTER
ROOT = Path(__file__).resolve().parents[2]
SHEET = {"source_filter": SHEET_ANALYSIS_FILTER, "method": "dtm", "smooth": True}
MODEL = f"B04_PreProcess/models/dtm_{SHEET_ANALYSIS_FILTER}.npz"
def test_설계_지형_수치지형도면_그_격자_자리(tmp_path) -> None:
grid = _design_grid(SHEET, tmp_path, (41, "dtm", MODEL))
assert grid == {"model_id": 41, "smooth": True, "signature": "."}
def test_확정_모델이_다른_파일이면_격자_없음(tmp_path) -> None:
las = "B04_PreProcess/models/dtm_classification.npz"
assert _design_grid(SHEET, tmp_path, (41, "dtm", las)) is None
assert _design_grid(SHEET, tmp_path, None) is None
def _ts(path: str) -> str:
return (ROOT / path).read_text(encoding="utf-8")
def test_지반고는_설계_지형_격자_서버_묻기_없음() -> None:
replan = _ts("B05_Profile/B05_Profile_Api_Replan.ts")
elevations = replan.split("export async function fetchRouteElevations", 1)[1][:700]
assert "if (local) {" in elevations # 받아 둔 격자면 늘 브라우저 표본
assert "JSON.stringify({ points })" in elevations # 서버 길도 설계 지형
# 계산 묶음 초안 지형 = null(설계) → ground 단계가 격자를 씀(terrain === null)
ground = _ts("B05_Profile/logic/B05_Profile_Pipeline_RouteGround.ts")
assert "(terrain === null || terrain === local.design)" in ground
pipeline = _ts("A00_Common/design/design_pipeline_page.ts")
assert "terrain: null };" in pipeline
# 횡단 비탈 넓힘 = ground 와 같은 격자(509-4 G2 · 적용 지형 것)
assert "createCrossStage({ grid: groundDeps.grid })" in pipeline
def test_적용으로_지형이_바뀌면_격자_버림() -> None:
grid = _ts("B05_Profile/B05_Profile_Api_TerrainGrid.ts")
forget = grid.split("export function forgetDesignTerrainGrid", 1)[1][:200]
assert "loaded.delete(projectId)" in forget and "ready.delete(projectId)" in forget
apply = _ts("B05_Profile/B05_Profile_UI_RouteEdit_Apply.ts")
recommend = apply.split("export async function saveRecommendedRoute", 1)[1]
assert recommend.index("forgetDesignTerrainGrid(projectId)") < recommend.index(
"await rebuildAfterRouteSave(projectId)"
)