Files
Aislo/resources/tester/test_52_14_etc_text.py
T
eomsangdonandClaude Opus 5.5 281c71b55b refactor(logic): 348-1 순수 계산 TS 49 파일 <페이지>/logic/ 로 옮김 — 이름 앞머리 그대로 · 동작 고침 없음
- 옮김: B04 2 · B05 23 · B06 11 · A00_Common/design 13 (9,299 줄) · 이미 logic/ 에 있던 16 파일 그대로
- 안 옮김: 묶음 입구(package.json build:*) · 파이썬 · 순수지만 계산 아닌 8 (보기 결선 · 콜백 · API 타입 · 갈아끼움 알림판)
- import 266 줄(142 파일) · 시험 · 주석 · 짝 표시 문자열 경로 고침 · B05 · B06 CLAUDE.md 짝 줄 logic/
- 시험 도우미 새 경로: 가짜 require 열쇠 · B05()/B06() 부름 · 형제 import 자리 · tsc 묶어 돌리는 시험 · 정규식 · rglob
- design_view_cross 줄 한도 시험 685 → 688 (긴 import 경로 줄바꿈 3줄)
- 확인: typecheck 0 · 서버 묶음 넷(corridor · server-calc · b07-extent · b07-note) 다시 지어 코드 같음(//#region 경로 주석만 다름) · 관련 시험 270 파일 — 남은 실패 19 는 옮기기 전과 같음

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014utrjfoW831Vc5wJUd13kL
2026-10-16 13:44:50 +09:00

107 lines
3.9 KiB
Python

# -*- coding: utf-8 -*-
"""공용 틀 글 손 입력 · 기타 선택 컨테이너 · 기타 이름 = 집계 건 이름 — PLAN 52-14.
순수 규칙은 Node 헬퍼(`helper_52_structure_spec.cjs etc`)가 돌림 ·
화면은 ORCA `ui_checks/52-10_노면공_기타.js`(52-14 덧).
"""
import json
import os
import re
import subprocess
import pytest
from M02_MasterTemplete import M02_Table_Fill as fill
from M02_MasterTemplete.M02_Table_Fill_Spec import SPEC_CONTAINERS, container_rows, etc_label
from resources.tester.test_structures_summary_snapshot import ( # noqa: F401 — world 고정물
MS,
RV,
_save,
world,
)
HERE = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.dirname(os.path.dirname(HERE))
@pytest.fixture(scope="module")
def out():
proc = subprocess.run(
["node", os.path.join(HERE, "helper_52_structure_spec.cjs"), "etc"],
capture_output=True,
text=True,
encoding="utf-8",
timeout=60,
)
assert proc.returncode == 0, proc.stderr
return json.loads(proc.stdout)
def test_기타_선택_컨테이너_상세_내용(out):
assert out["same"] is True
assert out["containers"] == [["detail", "상세 내용", False, "etc_detail", "getcdetail"]]
assert out["items"] == [["note", "비고", "text"]]
assert out["links"] == ["getcdetail1", "getcdetail2"]
def test_글_저장_비우기_길이_상한(out):
assert out["state"] == {"detail": [{"note": "옛 비고"}, {"note": "둘째"}]} # n 차례대로 당김
edited = out["edited"]
assert edited["etc_detail_1_note"] == "새 비고" # 앞뒤 빈칸 뺌
assert edited["etc_detail_2_note"] == "" # 비운 인스턴스도 자리를 지킴(잇기 · 집계 줄)
assert out["longLen"] == out["max"] == 100
assert out["keys"] == {"keys": [], "prefixes": ["etc_detail_"]}
def test_이름_표에_글_항목(out):
assert out["names"] == {"detail": "상세 내용", "detail.note": "비고"}
def test_기타_이름이_집계_건_이름():
assert etc_label("etc", {"name": " 배수판 "}) == {"그룹": "배수판"}
assert etc_label("etc", {"name": ""}) == {"그룹": "기타"}
assert etc_label("etc", {}) == {"그룹": "기타"}
assert etc_label("pipe", {"name": "x"}) == {}
item = {
"type_id": "etc",
"options": {"name": "배수판", "etc_detail_1_note": "왼쪽", "etc_detail_2_note": ""},
"복사본": "st1",
"그룹": "배수판",
}
rows = container_rows(item, {"getcdetail1": RV, "getcdetail2": MS})
assert [r["그룹"] for r in rows] == ["배수판 1", "배수판 2"]
assert [r["복사본"] for r in rows] == ["st1__getcdetail1", "st1__getcdetail2"]
assert [r["summary_item"] for r in rows] == [RV, MS]
assert rows[0]["options"]["note"] == "왼쪽"
def test_집계_모음에_기타_이름과_컨테이너_건(world): # noqa: F811 — 고정물
root = world["root"]
etc = {
"structure_id": "etc1",
"type_id": "etc",
"placement": "point",
"chainage_m": 60.0,
"options": {"name": "배수판", "etc_detail_1_note": "왼쪽"},
"group_items": {"getcdetail1": RV},
}
blank = {**etc, "structure_id": "etc2", "chainage_m": 80.0, "options": {"name": ""}}
_save(root, [etc, blank], [])
items = {i["복사본"]: i for i in fill.collect_items(root)}
assert items["etc1"]["그룹"] == "배수판"
assert items["etc1__getcdetail1"]["그룹"] == "배수판 1"
assert items["etc1__getcdetail1"]["summary_item"] == RV
assert items["etc2"]["그룹"] == "기타"
def test_서버_컨테이너_표는_기타_명세와_짝():
with open(
os.path.join(ROOT, "A00_Common/design/logic/design_structure_road.ts"), encoding="utf-8"
) as f:
text = f.read()
found = re.findall(
r'title: "([^"]+)",\s*required: false,\s*prefix: "(\w+)",\s*link: "(\w+)"', text
)
assert [(p, link, t) for t, p, link in found] == list(SPEC_CONTAINERS["etc"])