Files
Aislo/resources/tester/test_b06_ford_set.py
T
eomsangdonandClaude Opus 5.5 baa2438116 test(structure): 73-10 옛 기대값 정리 — 세월교 련 2 · 물넘이 경사각 3° · 내공 줄 숨김 · 관경 빈 배관 · 필수 칸 빈 보기
- test_b06_ford_set: 정의 기본 2련(65-4) · 소유 측점 붙기 = 관경 적은 배관으로(54-39 관경 빈 값 = 관 없음)
- test_b06_pavement_and_ford · test_b06_facility_default_notes: 경사각 빈 값 = 정의 기본 3° → % · 「경사각 3」 기본값 목록(65-5 · 66-2)
- test_b06_adjust_single_form: 집수정 내공 줄 화면 숨김(54-40)
- test_b06_detail_options: optionControl 셋째 인자(52-12) · 필수 · 기본값 칸 빈 보기 없음(54-43)
- 코드 그대로 · 대상 77 파일 394 통과 2 건너뜀

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BVPp2o6Mh2FZJr72yW3ofZ
2026-10-07 08:30:41 +09:00

80 lines
3.3 KiB
Python

"""B06 세월교 세트(백엔드) 자체검증 — 2026-08-25.
확인 대상:
· `_ford_set()`이 정본·레지스트리 기본값으로 제원을 만든다.
· 날개벽 각도가 바닥판 편측 연장(길이×cos각)을 만든다. 설치 "없음"이면 0.
· `attach_culvert_sets()`가 세월교를 **소유 측점 한 곳에만** 붙이고,
배수관은 종전대로 ±0.02m 측점 일치로만 붙인다.
"""
from __future__ import annotations
import math
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from B06_Section.B06_Section_Engine_Culvert import ( # noqa: E402
FORD_SLAB_THICKNESS_M,
FORD_WALL_THICKNESS_M,
_ford_set,
attach_culvert_sets,
)
def test_ford_set_defaults() -> None:
"""저장 옵션이 없으면 레지스트리 기본값(파형강관 Ø1000·월류 폭 10m·2련 · 65-4)을 쓴다."""
spec = _ford_set(None)
assert spec["type"] == "ford"
assert spec["pipe_kind"] == "파형강관"
assert spec["diameter_m"] == 1.0
assert spec["pipe_count"] == 2
assert spec["span_m"] == 10.0
assert spec["slab_thickness_m"] == FORD_SLAB_THICKNESS_M
assert spec["wall_thickness_m"] == FORD_WALL_THICKNESS_M
def test_wing_angle_drives_slab_extension() -> None:
"""바닥판 편측 연장 = 날개벽 길이 × cos(각도). 45°·2m면 1.414m."""
spec = _ford_set({"wing_in_length_m": 2, "wing_in_angle_deg": 45})
assert spec["wing_in"]["slab_extend_m"] == round(2 * math.cos(math.radians(45)), 3)
steep = _ford_set({"wing_out_length_m": 2, "wing_out_angle_deg": 30})
assert steep["wing_out"]["slab_extend_m"] == round(2 * math.cos(math.radians(30)), 3)
def test_wing_absent_gives_no_extension() -> None:
"""날개벽 설치 '없음'이면 연장 0 — 바닥판은 구체 폭만 남는다."""
spec = _ford_set({"wing_in": "없음", "wing_in_length_m": 2, "wing_in_angle_deg": 45})
assert spec["wing_in"]["installed"] is False
assert spec["wing_in"]["slab_extend_m"] == 0.0
def test_attach_ford_only_owner_station(tmp_path: Path) -> None:
"""세월교도 배수관과 같이 **소유 측점 한 곳에만** 붙는다(2026-08-25 사용자 확정).
월류 폭 절반까지 옆 측점에 붙이면 그 측점 횡단도에 같은 구체가 한 벌 더 그려지고
3D 솔리드도 어긋난 채 겹친다. 3D 스윕 길이는 소유 측점이 `span_m`으로 직접 낸다.
"""
pipe_points = tmp_path / "B04_PreProcess" / "drainage" / "edits"
pipe_points.mkdir(parents=True)
(pipe_points / "pipe_points.json").write_text(
'{"points": ['
'{"chainage_m": 100.0, "facility": "ford_bridge", "options": {"ford_width_m": 10}},'
'{"chainage_m": 200.0, "facility": "pipe", "options": {"pipe_diameter_mm": 1000}}]}',
encoding="utf-8",
)
# 관경 빈 배관 = 관 없음(54-39) — 관경을 적은 배관으로 붙는 자리를 잼
sections = [{"chainage_m": value} for value in (94.0, 95.5, 100.0, 104.5, 106.0, 200.0, 201.0)]
attached = attach_culvert_sets(tmp_path, sections)
kinds = [
("ford" if "ford" in section else "culvert" if "culvert" in section else None)
for section in sections
]
assert kinds == [None, None, "ford", None, None, "culvert", None]
assert attached == 2