- Sangeun: 판정 · 확인 몸 = 모든 블록(북부청 임도 49 → 95) · 줄마다 `부름 [호표 번]`([] = 일위대가 밖) · 밖 블록 = 이름 · 단위 블록 것 · 근거 없음 · 없는 번만 404 · 하위 밖 블록(울진소광 492 → 83)은 확인 목록에 함께 = 하위 먼저 - SkUnit: 줄 0 블록 = 판정 「줄 없음」 고를줄 1 → 확인해도 못만듦(빈 SK 없음) - Marks: 블록마다 `부름` · `줄` · `어긋남` = 모든 블록(밖 포함) · 맞춤셈 `판정` 밖 = None 그대로 - 시험 고침(낡은 기대 = 일위대가 안 블록만): 778-5 units 49 → 95(안 49 따로) · 779-2 어긋남 + 밖 4 · 44 · 48 · 77 · 78 · 779-5 줄 칠 모든 블록 · 778-5 excel misses 밖 블록 5 · 새 시험 test_780_1_sangeun_outside(밖 확인 · 빈 블록 · 울진소광 · 여덟 파일 459) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
76 lines
3.6 KiB
Python
76 lines
3.6 KiB
Python
"""778-5 D-6 엑셀 셈 어긋남(`M02_Hopyo_Marks.misses` · `SheetMap.missesOf`) — 불리는 블록의 재현 못 한
|
|
줄 · 덮음 실패 · 금액 차 · 까닭 · 상세 시트 행 차례. 북부청 임도 2 · 33 = 엑셀 합이 진동로울러 노무를 뺌 ·
|
|
81 = 이제 맞음 · 칠은 안 바꿈(블록 칠 같음) · `hopyo-marks` 길에 실림(읽기만) · 780-1 일위대가 밖 블록도
|
|
(북부청 임도 4 · 44 · 48 · 77 · 78 · 읽기 흠은 보이는 대로)."""
|
|
|
|
import warnings
|
|
|
|
import pytest
|
|
|
|
from M02_MasterTemplete import M02_Hopyo_Excel as hx
|
|
from M02_MasterTemplete import M02_Hopyo_Grid as hg
|
|
from M02_MasterTemplete import M02_Hopyo_Marks as mk
|
|
from M02_MasterTemplete import M02_Hopyo_Sangeun as sg
|
|
from resources.tester.helper_m02_hopyo_golden import FILES
|
|
from resources.tester.test_779_4_sheet_map import _node
|
|
|
|
warnings.filterwarnings("ignore", category=UserWarning, module="openpyxl")
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def north():
|
|
path = FILES["북부청임도"]
|
|
data = path.read_bytes()
|
|
parsed = hx.read_book(path.name, data)
|
|
grid = hg.read(path.name, data, parsed)
|
|
grid.pop("책")
|
|
return parsed, grid
|
|
|
|
|
|
def _misses(parsed, outside: bool = False) -> dict[int, dict]:
|
|
blocks, first = sg.calls(parsed)
|
|
got = {n: mk.misses(blocks[n]) for n in (blocks if outside else first)}
|
|
return {n: m for n, m in got.items() if m}
|
|
|
|
|
|
def test_북부청_임도_어긋남(north):
|
|
got = _misses(north[0])
|
|
assert sorted(got) == [2, 33, 64, 95]
|
|
for no, diff in ((2, 2637.1), (33, 3418.7)): # 엑셀 합이 진동로울러(핸드가이드식) 노무 뺌
|
|
m = got[no]
|
|
assert m["덮음"] is False and m["차"] == pytest.approx(diff, abs=0.1)
|
|
assert m["까닭"].startswith("줄 합") and "엑셀 블록 금액" in m["까닭"]
|
|
[line] = got[33]["줄"] # 엑셀 글 「36,248 ÷ 0.096 = 3,418.3」
|
|
assert line["행"] == 1733 and line["묶음"] == "X" and "진동로울러" in line["이름"]
|
|
assert line["금액"] == 3897.1 and "≠ 엑셀 줄 금액 3,897.1" in line["까닭"]
|
|
assert got[2]["줄"] == []
|
|
for no in (64, 95): # 글 꼴 밖(잔디 · 신나) = 매개값 못 읽음 · 블록은 덮음
|
|
m = got[no]
|
|
assert m["덮음"] is True and m["줄"] and all(x["셈"] is None for x in m["줄"])
|
|
assert all("못 읽음" in x["까닭"] for x in m["줄"])
|
|
blocks, _ = sg.calls(north[0])
|
|
assert mk.misses(blocks[81]) is None # 이제 맞음
|
|
out = {n: m for n, m in _misses(north[0], True).items() if n not in got}
|
|
assert sorted(out) == [4, 44, 48, 77, 78] and all(m["까닭"] for m in out.values())
|
|
|
|
|
|
def test_다른_파일_어긋남_수():
|
|
path = FILES["동부청영월"]
|
|
assert _misses(hx.read_book(path.name, path.read_bytes())) == {}
|
|
|
|
|
|
def test_상세_행_차례_칠_안_바꿈(north):
|
|
parsed, grid = north
|
|
got = _misses(parsed)
|
|
nos = sorted({b["번"] for b in grid["단산"]})
|
|
plain = [{"번": n, "판정": "맞음", "SK": None, "갈래": None, "못옮김": []} for n in nos]
|
|
marked = [{**b, "어긋남": got.get(b["번"])} for b in plain]
|
|
a, b = _node({"grid": grid, "blocks": plain}), _node({"grid": grid, "blocks": marked})
|
|
assert a["paint"] == b["paint"] and a["misses"] == [] # 칠 같음 · 띠만
|
|
rows = [(m["행"], m["번"]) for m in b["misses"]]
|
|
head = {x["번"]: x["행"][0] for x in grid["단산"]}
|
|
assert rows == sorted(rows)
|
|
assert (head[2], 2) in rows and (head[33], 33) in rows and (1733, 33) in rows
|
|
assert len(rows) == 1 + 2 + 1 + 2 # 2 머리 · 33 머리 + 줄 · 64 줄 · 95 줄 둘
|
|
assert all(m["글"].startswith(f"단산{m['번']} · ") for m in b["misses"])
|