- 값(원문번호)은 그대로 · 글만 바꿈 — M02 사본 저장 · 로직 부름 · 엑셀 이음 그대로 - 서버 GET /api/m02/df/machine-names(로그인만) = 기계 원문번호 → 이름 규격 · 브라우저는 한 번 받아 둠 - 수식 탭 옵션(formula_doc_options) · 단가산출 상세 옵션(calc_sheet varRow) 같은 도우미 · M01 · M02 같이 - 목록이 모두 원문번호 꼴일 때만(빈 칸 뺌) · 문서 선택 목록 원문번호 전수 이름 있음 - test_804_10 셋 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
52 lines
2.4 KiB
Python
52 lines
2.4 KiB
Python
"""804-10(요구 692-2) — 옵션 드롭다운 기계 · 집게 등 원문번호 목록 = 「이름 규격 (원문번호)」 글 · 값은 그대로.
|
|
|
|
① 서버 `GET /api/m02/df/machine-names` = 기계 원문번호 → 「이름 규격」(로그인만)
|
|
② 수식 문서 선택 목록 중 모두 원문번호 꼴인 목록 — 번호마다 이름이 있음(1,518 전수)
|
|
③ 화면 부품 `formula_doc_options.ts` — 글만 바꿈(value = 원문번호) · 이름은 한 번 받아 둠
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import re
|
|
from pathlib import Path
|
|
|
|
from M02_MasterTemplete.DataFlow import M02_DF_Router as df
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
CODE = re.compile(r"^\d{4}-\d{4}$")
|
|
|
|
|
|
def test_기계_이름_표_문서_목록_전수() -> None:
|
|
names = df.get_machine_names()
|
|
assert names["0101-0007"] == "불도저(무한궤도) 7ton"
|
|
lists: list[list[str]] = []
|
|
for f in (ROOT / "resources/master_data/수식문서").glob("*.json"):
|
|
for doc in json.loads(f.read_text(encoding="utf-8")).get("줄") or []:
|
|
for v in doc.get("변수") or []:
|
|
link = v.get("연결") or {}
|
|
got = [str(x) for x in link.get("목록") or []]
|
|
if link.get("갈래") == "선택" and got and all(CODE.match(x) for x in got):
|
|
lists.append(got)
|
|
assert len(lists) > 200
|
|
missing = {x for got in lists for x in got if not names.get(x)}
|
|
assert not missing, sorted(missing)[:10]
|
|
|
|
|
|
def test_옵션_부품_글만_바꿈() -> None:
|
|
src = (ROOT / "A00_Common/formula_doc_options.ts").read_text(encoding="utf-8")
|
|
assert "known[x] ? `${known[x]} (${x})` : x" in src
|
|
assert "list.map((x) => ({ value: x, text: optionText(x) }))" in src
|
|
assert "nameMachines(list, () => f.setOptions(items(), f.select.value));" in src
|
|
api = (ROOT / "M02_MasterTemplete/DataFlow/M02_DF_Api.ts").read_text(encoding="utf-8")
|
|
assert "machineNames ??= fetch(" in api # 한 번만 받음
|
|
main = (ROOT / "main.py").read_text(encoding="utf-8")
|
|
at = main.index("M02_MasterTemplete.DataFlow.M02_DF_Router")
|
|
assert "dependencies=protected," in main[at : at + 120]
|
|
|
|
|
|
def test_상세_탭_옵션_같은_도우미() -> None:
|
|
sheet = (ROOT / "A00_Common/calc_sheet.ts").read_text(encoding="utf-8")
|
|
assert "nameMachines(list, () => f.setOptions(items(), f.select.value));" in sheet
|
|
assert "text: optionText(o)" in sheet
|