"""SK 바탕 재료 = M01 기초 그대로 셈(PLAN 747-1) — 별도계상 빈 칸 = 직접계산 · 고른 줄만 밖 · 일위대가 덮개 줄(`M02_Labor_Patch.run`)은 일위대가 기본(별도계상) 그대로.""" import pytest from M01_MasterData import M01_MasterData_Store as m01 from M02_MasterTemplete import M02_Labor_Doc as labor from M02_MasterTemplete import M02_Labor_Patch as patch from M02_MasterTemplete import M02_Sangeun_Calc as calc from M02_MasterTemplete import M02_Sangeun_Doc as sd FORM = "GC000211" # 6-3-1 합판거푸집 — 합판 1.03 · 각재 0.038 · 폼타이 0 · 소모자재 = 재료비 % PLY = "material:합판(내수 12㎜)#0" def _whole(): return m01.loaded()[1] def _run(**doc): whole = _whole() clean = sd.clean({"키": "SK-000001", "이름": "시험", "단위": "㎡", **doc}, None, whole) return labor._json(calc.run(clean, whole)) def test_base_materials_count_like_m01(): m01_ = labor._json(labor.run_line(_whole(), FORM, None)) got = _run(바탕={"로직": FORM}) assert got["기준"]["재료비"] == pytest.approx(m01_["기준"]["재료비"]) assert got["기준"]["계"] == pytest.approx(m01_["기준"]["계"]) qty = {x["cid"]: x["수량"] for x in got["줄"]} assert qty[PLY] == pytest.approx(1.03) assert qty["material:폼타이 12.7㎜#0"] == 0 # M01 수량 0 = 0 그대로 def test_cover_and_explicit_apart(): base = _run(바탕={"로직": FORM}) more = _run(바탕={"로직": FORM}, 덮개={PLY: {"qty": 2}}) ply = next(x for x in base["줄"] if x["cid"] == PLY) assert more["기준"]["재료비"] > base["기준"]["재료비"] + ply["단가"] * 0.9 out = _run(바탕={"로직": FORM}, 자재표시={PLY: {"별도계상": "별도계상"}}) assert all(x["cid"] != PLY for x in out["줄"]) assert out["기준"]["재료비"] < base["기준"]["재료비"] - ply["금액"] + 1 def test_hopyo_line_keeps_line_default(): whole = _whole() line = {"로직": FORM, "입력값": {}, "패치": {"덮개": {PLY: {"qty": 2}}}} got = labor._json(patch.run(whole, line)) assert all(x["cid"] != PLY for x in got["줄"]) # 일위대가 기본 = 별도계상(222-1)