Files
Aislo/resources/tester/test_472_4_underdrain_mirror.py
T
eomsangdonandClaude Opus 5.5 172ff8170b refactor(511-B B-6 정리): 운영 부름 0 파이썬 짝 걷음 · 남는 짝 머리에 남는 까닭 · 등록부 until 걷음 · 알려진 차 까닭 · 322_3 flow 빨강 고침
걷은 함수(운영 부름 0 · 전수 확인 = 화면 · 서버 · 체인 · 추천 엔진 · B07 · 시험)
- common_util/common_util_excavation.py 통째(126 줄 · pipe_trench_width_m · wall_trench_area_m2 · wall_trench_width_m · 서버 = Node excavation.trench)
- Engine_Grade_Carry.carry_edits(Node carry_seat 겉) · Route_Save_Parts.seat_route_moved(시험 헬퍼 helper_475_1_moved 로 옮김)
- Engine_Tilt.attach_underdrains · Engine_Structures_Wall.attach_wall_structures · load_wall_structures
- Engine_Grade_Alignment.tangent_elevation(부름 0) · station_key.dedupe_station_keys · loose_chainage
줄 수 전 → 후: excavation.py 126 → 0 · Grade_Carry 178 → 157 · Save_Parts 289 → 269 · Wall 221 → 197 · Tilt 115 → 112 · station_key 141 → 122 · Alignment 657 → 654

남는 짝(머리 「남는 까닭」 한 줄) — Grade · Grade_Profile · Alignment · CurveLaw(2~4 순위 폴백 · 추천) · NodeEdits · SampleExtend · Router_Design · Ranges · Engine_Design · Areas · cross_berm(DTM 아닌 지표면 · Node 못 부를 때 · B07 · 추천) · Tilt · Wall · Culvert(B04 B07 B08) · route_follow · structure_station · station_key · route_polyline(745 줄 · 까닭 = 등록부 R1 줄)

등록부 — until 칸 걷음(G1 = py 표본기 남김 · 까닭 note) · C6 pair = attach_underdrain_specs · F8 pair null
알려진 차 — golden KNOWN 셋 그대로 나타남(R7 표본 출처 · W0 저장 때 경고 · X2 입력 선 자릿수 · 까닭 고침) · underdrain 알려진 차 까닭 · 511_b5 KNOWN_ARC 그대로
계산 자리 창 — 45 줄 · 서버만 아닌 41(바꿀 수 있음 40 + F9) · 서버만 넷(G3 D1 D2 N1 줄마다 까닭) · 옛 까닭 「짝 모으는 중 · B-4」 글 걷음
test_322_3_flow 빨강 — 헬퍼가 @config/config_frontend 흉내(511-A design_calc_server import)
시험 기준 — 걷은 짝 거울 = 걷기 전 파이썬 값 고정(excavation · station_key) · Node carry_seat · attach_underdrain_specs · wall_specs_from

검증: 고친 대상 시험 97 파일 562 통과 · 21 건너뜀 · typecheck 0 · 700 줄 넘는 새 파일 없음 — 요구 320-4

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 16:34:08 +09:00

122 lines
4.0 KiB
Python

"""PLAN 472-4 ② C6 (요구 273) — 맹암거 얹기 거울: TS `common_util_structure_underdrain` ↔ 파이썬
`B06_Section_Engine_Tilt.underdrains_from` · `attach_underdrain_specs`.
못박는 것
- 구조물 목록 → 제원(높이 · 경사 · 빈 값 · 0 · 음수 · 글 · 맹암거 아닌 종류) 두 쪽 같음.
- 기준 측점(±0.02 m) 얹기 · 얹은 수 같음.
- 알려진 차 하나 — 옛 `underdrain` 이 남은 측점: TS 는 걷음 · 파이썬은 둠
(서버 GET = Node `facility.attach` = TS · 파이썬 짝은 Node 못 부를 때만 · 그 길은 정본 파일을
새로 읽어 옛 값 없음).
./venv/Scripts/python.exe -m pytest resources/tester/test_472_4_underdrain_mirror.py -q
"""
from __future__ import annotations
import copy
import json
import shutil
import subprocess
from pathlib import Path
import pytest
from B05_Profile.B05_Profile_Structures_Schema import StructureInstance
from B06_Section.B06_Section_Engine_Tilt import attach_underdrain_specs, underdrains_from
HERE = Path(__file__).resolve().parent
ROOT = HERE.parents[1]
pytestmark = pytest.mark.skipif(
not (ROOT / "config" / "node_modules" / "vite").is_dir(),
reason="프론트엔드 의존성 미설치",
)
def _drain(at: float, **options) -> dict:
return {
"type_id": "cross_underdrain",
"placement": "point",
"chainage_m": at,
"options": options,
}
STRUCTURES = [
_drain(40.0, culvert_height_m=1.2, culvert_slope_pct=3),
_drain(80.0, culvert_height_m="", culvert_slope_pct="2.5"),
_drain(120.0, culvert_height_m=0, culvert_slope_pct=-1),
_drain(160.0),
{"type_id": "berm", "placement": "interval", "start_m": 0.0, "end_m": 50.0, "options": {}},
]
SECTIONS = [
{"chainage_m": 40.01},
{"chainage_m": 79.99},
{"chainage_m": 120.0},
{"chainage_m": 160.03}, # 0.02 밖
{"chainage_m": 200.0, "underdrain": {"chainage_m": 200.0}}, # 옛 값 — 알려진 차
]
@pytest.fixture(scope="module")
def ts(tmp_path_factory) -> dict:
work = tmp_path_factory.mktemp("u4724")
subprocess.run( # noqa: S603 — 고정 실행 파일
[
"node",
str(ROOT / "config" / "node_modules" / "vite" / "bin" / "vite.js"),
"build",
"--configLoader",
"runner",
"--ssr",
"../resources/tester/helper_472_4_underdrain_entry.ts",
"--outDir",
str(work),
"--logLevel",
"error",
],
cwd=ROOT,
check=True,
capture_output=True,
timeout=300,
)
bundle = work / "bundle.mjs"
shutil.copy(work / "helper_472_4_underdrain_entry.js", bundle)
job = json.dumps({"structures": STRUCTURES, "sections": SECTIONS})
script = (
f"const m = await import({json.dumps(bundle.as_uri())});"
f"const job = {job};"
"const specs = m.underdrainSpecsFrom(job.structures);"
"const count = m.attachUnderdrainSpecs(job.sections, specs);"
"console.log(JSON.stringify({specs, count, sections: job.sections}));"
)
out = subprocess.run( # noqa: S603
["node", "--input-type=module", "-e", script],
cwd=ROOT,
check=True,
capture_output=True,
text=True,
encoding="utf-8",
timeout=60,
)
return json.loads(out.stdout)
def _python() -> tuple[list[dict], int, list[dict]]:
specs = underdrains_from([StructureInstance(**item) for item in STRUCTURES])
sections = copy.deepcopy(SECTIONS)
return specs, attach_underdrain_specs(sections, specs), sections
def test_제원_같음(ts) -> None:
specs, _count, _sections = _python()
assert ts["specs"] == specs
def test_얹기_같음_알려진_차_하나(ts) -> None:
_specs, count, sections = _python()
assert ts["count"] == count == 3
assert ts["sections"][:4] == sections[:4]
# 알려진 차 — 옛 underdrain: TS 걷음 · 파이썬 둠
assert "underdrain" not in ts["sections"][4] and "underdrain" in sections[4]