Files
Aislo/resources/tester/test_b07_standard_figure_reason.py
T
eomsangdonandClaude Opus 5 f20213592c feat(b08): 구조물도 엔진·창구·화면 조각을 B07 에서 B08 로 이관
- 장 나눔·제원 입력 엔진과 기울기 판정 대상을 B08 로 옮김
- 창구를 /quantity/structure-sheets 로 옮기고 기초잡석 두께·지반 갈래를 함께 넘김
  (옛 B07 창구는 두께를 안 넘겨 원단위 탭과 값이 갈렸음)
- 구조물도 탭 조각 renderStructureSheets 신설 — 탭 등록은 브레인 몫이라 안 붙임
- B07 표준도 목록은 탭 배선 날까지 B08 엔진·창구를 불러 그대로 둠

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

82 lines
3.1 KiB
Python

"""표준도 — 그림이 **안 서는 까닭을 화면에 드러낸다** (2026-09-09 사용자 지시).
빈 자리를 그냥 두면 사용자가 「고장인가」로 읽는다. 장마다 **왜 그림이 없는지와 무엇을
받아야 서는지**를 표 위에 한 줄 적는다.
⚠ **큰돌쌓기를 그림 대상에서 뺐다** — 그림은 두께를 **뒷길이**에서 내는데 큰돌쌓기는 규격이
**직경**이라 영영 못 그렸다(품셈 13-6 직경 ↔ 13-4 뒷길이). 식은 만들지 않는다 —
「직경에서 두께를 내는 법」은 도메인 판단이라 사용자 몫이다.
⚠ 그림 대상과 **기울기 판정 대상은 다른 목록**이다 — 한 벌로 묶었더니 큰돌쌓기를 그림에서
뺄 때 **장 제목의 「1:0.3」까지 사라졌다**(화면 실측에서 잡음).
"""
from __future__ import annotations
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from B07_DesignDetail.B07_DesignDetail_Engine_Cad_StandardFigure import ( # noqa: E402
FIGURE_TYPE_IDS,
SLOPE_TYPE_IDS,
figure_reason,
)
from B07_DesignDetail.B07_DesignDetail_Engine_Cad_StandardSheet import ( # noqa: E402
build_standard_drawing,
)
from B08_Quantity.B08_Quantity_Engine_StructureSheet import sheet_title # noqa: E402
def _sheet(type_id: str, **options) -> dict:
return {
"key": type_id,
"title": type_id,
"type_id": type_id,
"height_m": 2.5,
"options": {"height_m": 2.5, **options},
"rows": [{"name": "콘크리트", "unit": "㎥", "amount": 1.0, "basis": "시험"}],
"member_count": 1,
"unit_label": "m당",
}
def test_뒷길이가_없으면_무엇을_고르면_되는지_적는다() -> None:
reason = figure_reason(_sheet("masonry_wet"))
assert reason is not None and "뒷길이" in reason and "섭니다" in reason
def test_뒷길이가_있으면_까닭이_없다() -> None:
assert figure_reason(_sheet("masonry_dry", back_len_cm=35)) is None
def test_큰돌쌓기는_그림_대상에서_빠지고_까닭이_적힌다() -> None:
assert "boulder_masonry" not in FIGURE_TYPE_IDS
reason = figure_reason(_sheet("boulder_masonry", stone_cm="60~80"))
assert reason is not None and "직경" in reason
def test_기울기_판정은_큰돌쌓기에도_남는다() -> None:
"""그림 대상 목록으로 판정하면 장 제목에서 「1:0.3」이 사라진다 — 목록을 갈라 둔 자리."""
assert "boulder_masonry" in SLOPE_TYPE_IDS
title = sheet_title(
{"name": "큰돌쌓기", "type_id": "boulder_masonry", "height_m": 2.5, "options": {}}
)
assert "1:0.3" in title
def test_까닭이_도면에_한_줄로_실린다() -> None:
drawing = build_standard_drawing(
"standard_sheet_1",
"표준도 1장",
{"sheets": [_sheet("retaining_wall")], "structure_count": 1},
)
texts = [
(entity.get("shapeData") or {}).get("label", "")
for entity in drawing["entities"]
if entity.get("type") == "Text"
]
assert any("그림 없음" in text for text in texts), texts