Files
Aislo/resources/tester/test_778_5_hopyo_units.py
T
eomsangdonandClaude Opus 5.5 7fd47cf727 chore(853-3): 호표 계보 죽은 것 걷음 — 묶음 ①
- 지움(부르는 곳 다시 찾음 — 저장소 전체 · 조립 주소 · 라우터 · 시험 · 도우미)
  · M02_Hopyo_SkUnit(import 0 · 시험 778-5 · 780-1 만) · M02_Hopyo_Item(길 hopyo-item 하나만)
  · 길 GET hopyo/{키}/{번}/siblings · POST hopyo-item(TS · JS 0 — 화면 [구조물 조합으로]는 구조물 조합 길을 바로 부름) + 그 몸 Build* 다섯
  · Library_Ask.ask_item · labor_finger(Hopyo_Item 만 부름)
  · Hopyo_Sangeun.Maker · _doc(만드는 곳 0) · Hopyo_Elem.prices · Hopyo_Units.hopyo_unit · summary(부르는 곳 0 · 시험만)
- 시험: test_572_hopyo_same 지움(Maker 만 봄) · test_705_2 구조물 조합으로 넷 지움 · test_778_5 단위 SK 셈 줄 뺌(줄 잇기 결과는 그대로 · 연결 표 셈은 시험 안에서) · test_780_1 단위 SK 판정 뺌(블록 · 부름 수 · 빈 블록 밖은 그대로)
- helper_728_2_cover_unit.cjs 는 SkUnit 안 부름(Cover_Model 을 봄) — 남김
- 서버 길 484 → 482(뜻한 둘만)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 14:47:45 +09:00

