- 구조물마다 조합 줄 뒤에 좌측 패널 옵션 줄 — 폼과 같은 컨테이너 · 이름 · 보이는 칸(`structureOptionLines`) · 구조 갈래에 안 맞는 옛 값 뺌 · 필수 상자 빈 칸 = 폼 기본값 - B06 [상세] 모달 = 화면 TS 직접 · B07 = 같은 TS 를 Node 번들(B07_DesignDetail_Note_Options_Node · build:b07-note)로 받아 파이썬 짝이 붙임 · 실패는 조합 줄만 - 번들 낡음 판정에 A00_Common/design 더함 - 시험 test_166_1(진짜 명세 · B07 = 화면 같은 줄) · test_260 · test_265 기대값 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LLCk2y5xE8YGVgjbTntWsY
117 lines
4.4 KiB
Python
117 lines
4.4 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""166-1 횡단 [상세] CAD 칸 · B07 표 위 미리 넣음 = 구조물 조합 이름 + 좌측 패널 옵션 줄.
|
|
|
|
사용자 말: 「일단은 좌측패널 옵션과 구조물조합이름을 다 넣어주면 내가 추가로 선정하겠음」.
|
|
옵션 줄 = 좌측 패널 폼과 같은 컨테이너 · 이름 · 보이는 칸(`structureOptionLines`) —
|
|
관 보호공 구조 갈래에 맞지 않는 옛 값(집수정인데 흙막이 칸 값)은 안 씀 ·
|
|
필수 상자 빈 칸 = 폼이 채워 보이는 기본값.
|
|
B07 은 같은 TS 를 Node 번들(`B07_DesignDetail_Note_Options_Node`)로 돌려 받음.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
HERE = Path(__file__).resolve().parent
|
|
ROOT = HERE.parents[1]
|
|
sys.path.insert(0, str(ROOT))
|
|
|
|
from B05_Profile.B05_Profile_Structures_Schema import load_definition # noqa: E402
|
|
from B07_DesignDetail.B07_DesignDetail_Engine_Cad_CulvertNote import ( # noqa: E402
|
|
structure_note_lines,
|
|
with_option_lines,
|
|
)
|
|
from M02_MasterTemplete.StructOptions.M02_SO_Options import with_visible # noqa: E402
|
|
|
|
pytestmark = pytest.mark.skipif(
|
|
not (ROOT / "config" / "node_modules").is_dir(), reason="프론트엔드 의존성 미설치"
|
|
)
|
|
|
|
PIPE = {
|
|
"pipe_diameter_mm": 800,
|
|
"pipe_kind": "파형강관",
|
|
"inlet_type": "집수정",
|
|
"inlet_structure": "L",
|
|
"inlet_basin_height_m": 1.3,
|
|
# 구조를 집수정으로 바꾸기 전 흙막이 값 — 폼이 안 보이는 옛 값
|
|
"inlet_revet_form": "돌쌓기(찰)",
|
|
"inlet_revet_length_m": 10,
|
|
"outlet_type": "기슭막이",
|
|
"outlet_revet_form": "돌쌓기(찰)",
|
|
"outlet_revet_length_m": 10,
|
|
"outlet_revet_before_m": 5,
|
|
"outlet_revet_after_m": 5,
|
|
"outlet_revet_height_m": 1.3,
|
|
}
|
|
WALL = {"wall_form": "돌쌓기(찰)", "length_m": 12, "height_m": 2.5, "before_m": 6, "after_m": 6}
|
|
THINGS = [
|
|
{"type_id": "pipe", "options": PIPE},
|
|
{"type_id": "retaining_wall", "options": WALL},
|
|
{"type_id": "hazard_sign", "options": {}},
|
|
]
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def ts_lines() -> list[list[str]]:
|
|
payload = {
|
|
"things": THINGS,
|
|
"types": with_visible().model_dump(mode="json")["types"],
|
|
"definition": load_definition(),
|
|
}
|
|
proc = subprocess.run( # noqa: S603 — 고정 실행 파일
|
|
["node", str(HERE / "helper_166_1_note_options.cjs")],
|
|
input=json.dumps(payload, ensure_ascii=False),
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
timeout=60,
|
|
)
|
|
assert proc.returncode == 0, proc.stderr
|
|
return json.loads(proc.stdout)["lines"]
|
|
|
|
|
|
def test_배관_옵션_줄은_폼_컨테이너_그대로(ts_lines):
|
|
pipe = ts_lines[0]
|
|
assert pipe[0] == "관: 관경 800"
|
|
# 집수정 갈래 칸만 · 빈 동물이동형 = 폼 기본 「유」 · 흙막이 옛 값은 안 씀
|
|
assert pipe[1] == "관 보호공(유입): 구조 집수정 · 형태 L형 · 높이 1.3m · 동물이동형 유"
|
|
assert "10m" not in pipe[1]
|
|
assert pipe[2].startswith("관 보호공(유출): 구조 흙막이 · 형태 돌 쌓기(찰) · 길이 10m")
|
|
assert "기준측점 전 5m · 기준측점 후 5m" in pipe[2]
|
|
|
|
|
|
def test_정의_그룹_종류는_그룹마다_한_줄_옵션_없으면_줄_없음(ts_lines):
|
|
assert ts_lines[1] == [
|
|
"옹벽: 형태 돌쌓기(찰) · 길이 12m · 높이 2.5m · 기준측점 전 6m · 기준측점 후 6m"
|
|
]
|
|
assert ts_lines[2] == []
|
|
|
|
|
|
def test_B07_은_같은_TS_를_Node_번들로_받아_같은_줄(ts_lines):
|
|
things = [{**thing, "name": thing["type_id"], "pipe": False, "at": 0.0} for thing in THINGS]
|
|
got = with_option_lines(things)
|
|
assert [thing["option_lines"] for thing in got] == ts_lines
|
|
|
|
|
|
def test_조합_줄_뒤에_옵션_줄_미지정도_옵션_줄():
|
|
thing = {
|
|
"name": "옹벽",
|
|
"pipe": False,
|
|
"at": 40.0,
|
|
"summary_item": None,
|
|
"group_items": None,
|
|
"option_lines": ["옹벽: 높이 2.5m"],
|
|
}
|
|
assert structure_note_lines([thing], 40.0) == ["옹벽 조합 미지정", "옹벽: 높이 2.5m"]
|
|
|
|
|
|
def test_화면은_구조물마다_옵션_줄을_붙임():
|
|
cad = (ROOT / "B06_Section" / "B06_Section_UI_Cross_Detail_Cad.ts").read_text("utf-8")
|
|
assert "structureOptionLines({ type_id, options: options ?? {} }, byId.get(type_id))" in cad
|
|
assert "...(thing.optionLines ?? [])" in cad
|