⚠ **뿌리** — `tmp/` 는 창 사이에 안 건너감(실측 확인: 상대 창이 놓은 `tmp/_sync_probe.txt` 가 시간을 두고 두 번 봐도 안 보임). 그래서 **정본(등록부 스키마)만 건너가고 그것을 읽는 시험은 안 건너가** 오늘 두 번, 같은 시험이 **연 창은 통과·받은 창은 실패**가 됐음. - `tmp/tests/*` 를 `resources/tester/` 로 **복사**(127 파일). 내용은 **한 줄도 안 고침** - `tmp/tests` 는 **남겨 둠** — 되돌릴 자리(사용자 지시) - 실행: `./venv/Scripts/python.exe -m pytest resources/tester/ -q` 옮기기 전과 **같은 수**: 617 통과 / 22 건너뜀 / 실패 0 ⇒ 이제 시험·예외·까닭이 **정본과 함께** 움직임. 오늘 세운 「예외는 정본 스키마에」와 짝임. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
70 lines
2.7 KiB
Python
70 lines
2.7 KiB
Python
"""구조물 종방향 구간값(길이·기준측점 전/후) 검증 — 2026-08-24 사용자 확정.
|
|
|
|
기슭막이는 길이 10m·전/후 5·5, 집수정은 길이 2m·전/후 1·1이 기본이다. 세 값이
|
|
곧 그 구조물이 덮는 종방향 범위이고, 그 범위에 걸린 옆 측점 횡단도에 같은
|
|
기슭막이가 연동으로 선다. 별도 폭 필드는 없다(PLAN.md §4-9).
|
|
"""
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
PROJECT_ROOT = Path(__file__).resolve().parents[2]
|
|
if str(PROJECT_ROOT) not in sys.path:
|
|
sys.path.insert(0, str(PROJECT_ROOT))
|
|
|
|
from B05_Profile.B05_Profile_Structures_Schema import load_structure_types # noqa: E402
|
|
from B06_Section.B06_Section_Engine_Culvert import _culvert_set, _side_spec # noqa: E402
|
|
|
|
|
|
def _pipe_option_default(key: str):
|
|
for item in load_structure_types():
|
|
if item.type_id != "pipe":
|
|
continue
|
|
for option in item.options:
|
|
if option.key == key:
|
|
return option.default
|
|
raise AssertionError(f"레지스트리에 배관 옵션 {key}가 없다")
|
|
|
|
|
|
def test_registry_defines_basin_before_after():
|
|
"""집수정 길이 2m·전/후 각 1m가 레지스트리 기본값으로 있어야 한다."""
|
|
assert _pipe_option_default("inlet_basin_length_m") == 2
|
|
assert _pipe_option_default("inlet_basin_before_m") == 1
|
|
assert _pipe_option_default("inlet_basin_after_m") == 1
|
|
|
|
|
|
def test_basin_side_spec_carries_before_after():
|
|
"""유입이 집수정이면 세트 제원에 길이와 전/후가 함께 실린다(레지스트리 기본값 경유)."""
|
|
spec = _culvert_set({"inlet_type": "집수정"})["inlet"]
|
|
assert spec["structure"] == "집수정"
|
|
assert spec["basin_length_m"] == 2.0
|
|
assert spec["basin_before_m"] == 1.0
|
|
assert spec["basin_after_m"] == 1.0
|
|
# 집수정 쪽에는 기슭막이가 없다 — 벽 제원이 섞이면 링크 판정이 10m로 번진다.
|
|
assert "revet_length_m" not in spec
|
|
|
|
|
|
def test_basin_before_after_follow_saved_options():
|
|
"""저장분이 있으면 그대로 쓴다 — 비대칭(전 0.5 · 후 1.5)도 허용."""
|
|
spec = _side_spec(
|
|
{
|
|
"inlet_type": "집수정",
|
|
"inlet_basin_length_m": 2,
|
|
"inlet_basin_before_m": 0.5,
|
|
"inlet_basin_after_m": 1.5,
|
|
},
|
|
{},
|
|
"inlet",
|
|
)
|
|
assert (spec["basin_before_m"], spec["basin_after_m"]) == (0.5, 1.5)
|
|
|
|
|
|
def test_revet_span_defaults_unchanged():
|
|
"""기슭막이 기본은 그대로 길이 10m·전/후 5·5다(이번 변경이 건드리지 않는다)."""
|
|
culvert = _culvert_set(None)
|
|
for role in ("inlet", "outlet"):
|
|
spec = culvert[role]
|
|
assert spec["revet_length_m"] == 10.0
|
|
assert spec["revet_before_m"] == 5.0
|
|
assert spec["revet_after_m"] == 5.0
|