123 lines
6.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""778-5 줄 잇기 한 벌 · 블록 = 줄 판정 모음(D-2 · D-3 · 요구 622 · 623 · 624).
- 줄 잇기(`M02_Hopyo_Units`) — 작업반장 = 건설업 · 숫자 규격 치수 차례 · 구분자 무관 · 글자 규격 = 고를 것 ·
손료율 = 자재 줄 방법 · 우리에 없는 율 항목(설치비 · 제경비) = 율 줄 · 여덟 파일 묶음별 수 굳힘
층 = 임시 폴더 · M01 · 마스터 읽기만.
"""
from __future__ import annotations
import pytest
from M02_MasterTemplete import M02_Hopyo_Material as hmat
from M02_MasterTemplete import M02_Hopyo_Sangeun as sangeun
from M02_MasterTemplete import M02_Hopyo_Units as units
from resources.tester import helper_m02_hopyo_golden as golden
# 여덟 파일 불리는 블록 줄 연결 표(778-5 D-2 · 바닥값 — 이어짐은 이 수 이상 · 고를 것 · 못 이음은 이 수 이하 ·
# 마스터 · 기계 자료가 좋아지면 바닥이 오름 · 줄 수는 엑셀 몫이라 그대로)
TABLE = {
"L": {"이어짐": 366, "고를 것": 0, "못 이음": 0},
"X": {"이어짐": 187, "고를 것": 1, "못 이음": 2}, # 812-9 찾기 · 못 이음 = 조합 · 괄호 깨짐
"M": {"이어짐": 71, "고를 것": 55, "못 이음": 4},
"R": {"이어짐": 150, "고를 것": 2, "못 이음": 0},
"S": {"이어짐": 3, "고를 것": 0, "못 이음": 0},
"E": {"이어짐": 1, "고를 것": 0, "못 이음": 0},
}
ALL_LINKED = 161 # 815-3 호표 기계 글 쌍점 · 율 꼬리 뗌 — 줄이 다 이어진 블록 수 바닥
BLOCKS = 206
@pytest.fixture(scope="module")
def us():
return units.Units()
def test_작업반장_건설업_기본(us):
got = us.line({"묶음": "L", "이름": "작업반장", "직종": "작업반장", "품": 0.1})
assert got["상태"] == units.LINKED and got["단위"] == {"노임": "LB000001"} # 건설업
assert got["꼬리표"] == ["기본 — 건설업 작업반장"] and got["후보"][0]["키"] == "LB000261"
one = us.line({"묶음": "L", "이름": "보통인부", "직종": "보통인부", "품": 0.5})
assert one["단위"] == {"노임": "LB000002"} and not one["꼬리표"]
def test_숫자_규격_차례_구분자_무관_글자_규격_후보(us):
assert hmat.dims("600×1200") == hmat.dims("1200x600 mm") == hmat.dims("1200*600㎜")
assert hmat.dims("1종2류(철재)") is None and hmat.lettered("1종2류(철재)")
assert not hmat.lettered("600*1200mm") and not hmat.lettered("#20, 0.9mm")
for spec in ("600×1200", "1200x600", "1200 X 600mm"):
got = us.line({"묶음": "M", "이름": "유로폼패널", "규격": spec, "단위": "매", "품": 1})
assert got["상태"] == units.LINKED and got["단위"] == {"자재": "MT000467"}, spec
named = us.line({"묶음": "M", "이름": "유로폼(패널)(600×1200)", "단위": None, "품": 1})
assert named["단위"] == {"자재": "MT000467"} # 「유로폼(패널)」 = 유로폼패널 · 단위 없는 EST 줄
paint = {"묶음": "M", "이름": "광명단조합페인트", "규격": "1종2류(철재)", "단위": "L", "품": 1}
got = us.line(paint)
assert got["상태"] == units.PICK and got["글"] == units.LETTERS and got["후보"]
def test_손료율_자재_줄_율_항목_율_줄(us):
wear = us.line({"묶음": "M", "이름": "유로폼패널", "규격": "600×1200", "품": 0.267,
"손료율": 0.267}) # fmt: skip
assert wear["방법"] == units.WEAR and wear["상태"] == units.LINKED
setup = {"묶음": "R", "이름": "설치비(재료비의 5%)", "품": 0.05, "기준꼴": "자재"}
assert us.line(setup)["단위"] == {"기준": "재료", "비목": "재료비"} # 우리에 없는 율 항목
rest = {"묶음": "R", "이름": "제경비(노무비의 60%)", "품": 0.6, "기준꼴": "노무비"}
assert us.line(rest)["단위"] == {"기준": "노무비", "비목": "경비"}
lost = us.line({"묶음": "R", "이름": "기구손료(노무비의 9%)", "기준": "노무비", "품": 0.09})
assert lost["상태"] == units.PICK and lost["후보"] == [{"기준": "노무비", "비목": "경비"}]
def test_글_붙은_규격_수_배율_같이_씀_같은_수는_한_번(us):
"""827-6 — 「#200.9mm200.4m/kg」(#20 0.9mm 200.4m/kg 글 붙음) = 어닐링철선 이음 · 같은 수 두 번
맞춤(블레이드 320 · 3.2 → 4"×3.2) · 이름 다른 드릴롯드 = 이음 안 함 · 21-17-17 의 17 둘."""
def got(name, spec=""):
return us.line({"묶음": "M", "이름": name, "규격": spec, "품": 1})
wire = got("어닐링철선(결속선)(#200.9mm200.4m/kg)")
assert wire["상태"] == units.LINKED and wire["단위"] == {"자재": "MT000209"}
assert got("블레이드", "d=320~400mm t=3.2")["상태"] != units.LINKED
assert got("유압식드릴롯드", "T38×R32x3660mm")["상태"] != units.LINKED
assert got("복합비료(21-17-1720kg/포)")["단위"] == {"자재": "MT006490"}
@pytest.fixture(scope="module")
def table(us):
rows, full, blocks = [], 0, 0
for tag in golden.FILES:
hp = golden.read(tag)
_, first = sangeun.calls(hp)
for b in hp["단산"]:
if int(b["번"]) not in first:
continue
got = [(o["묶음"], us.line(o)["상태"]) for o in b.get("항목") or [] if not o.get("밖")]
rows += got
blocks += 1
full += all(s == units.LINKED for _, s in got)
out: dict[str, dict[str, int]] = {}
for kind, state in rows:
one = out.setdefault(kind, dict.fromkeys((units.LINKED, units.PICK, units.NONE), 0))
one[state] += 1
return out, full, blocks
def _floor(got: dict, kind: str) -> None:
want = TABLE[kind]
assert sum(got[kind].values()) == sum(want.values()), kind # 줄 수 = 엑셀 몫
assert got[kind][units.LINKED] >= want[units.LINKED], kind
assert got[kind][units.PICK] <= want[units.PICK], kind
assert got[kind][units.NONE] <= want[units.NONE], kind
def test_여덟_파일_줄_연결_표(table):
got, _, blocks = table
assert set(got) == set(TABLE) and blocks == BLOCKS
for kind in "LXRSE":
_floor(got, kind)
def test_여덟_파일_자재_줄_연결_표(table):
got, full, _ = table
_floor(got, "M")
assert full >= ALL_LINKED