- 지움(git rm) 10 파일 3,374 줄: M02_Hopyo_Finger · Ours · Option · Fit · Combine · Verdict · Line · SkLink · SkPatch · Basis
- Match: 흐름 몫(candidates · name_cands · fix_typo · clause · b_order · _logic_specs · _line_mod · units_of · _state · view · guess · picks · chain) 지움 · 이름 도구 몫 · line_key 남김
- Words: conds · cond_score · close · cosine · jacc 지움 / Shares: sections 지움(trade · eq_key 남김)
- 옮김: Finger.kind_of → Fixed.kind_of · SkLink(sk_line · kept · left · LEFT · WHY) → Sangeun · SkPatch 기계 몫(MACH_IN · MACHINE · SOLO · _mach_logics) → Units.mach_logics
- Sangeun: 옛 /sangeun 몸(build · _sure · Maker.basis · judge · plan · make) 지움 · Kids: first · proposal · order 지움 · Build: build() · unlinked() 지움(모두 고정 Builder · build_all · _order · _origins 남김)
- Router: 옛 길 지움(GET hopyo/{키}/{번} · guess · hopyo-picks · hopyo-build · hopyo-unlinked · hopyo/{키}/sangeun) · GET hopyo/{키} = Judge.view(1차 줄 판정 줄상태 · 만든 · 블록 풀이 셈)
- Marks: 칠 = Judge.judged 만 · Forget: 맞춤 캐시 지움 줄 걷음 · Ledger: Ours.version 판 칸 걷음 · Item: Kids.first 걷음
- Row(덧): 단산 줄 = 장부 짝이 있어도 늘 「2차 필요」(장부 = 1차 후보 힌트만)
시험 정리(까닭 = 지운 길 · 모듈만 시험함):
- 지움 11 파일: test_m02_hopyo_finger · fit · golden · option · ours · basis · seam · flow · draft_calc · test_635 · test_628(지문 · 순위 · 옵션 거꾸로 · 맡은 절 · 옛 확인 흐름)
- 함수 지움: /sangeun · /hopyo-build · /hopyo-unlinked · hopyo-picks · 옛 줄 맞춤 보기를 부르던 것(572 · 718_1 · 729 · 739_1 · 777_1 · 778_5 · 780_1 · labor_national · 705_3 · m02_hopyo_match · 746_1)
- test_621 S2(지문 해시) 지움 · S1 남김 · test_m02_hopyo_build = 장부 길 시험만(PUT 으로 심음)
- 새 길로: 779_2(줄상태 = 1차 판정 · 칠 셈 전 None) · grid · stmate(hopyo-judge 줄 판) · 778_1 · 778_2(Units.mach_logics) · 642_6(Marks 원문) · 642_3 장부 짝 단산 줄 2차 지킴
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
109 lines
6.1 KiB
Python
109 lines
6.1 KiB
Python
"""778-5 줄 잇기 한 벌 · 블록 = 줄 판정 모음 · 단위 SK(D-2 · D-3 · 요구 622 · 623 · 624).
|
||
|
||
- 줄 잇기(`M02_Hopyo_Units`) — 작업반장 = 건설업 · 숫자 규격 치수 차례 · 구분자 무관 · 글자 규격 = 고를 것 ·
|
||
손료율 = 자재 줄 방법 · 우리에 없는 율 항목(설치비 · 제경비) = 율 줄 · 여덟 파일 묶음별 수 굳힘
|
||
- 단위 SK(`M02_Hopyo_SkUnit` · `M02_Hopyo_Sangeun`) — 확인 안 한 블록 안 만듦 · 확인 블록 = 바탕 없는 SK +
|
||
근거 꼬리표 · 고를 줄 남으면 못만듦 · 고르면 만듦 · 다시 올려도 같은 SK 재사용 · 일위대가 = 확인 전 못 이음
|
||
층 = 임시 폴더 · M01 · 마스터 읽기만.
|
||
"""
|
||
|
||
from __future__ import annotations
|
||
|
||
import json
|
||
|
||
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_SkUnit as skunit
|
||
from M02_MasterTemplete import M02_Hopyo_Units as units
|
||
from M02_MasterTemplete import M02_Labor_Doc as labor
|
||
from M02_MasterTemplete import M02_Sangeun_Calc as calc
|
||
from M02_MasterTemplete import M02_Sangeun_Doc as sd
|
||
from resources.tester import helper_m02_hopyo_golden as golden
|
||
from resources.tester.test_m02_hopyo_excel import URL, _post, client, master_hash # noqa: F401
|
||
|
||
# 여덟 파일 불리는 블록 줄 연결 표(778-5 D-2 굳힘 · 바뀌면 까닭 커밋 글)
|
||
TABLE = {
|
||
"L": {"이어짐": 366, "고를 것": 0, "못 이음": 0},
|
||
"X": {"이어짐": 180, "고를 것": 10, "못 이음": 0},
|
||
"M": {"이어짐": 71, "고를 것": 55, "못 이음": 4},
|
||
"R": {"이어짐": 150, "고를 것": 2, "못 이음": 0},
|
||
"S": {"이어짐": 3, "고를 것": 0, "못 이음": 0},
|
||
"E": {"이어짐": 1, "고를 것": 0, "못 이음": 0},
|
||
}
|
||
ALL_LINKED = 156
|
||
|
||
|
||
@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["후보"] == [{"기준": "노무비", "비목": "경비"}]
|
||
# 단위 SK 셈 — 설치비 = 재료 줄 × 5 % · 제경비 = 노무비 × 60 %
|
||
block = {"항목": [
|
||
{"묶음": "L", "이름": "보통인부", "직종": "보통인부", "품": 0.5, "행": 1},
|
||
{"묶음": "M", "이름": "유로폼패널", "규격": "600×1200", "단위": "매", "품": 2, "행": 2},
|
||
{**setup, "행": 3}, {**rest, "행": 4},
|
||
]} # fmt: skip
|
||
got = skunit.judge(block, us, lambda sub: None, None, "㎡")
|
||
assert got["판정"] == skunit.GOOD and [r["상태"] for r in got["줄"]] == [units.LINKED] * 4
|
||
labor_, mat = (got["줄"][0]["우리금액"], got["줄"][1]["우리금액"])
|
||
assert got["줄"][2]["우리금액"] == pytest.approx(mat * 0.05, abs=0.1)
|
||
assert got["줄"][3]["우리금액"] == pytest.approx(labor_ * 0.6, abs=0.1)
|
||
doc = {"키": "SK-000001", "이름": "t", "단위": "㎡", "바탕": None, "더한줄": got["더한줄"]}
|
||
whole = us.whole
|
||
ran = labor._json(calc.run(sd.clean(doc, None, whole), whole))
|
||
assert ran["1단위"]["계"] == pytest.approx(got["우리금액"])
|
||
|
||
|
||
def test_여덟_파일_줄_연결_표(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)
|
||
assert units.summary(rows) == TABLE and (full, blocks) == (ALL_LINKED, 206)
|
||
|
||
|
||
def _sks(folder) -> dict[str, dict]:
|
||
return {p.stem: json.loads(p.read_bytes()) for p in (folder / "sangeun").glob("SK-*.json")}
|