"""PLAN 52-9 — 안전부대용지 › 사토장 · 토취장 = 사용자 구조물 표 08. · 있는 종류 키 그대로(spoil_bank · borrow_pit) · 기준 측점 + 컨테이너 「상세 내용」(정의 그룹) 하나 · 부피 손 입력 = 옛 용량 키 `capacity_m3`(상세 CAD 글 「사토장 부피」 · 380) · 옛 칸은 정의에서 빼 지난 정의 값 · 잇기 = 그룹 id(`group_items`) — 집계 표가 그룹마다 한 줄 """ import json from pathlib import Path from B05_Profile.B05_Profile_Structures_Schema import DEFINITION_PATH, load_structure_types from common_util.common_util_structure_catalog import catalog_row from M02_MasterTemplete.M02_Table_Fill import _with_group_items from M02_MasterTemplete.StructOptions import M02_SO_Definition from M02_MasterTemplete.StructOptions.M02_SO_Groups import groups_of KINDS = { "spoil_bank": ("유용토운반작업장(사토장)", "사토장 부피", "gspoildetail"), "borrow_pit": ("토사채취장(토취장)", "토취장 부피", "gborrowdetail"), } def test_옵션은_부피_하나_손_입력(): by_id = {t.type_id: t for t in load_structure_types()} for type_id, (name, label, _) in KINDS.items(): item = by_id[type_id] assert item.group == "E" and item.name == name and item.managed_by is None assert [o.key for o in item.options] == ["capacity_m3"] volume = item.options[0] assert volume.label == label and volume.input == "number" and volume.unit == "㎥" assert volume.phase == "b05" and not volume.required and volume.default is None def test_컨테이너_상세_내용_하나_부피를_담음(): groups = groups_of() for type_id, (_, _, gid) in KINDS.items(): assert groups[type_id] == [{"id": gid, "name": "상세 내용", "options": ["capacity_m3"]}] def test_정의_검사_통과_판_이력(): doc = json.loads(Path(DEFINITION_PATH).read_text("utf-8")) assert M02_SO_Definition.check(doc) == [] assert M02_SO_Definition.history_path(doc["판"] - 1).is_file() def test_잇기는_그룹마다_집계_한_줄(): link = {"source": "SS", "code": "SS-000001", "name": "사토장"} rows = _with_group_items( [ { "type_id": "spoil_bank", "복사본": "s1", "summary_item": None, "group_items": {"gspoildetail": link}, } ] ) assert [r["복사본"] for r in rows] == ["s1", "s1__gspoildetail"] assert rows[1]["summary_item"] == link and rows[1]["그룹"] == "상세 내용" def test_380_사토장_토취장은_횡단_그림_3D_없음(): for type_id in KINDS: row = catalog_row(type_id) assert (row["station"], row["shape"], row["model3d"]) == ("none", "none", "none"), type_id def test_54_7_사토장_기준_측점_꼴은_토취장과_같음_옛_구간은_기준_측점으로_읽음(): from B05_Profile.B05_Profile_Structures_Schema import StructureInstance by_id = {t.type_id: t for t in load_structure_types()} assert by_id["spoil_bank"].placement == by_id["borrow_pit"].placement == "site" old = {"type_id": "spoil_bank", "placement": "interval", "start_m": 60, "end_m": 80} for extra, station in (({"chainage_m": 70}, 70.0), ({}, 60.0)): item = StructureInstance.model_validate({**old, **extra}) assert (item.placement, item.chainage_m, item.start_m, item.end_m) == ( "site", station, None, None, )