Merge remote-tracking branches 'origin/main_laptop_1' and 'origin/sub_laptop_2' into sub_laptop_3
This commit is contained in:
@@ -42,8 +42,11 @@ def test_글은_재계산에서도_남는다(monkeypatch):
|
||||
monkeypatch.setattr(design_mod, "ford_surface_drops", lambda root: [])
|
||||
monkeypatch.setattr(design_mod, "design_elevation_from_longitudinal", lambda lon, ch: 100.0)
|
||||
monkeypatch.setattr(design_mod, "curve_widening_args", lambda section: {})
|
||||
# 472-4 ② — [저장] 다시 셈은 측점 묶음(Node) 한 번 · 그 자리를 갈아 끼움
|
||||
monkeypatch.setattr(
|
||||
design_mod, "compute_cross_design", lambda samples, elev, **kw: {"paved": kw["paved"]}
|
||||
design_mod,
|
||||
"compute_cross_designs",
|
||||
lambda jobs, standard: [{"paved": kw["paved"]} for _s, _z, kw in jobs],
|
||||
)
|
||||
sections = [{"chainage_m": 40.0, "design": {"paved": False, "structure_note": "메모"}}]
|
||||
assert design_mod.enforce_pavement_ranges({}, sections, Path("."), None) == 1
|
||||
|
||||
@@ -202,7 +202,8 @@ def test_좌측_패널_칸_구간_깊이_나름():
|
||||
"""옛 구조물 옵션 depth_m → 세션 구간 → 측점 제원(기본값) · 서버 payload(같은 꼴).
|
||||
|
||||
좌측 칸은 194-1 에서 숨김 — 옮기기는 횡단도 ▲▼(`test_194_1_berm_depth`)."""
|
||||
source = (ROOT / "B06_Section" / "B06_Section_UI_Page_Persist.ts").read_text(encoding="utf-8")
|
||||
# 소단 구간 셈은 472-4 C4 에서 `common_util_berm_spans.ts` 로 옮김
|
||||
source = (ROOT / "common_util" / "common_util_berm_spans.ts").read_text(encoding="utf-8")
|
||||
assert "options.depth_m" in source and "Math.max(rawDepth, 0)" in source
|
||||
refresh = (ROOT / "B06_Section" / "B06_Section_Cross_Refresh.ts").read_text(encoding="utf-8")
|
||||
assert "depthM: spec.depth_m" in refresh
|
||||
|
||||
@@ -59,8 +59,11 @@ def test_CAD_칸은_재계산에서도_남는다(monkeypatch):
|
||||
monkeypatch.setattr(design_mod, "ford_surface_drops", lambda root: [])
|
||||
monkeypatch.setattr(design_mod, "design_elevation_from_longitudinal", lambda lon, ch: 100.0)
|
||||
monkeypatch.setattr(design_mod, "curve_widening_args", lambda section: {})
|
||||
# 472-4 ② — [저장] 다시 셈은 측점 묶음(Node) 한 번 · 그 자리를 갈아 끼움
|
||||
monkeypatch.setattr(
|
||||
design_mod, "compute_cross_design", lambda samples, elev, **kw: {"paved": kw["paved"]}
|
||||
design_mod,
|
||||
"compute_cross_designs",
|
||||
lambda jobs, standard: [{"paved": kw["paved"]} for _s, _z, kw in jobs],
|
||||
)
|
||||
sections = [{"chainage_m": 40.0, "design": {"paved": False, "structure_note_cad": CAD}}]
|
||||
assert design_mod.enforce_pavement_ranges({}, sections, Path("."), None) == 1
|
||||
|
||||
@@ -19,6 +19,7 @@ X3 면적 두 갈래(구조물 = 관 351 하나 · 두 길 다 Node TS 로 셈)
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import copy
|
||||
import json
|
||||
from dataclasses import dataclass
|
||||
|
||||
@@ -131,6 +132,25 @@ def test_두_길_사이_알려진_차만(got, pair) -> None:
|
||||
assert not gone, f"안 나타난 알려진 차 {gone} — KNOWN 에서 지움"
|
||||
|
||||
|
||||
def test_저장_설계선_점_정본과_1e4_안(tmp_path) -> None:
|
||||
"""[저장] 다시 셈 설계선(472-4 ② = Node TS) — 정본과 점 수 · offset 같음 · 고도 1e-4 m 안.
|
||||
|
||||
알려진 차 = 반올림 동점(파이썬 round 짝수 쪽 · TS 위쪽) 13 점(브레인 10-19 승인).
|
||||
"""
|
||||
detail = copy.deepcopy(paths.read("detail.json"))
|
||||
before = {s["chainage_m"]: s["design"]["design_line"] for s in detail["cross_sections"]}
|
||||
sections, _ = paths._save_tail(detail, paths.stage_project(tmp_path / "project"))
|
||||
moved = 0
|
||||
for section in sections:
|
||||
old, new = before[section["chainage_m"]], section["design"]["design_line"]
|
||||
assert [p["offset_m"] for p in new] == [p["offset_m"] for p in old], section["chainage_m"]
|
||||
for a, b in zip(old, new, strict=True):
|
||||
gap = abs(a["elevation_m"] - b["elevation_m"])
|
||||
assert gap <= 1e-4 + 1e-9, (section["chainage_m"], a, b)
|
||||
moved += gap > 0
|
||||
assert moved == 13, f"반올림 동점 점 수 {moved} — 알려진 차(13)와 다름"
|
||||
|
||||
|
||||
def test_화면_참값() -> None:
|
||||
stored = GOLDEN["stored"]
|
||||
assert stored["final_cumulative_m3"] == -17570.7
|
||||
|
||||
@@ -40,6 +40,8 @@ NODE_IDS = {
|
||||
"haul.plan",
|
||||
"excavation.trench",
|
||||
"corridor.mesh",
|
||||
"cross.design",
|
||||
"cross.berm_spans",
|
||||
}
|
||||
|
||||
pytestmark = pytest.mark.skipif(
|
||||
@@ -196,7 +198,7 @@ def test_id_마다_실행기_있음(loaded) -> None:
|
||||
if row["site"] == "browser_only":
|
||||
ok = kind == "browser" and _has_name(ref)
|
||||
elif kind == "node":
|
||||
ok = ref == row["id"] and ref in NODE_IDS
|
||||
ok = ref in NODE_IDS # 한 셈에서 나오는 값(면적 · 소단 사면)은 그 셈의 id
|
||||
else:
|
||||
ok = kind == "py" and _has_name(ref)
|
||||
ok = ok and ("until" not in row or kind == "py")
|
||||
@@ -205,8 +207,10 @@ def test_id_마다_실행기_있음(loaded) -> None:
|
||||
if not ok:
|
||||
bad.append(row["id"])
|
||||
assert bad == []
|
||||
node_rows = {row["id"] for row in loaded["registry"] if row["runner"].startswith("node:")}
|
||||
assert node_rows == NODE_IDS
|
||||
node_runs = {
|
||||
row["runner"][5:] for row in loaded["registry"] if row["runner"].startswith("node:")
|
||||
}
|
||||
assert node_runs == NODE_IDS
|
||||
|
||||
|
||||
def test_묶음_STAGE_DEPS_등록부_입력과_같음(loaded) -> None:
|
||||
|
||||
@@ -68,3 +68,36 @@ def test_실행기_값_server_calc_와_같음() -> None:
|
||||
def test_Node_실행기_아닌_id_는_ValueError() -> None:
|
||||
with pytest.raises(ValueError, match="stations.list"):
|
||||
runner.run_calc(["masshaul.cumulative", "stations.list"], {})
|
||||
|
||||
|
||||
# ── 472-4 ② — 횡단 설계선 · 소단 구간 Node 길 ──────────────────────────────────
|
||||
|
||||
|
||||
def test_소단_구간_Node_와_파이썬_짝_같음(tmp_path, monkeypatch) -> None:
|
||||
from test_272_berm_source import STRUCTURE_CASES, _project
|
||||
|
||||
from B06_Section import B06_Section_Engine_Design_Node as node_mod
|
||||
from B06_Section.B06_Section_Engine_Structures_Wall import berm_span_at, load_berm_spans
|
||||
|
||||
calls = []
|
||||
real = node_mod.run_calc
|
||||
monkeypatch.setattr(
|
||||
node_mod, "run_calc", lambda ids, inputs: calls.append(ids) or real(ids, inputs)
|
||||
)
|
||||
chainages = [0.0, 5.0, 50.0, 65.0, 80.0, 100.0, 150.0, 250.0]
|
||||
for index, structures in enumerate(STRUCTURE_CASES):
|
||||
root = _project(tmp_path / f"c{index}", structures)
|
||||
got = node_mod.berm_specs_at(root, chainages)
|
||||
spans = load_berm_spans(root)
|
||||
want = [berm_span_at(spans, c) for c in chainages]
|
||||
assert got == [pytest.approx(w) if w else w for w in want], index
|
||||
assert len(calls) == len(STRUCTURE_CASES) # 파이썬 물러섬 아님
|
||||
|
||||
|
||||
def test_횡단_설계_못_세운_측점은_None() -> None:
|
||||
from B06_Section.B06_Section_Engine_Design_Node import compute_cross_designs
|
||||
|
||||
ground = [{"offset_m": o, "elevation_m": 100.0 + 0.3 * o} for o in range(-20, 21)]
|
||||
options = {"ground_type": "soil", "section_mode": "left_cut"}
|
||||
got = compute_cross_designs([(ground, 100.0, options), (ground, None, options)], None)
|
||||
assert got[0]["cut_area_m2"] > 0 and got[1] is None
|
||||
|
||||
@@ -31,6 +31,8 @@ TSC = PROJECT_ROOT / "config" / "node_modules" / "typescript" / "bin" / "tsc"
|
||||
|
||||
# 값이 소수점 아래에서 갈리는지 보려면 자릿수를 그대로 비교해야 한다. 두 쪽 다 반올림해
|
||||
# 내보내므로 완전 일치를 기대하되, 부동소수 마지막 자리만 어긋나는 것은 허용한다.
|
||||
# 알려진 차(472-4 ②) — 반올림 동점(…5)에서 파이썬 round 는 짝수 쪽 · TS 는 위쪽이라 설계선 점이
|
||||
# 1e-4 m 갈릴 수 있음(이 시험 입력엔 없음 · [저장] 정본은 Node TS 쪽 · test_472_1_golden).
|
||||
_TOLERANCE = 1e-9
|
||||
|
||||
|
||||
|
||||
@@ -146,8 +146,11 @@ def test_enforce_turns_paved_on_and_off(monkeypatch):
|
||||
monkeypatch.setattr(design_mod, "ford_surface_drops", lambda root: [])
|
||||
monkeypatch.setattr(design_mod, "design_elevation_from_longitudinal", lambda lon, ch: 100.0)
|
||||
monkeypatch.setattr(design_mod, "curve_widening_args", lambda section: {})
|
||||
# 472-4 ② — [저장] 다시 셈은 측점 묶음(Node) 한 번 · 그 자리를 갈아 끼움
|
||||
monkeypatch.setattr(
|
||||
design_mod, "compute_cross_design", lambda samples, elev, **kw: {"paved": kw["paved"]}
|
||||
design_mod,
|
||||
"compute_cross_designs",
|
||||
lambda jobs, standard: [{"paved": kw["paved"]} for _s, _z, kw in jobs],
|
||||
)
|
||||
sections = [
|
||||
{"chainage_m": 20.0, "design": {"paved": False}}, # 범위 안 · 끔 → 켬
|
||||
|
||||
@@ -80,7 +80,12 @@ def _install_fakes(monkeypatch) -> dict:
|
||||
}
|
||||
|
||||
monkeypatch.setattr(design_mod, "pavement_ranges", lambda root: [(0.0, 200.0)])
|
||||
monkeypatch.setattr(design_mod, "compute_cross_design", fake_compute)
|
||||
# 472-4 ② — [저장] 다시 셈은 측점 묶음(Node) 한 번 · 그 자리를 갈아 끼움
|
||||
monkeypatch.setattr(
|
||||
design_mod,
|
||||
"compute_cross_designs",
|
||||
lambda jobs, standard: [fake_compute(s, z, standard=standard, **kw) for s, z, kw in jobs],
|
||||
)
|
||||
monkeypatch.setattr(design_mod, "design_elevation_from_longitudinal", lambda lon, ch: 100.0)
|
||||
monkeypatch.setattr(design_mod, "curve_widening_args", lambda section: {})
|
||||
return seen
|
||||
|
||||
@@ -120,7 +120,12 @@ def _fake_engine(monkeypatch):
|
||||
return {"paved": True, "cut_area_m2": 1.0, "fill_area_m2": 2.0}
|
||||
|
||||
monkeypatch.setattr(design_mod, "pavement_ranges", lambda root: [(0.0, 200.0)])
|
||||
monkeypatch.setattr(design_mod, "compute_cross_design", fake_compute)
|
||||
# 472-4 ② — [저장] 다시 셈은 측점 묶음(Node) 한 번 · 그 자리를 갈아 끼움
|
||||
monkeypatch.setattr(
|
||||
design_mod,
|
||||
"compute_cross_designs",
|
||||
lambda jobs, standard: [fake_compute(s, z, standard=standard, **kw) for s, z, kw in jobs],
|
||||
)
|
||||
monkeypatch.setattr(design_mod, "design_elevation_from_longitudinal", lambda lon, ch: 100.0)
|
||||
monkeypatch.setattr(design_mod, "curve_widening_args", lambda section: {})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user