- `_apply_new_defaults` — 집수정 갈래면 `inlet_revet_*` 기본값 · 높이 안 채움 · `inlet_basin_animal` "true" · 등록부 관경 글 "1000" → 수 - 새 자동 관이 폼을 처음 거쳐도 파일이 안 바뀜(620 증상) · 옛 프로젝트 이주 없음 - 시험 — 새 `test_623_inlet_defaults`(폼 왕복 차 0 · `helper_623_inlet_defaults.cjs`) · 기대값 고침 `test_b05_new_structure_defaults` · `test_211_1`(기슭막이 관으로) · `test_b05_drainage_recommend`(관경 수) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
60 lines
2.5 KiB
Python
60 lines
2.5 KiB
Python
"""623 새 관 기본값 — 유입 집수정이면 유입 흙막이 칸 안 채움 · 동물이동형 유(요구 530 E1 · 분석 620).
|
|
|
|
못박는 것
|
|
- 서버가 새로 만든 관(`_apply_new_defaults`) = 집수정 갈래 · `inlet_revet_*` 없음 · `inlet_basin_animal` "true".
|
|
- 그 옵션을 공용 명세 폼 `write → read` + 병합(`mergeFacilityOptions`)에 돌리면 차이 0
|
|
(지워짐 0 · 더함 0 · 바뀜 0) — 폼을 처음 거쳐도 파일이 안 바뀜(`helper_623_inlet_defaults.cjs`).
|
|
- 유입 기슭막이로 받은 관 · 이미 적힌 유입 흙막이 칸은 그대로.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
from B04_PreProcess import B04_PreProcess_Router_Basins as basins
|
|
from common_util.common_util_drainage_pipes import PipePoint
|
|
|
|
HERE = Path(__file__).parent
|
|
ROOT = HERE.parents[1]
|
|
|
|
|
|
def _fresh(**options) -> dict:
|
|
pipe = PipePoint(chainage_m=10.0, source="stream", options=options or None)
|
|
basins._apply_new_defaults([pipe])
|
|
return pipe.options
|
|
|
|
|
|
def test_집수정이면_유입_흙막이_없음_동물이동형_유():
|
|
for options in (_fresh(), _fresh(pipe_diameter_mm=800)):
|
|
assert options["inlet_type"] == "집수정"
|
|
assert not [k for k in options if k.startswith("inlet_revet_")]
|
|
assert options["inlet_basin_animal"] == "true" and options["inlet_structure"] == "L"
|
|
assert _fresh()["pipe_diameter_mm"] == 1000 # 등록부 글 "1000" → 수(폼과 같음)
|
|
|
|
|
|
def test_기슭막이_관과_적힌_칸은_그대로():
|
|
soil = _fresh(inlet_type="기슭막이")
|
|
assert soil["inlet_revet_form"] == "돌쌓기(찰)" and soil["inlet_revet_height_m"] == 1.7
|
|
assert "inlet_basin_animal" not in soil
|
|
kept = _fresh(inlet_revet_form="돌쌓기(메)", inlet_basin_animal="false")
|
|
assert kept["inlet_revet_form"] == "돌쌓기(메)" and kept["inlet_basin_animal"] == "false"
|
|
|
|
|
|
def test_서버가_만든_관_폼_왕복_차이_0():
|
|
if not (ROOT / "config" / "node_modules").is_dir():
|
|
pytest.skip("의존성 미설치")
|
|
inputs = [_fresh(), _fresh(pipe_diameter_mm=800), _fresh(pipe_diameter_mm=1200)]
|
|
done = subprocess.run( # noqa: S603 — 고정 실행 파일
|
|
["node", str(HERE / "helper_623_inlet_defaults.cjs")],
|
|
input=json.dumps(inputs, ensure_ascii=False),
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
)
|
|
assert done.returncode == 0, done.stderr
|
|
assert json.loads(done.stdout) == [{"removed": [], "added": [], "changed": []}] * 3
|