Merge remote-tracking branch 'origin/sub_laptop_5' into main_laptop_1
This commit is contained in:
@@ -33,7 +33,8 @@ def _defaults(type_id: str) -> dict:
|
||||
def test_새_관만_기본값_빈_키에만():
|
||||
fresh = PipePoint(chainage_m=10.0, source="stream", options={"pipe_diameter_mm": 800})
|
||||
basins._apply_new_defaults([fresh])
|
||||
expected = {**_defaults("pipe"), "pipe_diameter_mm": 800} # 추천(먼저 들어간 값)이 이김
|
||||
# 추천(먼저 들어간 값)이 이김 · 집수정 모양 L 도 실제 값(54-39)
|
||||
expected = {**_defaults("pipe"), "pipe_diameter_mm": 800, "inlet_structure": "L"}
|
||||
assert fresh.options == expected
|
||||
assert fresh.options["pipe_kind"] == "파형강관" and fresh.options["inlet_type"] == "집수정"
|
||||
box = PipePoint(chainage_m=20.0, source="stream", facility="box_culvert")
|
||||
@@ -62,7 +63,8 @@ def test_원본에_있던_관은_빈칸_그대로(monkeypatch):
|
||||
_, points = basins._build("p", Ctx(), [old])
|
||||
by = {p.chainage_m: p for p in points}
|
||||
assert by[100.0].options is None # 옛 빈칸 그대로
|
||||
assert by[300.0].options == _defaults("pipe") # 새로 보충된 관 = 기본값
|
||||
# 새로 보충된 관 = 기본값 + 집수정 모양 L(54-39)
|
||||
assert by[300.0].options == {**_defaults("pipe"), "inlet_structure": "L"}
|
||||
|
||||
|
||||
def test_월류_폭_기본값은_등록부_엔진과_같음():
|
||||
|
||||
@@ -33,44 +33,48 @@ def test_cross_reference_constants_match_plan():
|
||||
assert "min_slope" not in _culvert_set(None)
|
||||
|
||||
|
||||
def test_empty_options_fall_back_to_registry_defaults():
|
||||
"""옵션이 빈 저장분은 레지스트리 기본값(Ø1000·L10)으로 채운다.
|
||||
|
||||
높이는 2026-09-14 브레인 판정으로 **관경 기준 최소 높이**(Ø1000 → 1.5 + 근입 0.5 = 2.0) —
|
||||
횡단도가 그리는 그 높이. 옛 기본 2.5 는 횡단도가 안 쓰던 값이라 걷음.
|
||||
"""
|
||||
def test_empty_options_have_no_members():
|
||||
"""빈 고르기 칸 = 그 부재 없음(54-39) — 구조 · 형태 · 관종 · 기초 빈 값."""
|
||||
spec = _culvert_set(None)
|
||||
assert spec["type"] == "pipe"
|
||||
assert spec["diameter_m"] == 1.0
|
||||
assert spec["min_cover_m"] == MIN_PIPE_COVER_M
|
||||
# 54-36 기본: 유입 = 집수정(높이 1.5) · 유출 = 흙막이 찰 · 높이 1.5
|
||||
assert spec["inlet"]["structure"] == "집수정"
|
||||
assert spec["inlet"]["basin_height_m"] == 1.5
|
||||
assert spec["pipe_kind"] is None
|
||||
assert spec["foundation"] is None
|
||||
assert spec["inlet"] == {"role": "inlet", "structure": ""}
|
||||
assert spec["outlet"] == {"role": "outlet", "structure": ""}
|
||||
|
||||
|
||||
def test_saved_values_drive_members():
|
||||
"""고른 값만 부재 — 빈 높이 = 관경 기준 최소(Ø1000 → 2.0) · 빈 형태 = 없음."""
|
||||
spec = _culvert_set({"inlet_type": "집수정", "inlet_structure": "L", "outlet_type": "기슭막이"})
|
||||
assert spec["inlet"]["basin_form"] == "L"
|
||||
assert spec["inlet"]["basin_height_m"] is None
|
||||
part = spec["outlet"]
|
||||
assert part["structure"] == "기슭막이"
|
||||
assert part["revet_height_m"] == 1.5
|
||||
assert part["revet_length_m"] == 10
|
||||
assert part["revet_form"] is None
|
||||
assert part["revet_height_m"] == 2.0
|
||||
assert part["face_slope"] == REVET_FACE_SLOPE
|
||||
# 보호공 = 낙차고(1.5) × 2 = 3.0m, 두께 0.45m(사용자 확정).
|
||||
assert part["apron_length_m"] == 3.0
|
||||
# 보호공 = 낙차고(2.0) × 2 = 4.0m, 두께 0.45m(사용자 확정).
|
||||
assert part["apron_length_m"] == 4.0
|
||||
assert part["apron_thickness_m"] == 0.45
|
||||
assert part["revet_form"] == "돌쌓기(찰)"
|
||||
|
||||
|
||||
def test_basin_inlet_skips_revet_and_apron():
|
||||
"""유입구 = 집수정이면 그쪽 기슭막이·보호공을 만들지 않는다(라벨만)."""
|
||||
spec = _culvert_set({"inlet_type": "집수정"})
|
||||
spec = _culvert_set({"inlet_type": "집수정", "outlet_type": "기슭막이"})
|
||||
assert spec["inlet"]["structure"] == "집수정"
|
||||
assert "revet_height_m" not in spec["inlet"]
|
||||
assert "apron_length_m" not in spec["inlet"]
|
||||
# 유출측은 그대로 세트를 갖춘다.
|
||||
assert spec["outlet"]["structure"] == "기슭막이"
|
||||
assert spec["outlet"]["apron_length_m"] == 3.0 # 정의 기본 높이 1.5 × 2(54-36)
|
||||
assert spec["outlet"]["apron_length_m"] == 4.0 # 빈 높이 = 관경 기준 최소 2.0 × 2
|
||||
|
||||
|
||||
def test_string_diameter_and_custom_height():
|
||||
"""관경 문자열 저장분("800")과 사용자 높이 변경이 그대로 반영된다."""
|
||||
spec = _culvert_set({"pipe_diameter_mm": "800", "outlet_revet_height_m": 1.5})
|
||||
spec = _culvert_set(
|
||||
{"pipe_diameter_mm": "800", "outlet_type": "기슭막이", "outlet_revet_height_m": 1.5}
|
||||
)
|
||||
assert spec["diameter_m"] == 0.8
|
||||
assert spec["outlet"]["revet_height_m"] == 1.5
|
||||
assert spec["outlet"]["apron_length_m"] == 3.0 # 1.5 × 2
|
||||
|
||||
@@ -28,7 +28,7 @@ TSC = PROJECT_ROOT / "config" / "node_modules" / "typescript" / "bin" / "tsc"
|
||||
|
||||
# 다섯 시설 × 기본값 폴백/명시값 섞기. 물넘이포장은 폭 절반이 옆 측점까지 걸친다.
|
||||
POINTS = [
|
||||
{"chainage_m": 20.0, "facility": "pipe", "options": None},
|
||||
{"chainage_m": 20.0, "facility": "pipe", "options": {"pipe_diameter_mm": 1000}},
|
||||
{
|
||||
"chainage_m": 40.0,
|
||||
"facility": "pipe",
|
||||
|
||||
@@ -34,12 +34,12 @@ def test_registry_defines_basin_before_after():
|
||||
|
||||
|
||||
def test_basin_side_spec_carries_before_after():
|
||||
"""유입이 집수정이면 세트 제원에 길이와 전/후가 함께 실린다(레지스트리 기본값 경유)."""
|
||||
"""유입이 집수정이면 세트 제원에 길이와 전/후가 함께 실린다 — 빈 전/후 = 값 없음(54-39)."""
|
||||
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
|
||||
assert spec["basin_before_m"] is None
|
||||
assert spec["basin_after_m"] is None
|
||||
# 집수정 쪽에는 기슭막이가 없다 — 벽 제원이 섞이면 링크 판정이 10m로 번진다.
|
||||
assert "revet_length_m" not in spec
|
||||
|
||||
@@ -60,10 +60,10 @@ def test_basin_before_after_follow_saved_options():
|
||||
|
||||
|
||||
def test_revet_span_defaults_unchanged():
|
||||
"""기슭막이 기본은 그대로 길이 10m·전/후 5·5다(이번 변경이 건드리지 않는다)."""
|
||||
"""빈 길이 · 전 · 후 = 값 없음(54-39 · 정의 기본값으로 안 읽음) · 빈 유출 구조 = 벽 없음."""
|
||||
culvert = _culvert_set({"inlet_type": "기슭막이"})
|
||||
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
|
||||
spec = culvert["inlet"]
|
||||
assert spec["revet_length_m"] is None
|
||||
assert spec["revet_before_m"] is None
|
||||
assert spec["revet_after_m"] is None
|
||||
assert culvert["outlet"] == {"role": "outlet", "structure": ""}
|
||||
|
||||
Reference in New Issue
Block a user