Files
Aislo/resources/tester/test_b09_save_speed.py
T
eomsangdonandClaude Opus 5.5 5d8d9a4fd3 test(841-1): B09 = M02 값 — 산근 · 대가 · 고정 줄 셈 다듬기 · 낡은 시험 정리 — C 걸음
코드
- 고정 줄 단가 = M02_Labor_Fixed.line(사본 묶음 · 이은 노임 · 자재 = 묶음 값) — B09 단가 책으로 다시 안 덮음
- 대가 · 산근 고친 칸 = 품만 실제로(단가 칸 덮기 줄 남던 흠 · 품 고친 뒤 줄 금액 다시 셈 흠 py · ts 짝)
- 산근 글 = 엔진 단가 셈 그대로 · 별도계상 재료 줄 끝 「· 별도계상 = 0.0」 · 계 줄 = 블록 합
- 노무비 · 중기목록 이름에서 규격 겹침 뗌 · TS 바탕 셈 이름 PARTS → MACHINE_PARTS(짝 시험이 TS 를 이어 붙일 때 겹침)

시험(고친 까닭 = 단가 원천이 B09 책 → M02 엔진 · 노임 · 기계 덮개 · 단가 고친 칸 · 중기사용료 걷음)
- 144 바탕 · 뼈대: 운전사 · 중기사용료 · 경비 · 덮개 시험 걷음 → 노무 · 중기 나열 · 사급 표시 · 자재만 책
- 145-1 · 145-2 · 155 · 157-1 · 166-2 · 166-6 · 719-3 · 719-4 · 723-4 · 778-4 · 792-3: 줄 단가 = own(엔진) · 산근 = Solver() · collect 새 부름 꼴
- 702 · 705-1 · 719-2: 단가 칸 덮개 = 안 읽음 · 고정 줄 = M02 셈(노임 새 판 따라가기 시험 걷음)
- 203-1 · 296 · 703-3 · 795-4: 단가 책 = 자재 줄로
- 707 · 707-6 · 707-7: 단가표 불러오기 = 자재만 · 거창 이은 안내판 줄 = M02 사본 셈(엑셀 −50,000)
- 201-1: 환율 · 중기사용료 표 걷음 · b09 저장 속도: 산근 앞 풀이 그대로(단가 표 같음 견줌 걷음)
- 대상 113 파일 764 통과 · 25 실패 = 원래 실패(formatMoney · formatPrice 없음 · 단위 글 ㎜ · sec · 719-1 · 796-2e · 717-4 · 721 · 311 · 243 · 246)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:57:01 +09:00

72 lines
2.6 KiB
Python

"""B09 [저장] 속도 — 같은 결과 범위 안 다시 셈 줄임 지킴.
- 산근 두 번 셈(183-1) = 1차 풀이 그대로(841-1 산근 단가 = M02 엔진 · 바탕 표 안 읽음 → 늘 같음)
- M01 `steady()` 범위 = 파일 자국 한 번 · `stale` 뒤 다시 셈 · 범위 밖은 늘 셈
- B08 `once()` 범위 = 채집석 공제가 자재 집계표 답을 다시 씀(셈 한 번)
"""
from __future__ import annotations
import asyncio
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
sys.path.insert(0, str(ROOT))
from B08_Quantity import B08_Quantity_Router_Material as material # noqa: E402
from B09_Estimation import B09_Estimation_Sangeun as sg # noqa: E402
from M01_MasterData import M01_MasterData_Store_Cache as cache # noqa: E402
def test_산근_두_번_셈_앞_풀이_그대로() -> None:
memo = {"sg": {"sg": [{"key": "SG:x"}], "sg_list": [], "sg_gaps": [], "sg_notes": [],
"sg_hand": {}}} # fmt: skip
got = sg.collect([("s1", ROOT / "없는 사본")], None, memo)
assert got == memo["sg"] and got is not memo["sg"] # 사본(깊은 복사)
def test_M01_범위_안_자국_한_번(monkeypatch) -> None:
calls = []
monkeypatch.setattr(cache, "_stamps", lambda folder: calls.append(folder) or {})
folder = Path("x")
cache._now(folder)
cache._now(folder)
assert len(calls) == 2 # 범위 밖 = 늘 셈
with cache.steady():
cache._now(folder)
cache._now(folder)
assert len(calls) == 3
cache.stale([]) # 스스로 고친 자리 = 다시 셈
cache._now(folder)
assert len(calls) == 4
cache._now(folder)
assert len(calls) == 5
def test_B08_범위_안_자재_집계표_한_번(monkeypatch, tmp_path) -> None:
calls = []
rows = [{"key": material.DEDUCT_KEY, "amount": 12.5}]
async def sheets(_pid, _root, _over):
calls.append(1)
return {"sheets": {"material": {"rows": rows}}}
async def root(_pid):
return tmp_path
monkeypatch.setattr(material, "_sheets", sheets)
monkeypatch.setattr(material, "_project_root", root)
monkeypatch.setattr(material, "quantity_settings", lambda _root: {})
async def run() -> list:
out = [await material.picked_deduction("p", tmp_path)]
with material.once():
await material.material_sheets("p")
out.append(await material.picked_deduction("p", tmp_path))
out.append(await material.picked_deduction("p", tmp_path))
return out
assert asyncio.run(run()) == [12.5, 12.5, 12.5]
assert len(calls) == 3 # 범위 안 공제 = 셈 없음