# ruff: noqa: F811 — 임시 층 fixture(world)를 test_m02_labor_ref 에서 받아 씀 """일위대가 · 사전조합 줄 덮개 · [단가산출로 저장] · 단위 빈칸 막기(PLAN 715-3) — 임시 storage. 줄 덮개 = 그 줄에만(단가산출 원본 그대로) · 값 = 같은 덮개 SK 값 = 손셈 · 줄 고름(차례)이 뺀줄 뒤 제자리 · [단가산출로 저장] = 새 SK + 참조 줄 · 같은 값 · 단위 빈칸 400 · 덮개 없는 줄 = 옛 값. """ 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_Ref as refs from M02_MasterTemplete import M02_MasterTemplete_Store as store from resources.tester.test_222_1_m02_apart import raw_line from resources.tester.test_m02_labor_ref import MINE, world # noqa: F401 — 같은 임시 층 PCT = "GC001109" # 원/㎡ · 인력 둘(LB000036 · LB000002) + 「노무비 * 3 / 100」 TWO_MATS = "GC000565" # 원/m · 재료 줄 둘 COVER = {"덮개": {"labor:LB000036#0": {"qty": 0.5}}} def _whole(): return m01.loaded()[1] def _sc(folder, lines, unit="㎡"): with store.at(folder): return refs.create("precombo", {"이름": "조합", "단위": unit, "담은로직": lines})["이름"] def _value(folder, key): """안 줄 수량 = 모두 1(723-1 · 저장 안 함 → 쓰는 쪽 알약 값).""" ref = {**MINE, "키": key} with store.at(folder): lines = refs.read_ref(ref)["담은로직"] given = {f"{refs.ref_id(ref)}#{i}": 1 for i in range(len(lines))} return refs.Expand(_whole(), given=given)(ref) def test_refusals(world): with store.at(world["personal"]): with pytest.raises(store.StoreError, match="단위가 빔"): refs.create("precombo", {"이름": "x", "단위": " ", "담은로직": [{"로직": PCT}]}) assert refs.create("precombo", {"이름": "빈 새 문서", "단위": None, "담은로직": []})["이름"] bad = {"로직": PCT, "패치": {"더한줄": [{"참조": {**MINE, "키": "SK-000001"}, "수량": 1}]}} with pytest.raises(store.StoreError, match="참조 못 넣음"): labor.clean({"담은로직": [bad]}) with pytest.raises(store.StoreError, match="수가 아님"): labor.clean( {"담은로직": [{"로직": PCT, "패치": {"덮개": {"labor:LB000036#0": {"qty": "식"}}}}]} ) sc = _sc(world["personal"], [{"로직": PCT}]) with pytest.raises(store.StoreError, match="줄 덮개는"): labor.clean({"담은로직": [{"참조": {**MINE, "키": sc}, "패치": COVER}]}) def test_no_patch_same_value(world): """덮개 없는 줄 = 로직 줄 값 그대로(문서 셈 · 855-E 2-E4).""" sc = _sc(world["personal"], [{"로직": PCT, "패치": {}}]) with store.at(world["personal"]): assert "패치" not in store.read("precombo", sc)["문서"]["담은로직"][0] assert _value(world["personal"], sc)["기준"]["계"] == pytest.approx(raw_line(PCT)["기준"]["계"])