Files
Aislo/resources/tester/test_b06_detail_options.py
T
eomsangdonandClaude Opus 5 cfa7da2069 fix(b05): 비워 두는 것이 뜻인 칸에 빈 보기를 둠 — 첫 보기가 박히던 것
구조물 폼 select 는 「기본값 없는 필수」만 빈 보기를 두어, `empty_means` 가 적힌 칸도
첫 보기가 골라진 채 저장됐다. `fill_concrete_mpa` 가 180 으로 박혀 엔진 기준값
210(확정 ⑩)과 갈렸다 — 채움콘크리트 규격·단가가 조용히 달라지는 자리.

빈 보기 판정을 「필수 + empty_means」 한 줄(`keepEmpty`)로 합치고 초기값도 같은 판정을 씀.
기본값이 있는 칸은 그대로 첫 보기를 쓴다(2026-08-17 지시 유지).
클라이언트 옵션 타입에 empty_means 를 더함 — 서버는 이미 실어 보내고 있었다.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fe1QWPTfw11PaKh2LjwXdR
2026-09-13 10:04:52 +09:00

66 lines
3.5 KiB
Python

"""상세 제원(뒷길이·돌규격·형식)을 **B06 에서 받는지** — 2026-09-08 데스크탑 창 보고.
무슨 일이었나 — 레지스트리는 그 칸들을 `phase: "detail"` 로 두고 「B05 는 유무·종류·위치만,
상세 치수는 B06/B07 에서」(2026-08-17 사용자 확정)로 갈라 놓았는데, **그 화면이 아직 안 받고
있었다.** 그래서 실무 프로젝트의 구조물 옵션에 `back_len_cm`·`stone_cm`·`form` 이 통째로 비어
있었고, **수량이 품셈 갈래를 못 골라** 금액이 0 으로 남았다(13-4 돌쌓기 뒷길이 · 13-6 큰돌쌓기
직경 · 12-3 옹벽 형식).
고침 — 폼이 `includeDetail` 을 받아 **B06 에서만** 상세 칸까지 그린다. B05 는 종전 그대로다.
"""
import sys
from pathlib import Path
PROJECT_ROOT = Path(__file__).resolve().parents[2]
if str(PROJECT_ROOT) not in sys.path:
sys.path.insert(0, str(PROJECT_ROOT))
from B05_Profile.B05_Profile_Structures_Schema import load_structure_types # noqa: E402
_PANEL = PROJECT_ROOT / "B05_Profile" / "B05_Profile_UI_Structures_Panel.ts"
_B06 = PROJECT_ROOT / "B06_Section" / "B06_Section_UI_Page_Structures_Panel.ts"
_B05 = PROJECT_ROOT / "B05_Profile" / "B05_Profile_UI_Panel.ts"
def _type(type_id: str):
return next(item for item in load_structure_types() if item.type_id == type_id)
def test_B06_은_상세_칸까지_받는다():
assert "includeDetail: true" in _B06.read_text(encoding="utf-8")
def test_B05_는_종전대로_유무_종류_위치만():
"""2026-08-17 사용자 확정 — B05 폼에 상세 칸이 생기면 안 된다."""
assert "includeDetail" not in _B05.read_text(encoding="utf-8")
def test_기본값_없는_필수_항목은_빈_칸으로_연다():
"""첫 항목을 슬쩍 고르면 **근거 없는 값**(뒷길이 25㎝ 같은)이 수량·단가로 흘러간다."""
panel = _PANEL.read_text(encoding="utf-8")
# 2026-09-13 — 빈 보기를 두는 까닭이 둘이 되어(필수 + `empty_means`) 한 줄로 합쳐졌다.
# 필수 칸의 글자는 그대로 「— 선택 —」이다.
assert 'choices.unshift(["", mustPick ? "— 선택 —" : "— 안 정함 —"])' in panel
assert 'option.required === true && (option.default ?? "") === ""' in panel
def test_큰돌쌓기에_메_찰_구분이_있다():
"""품셈이 13-6-1 메쌓기 / 13-6-2 찰쌓기로 갈라 두는데 구분 칸이 없어 못 골랐다
(2026-09-08 데스크탑 창 요청). 돌쌓기는 이미 타입이 갈려 있다(찰/메)."""
bond = next(o for o in _type("boulder_masonry").options if o.key == "bond")
assert bond.choices == ["메쌓기", "찰쌓기"]
assert bond.default is None, "기본값을 두면 안 된다 — 설계자가 고를 값이다"
assert bond.required is True
assert bond.phase == "detail", "상세 제원이라 B06/B07 에서 받는다"
def test_규격_축이_타입마다_다르다():
"""⚠ 큰돌쌓기는 **직경**(13-6), 돌쌓기는 **뒷길이**(13-4) — 섞으면 엉뚱한 계수로 돈다
(2026-09-08 데스크탑 창이 실제로 그 결함을 잡았다)."""
stone = next(o for o in _type("boulder_masonry").options if o.key == "stone_cm")
back = next(o for o in _type("masonry_wet").options if o.key == "back_len_cm")
assert stone.choices == ["40~60", "60~80", "80~100"], "큰돌쌓기 = 직경 축"
assert "35" in back.choices and "75" in back.choices, "돌쌓기 = 뒷길이 축"
assert set(stone.choices).isdisjoint(set(back.choices))