Files
Aislo/resources/tester/test_m02_labor_national.py
eomsangdonandClaude Sonnet 5.5 2d9a469fc7 feat(806-1): 구조물 조합 일위대가 보기 = 일위대가 컨테이너 한 부품 · 단가산출 줄 = 그 SK 문서 모달(수식 탭 · 저장 = 그 SK)
- 조합 상세 · 카드 · 서고 모두 Labor_Table 한 부품 — 조합 전용 칸(면적 잇기 · 수량산출 모달 · 규격 열 · 다이어그램)은 새 Labor_Combo
- 단가산출(SK) 참조 줄 누름 = 새 Labor_SkEdit — 그 SK 문서를 단가산출 상세 부품(수식 탭 첫 화면)으로 열고 [저장] = 수식 저장 → SK 문서 저장 → 일위대가 금액 다시 셈 · 위 층 SK = 읽기만 · 두 번 눌러도 모달 하나
- 옛 조합 전용 표 · 단가산출 보기 모달(Labor_SangeunModal) 지움 · 전국 자재 줄은 Labor_Table 이 그림
- 새 시험 test_806_1_labor_view · 소스 지킴 시험 12 개를 새 자리(Labor_Table · Labor_RowModal · Labor_SkEdit)로 고침 — 옛 Detail 자리 문구가 없어져 낡았음

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 16:31:49 +09:00

102 lines
3.9 KiB
Python

"""「전국」 자재 줄(PLAN 361-2 · `M02_MasterTemplete_Labor_National`) — 사전조합 `본뜬.전국자재` 를
상세 자재목록 아래 보기 전용 표로(있으면 줄 · 없으면 안 보임 · 단추 없음 · 금액 칸 비움 ·
글 명사형) · 읽기 길(사전조합 GET 의 `layers.read_template`)이 `본뜬.전국자재` 를 그대로 줌 ·
확인 창 세 칸 = 만들기에 적힐 값(`세칸`).
층은 임시 폴더.
"""
import json
import os
import re
import subprocess
from pathlib import Path
# 올리기 길 시험의 `client` 마당을 같이 씀
# ruff: noqa: F811
from resources.tester.test_m02_hopyo_excel import URL, _post, client # noqa: F401
HERE = os.path.dirname(os.path.abspath(__file__))
M02 = Path(HERE).parents[1] / "M02_MasterTemplete"
REMICON = {
"이름": "레미콘(전국)-관급",
"규격": "25-21-120",
"단위": "㎥",
"수량": {"손": 2.5},
"별도계상": "별도계상",
"자재구분": "관급",
}
def _rows(origins: list) -> list:
proc = subprocess.run(
["node", os.path.join(HERE, "helper_m02_labor_national.cjs")],
input=json.dumps({"origins": origins}, ensure_ascii=False),
capture_output=True,
text=True,
encoding="utf-8",
check=False,
)
assert proc.returncode == 0, proc.stderr
return json.loads(proc.stdout)
def test_전국_자재_줄_있는_것_없는_것():
have, plain, empty, none = _rows(
[
{"층": "personal", "주인": "7/42", "키": "HP-000001 제1호표", "전국자재": [REMICON]},
{"층": "personal", "주인": "7/42", "키": "HP-000001 제3호표"},
{"층": "personal", "주인": None, "키": "k", "전국자재": []},
None,
]
)
assert have["title"] == "전국 자재 — 지역은 프로젝트에서 · 금액 없음(보기만)"
assert have["heads"] == [
"코드",
"이름",
"규격",
"수량산출",
"단위",
"자재구분",
"별도계상",
"운반비",
"반영 금액",
]
assert have["rows"] == [
[
"전국",
"레미콘(전국)-관급 지역은 프로젝트에서",
"25-21-120",
"2.5",
"㎥",
"관급",
"별도계상",
"포함", # 빈 칸 = 기본값 글
"—", # 금액 칸 비움
]
]
assert have["buttons"] == 0 # 고침 · 삭제 없음(보기만)
assert plain["count"] == empty["count"] == none["count"] == 0 # 없으면 안 보임
def test_소스_보기만_명사형_자리():
code = (M02 / "M02_MasterTemplete_Labor_National.ts").read_text(encoding="utf-8")
words = re.findall(r'"([^"]*[가-힣][^"]*)"', code)
assert words and not [w for w in words if re.search(r"(합니다|해요|한다|하세요)", w)]
assert "createButton" not in code and "fetch" not in code and "sessionStorage" not in code
detail = (M02 / "M02_MasterTemplete_Labor_Table.ts").read_text(encoding="utf-8") # 806-1
assert "...nationalRows(cur.본뜬)" in detail and len(detail.splitlines()) <= 700
api = (M02 / "M02_MasterTemplete_Labor_Api.ts").read_text(encoding="utf-8")
assert "전국자재?: NationalMat[]" in api
def test_복사_때_실무자료_본뜬과_전국자재_지킴():
from M02_MasterTemplete import M02_Labor_Ref as refs
ref = {"층": "personal", "주인": "7/42", "키": "SC-000001"}
mine = {"층": "실무자료", "키": "HP-000001 제1호표", "전국자재": [REMICON]}
kept = refs.origin_mark({"본뜬": mine}, ref)["본뜬"]
assert kept["키"] == "HP-000001 제1호표" and kept["전국자재"] == [REMICON] # 덮지 않음
assert kept["복사원본"] == ref # 원본 참조는 다른 칸
assert refs.origin_mark({"본뜬": None}, ref)["본뜬"] == ref # 보통 문서 = 옛 그대로
assert refs.origin_mark({"본뜬": {"층": "system", "키": "A"}}, ref)["본뜬"] == ref