test(M01): 조합 시험이 정본 견본 조합에 안 깨지게 — 사본 조합 줄을 비워 시작 (일감 30)
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V1MKKZKpUHTPKb513FneU8
This commit is contained in:
@@ -5,11 +5,12 @@
|
||||
- 조합은 이름과 담은 로직 목록만 지님 — 수량·비율·계산 칸을 두지 않음.
|
||||
- 미리 보기 합계 = 담은 로직 저마다의 시험 계산을 비목별로 더한 값(저장 없음).
|
||||
- 검사 — 없는 로직 키 · 같은 로직 두 번 · 빈 조합 · 조합이 조합을 담음.
|
||||
- 견본 조합은 시험에서만 만들고 정본 파일에는 넣지 않음(정본은 빈 채로 둠).
|
||||
- 시험은 임시 사본에서 돌고, 사본의 조합 줄은 비워 시작 — 정본에 견본 조합이 있어도 없어도 같음.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import shutil
|
||||
import sys
|
||||
from decimal import Decimal
|
||||
@@ -38,6 +39,10 @@ def client(tmp_path: Path, monkeypatch) -> TestClient:
|
||||
for path in REAL.glob("*.json"):
|
||||
if not path.name.startswith("_") or path.name == store.mk.BOOK.name:
|
||||
shutil.copy(path, tmp_path / path.name)
|
||||
own = tmp_path / mcb.FILE # 정본의 견본 조합이 시험 줄 수에 끼지 않게 사본은 비워 시작
|
||||
data = json.loads(own.read_text(encoding="utf-8"))
|
||||
data["줄"] = []
|
||||
own.write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
|
||||
monkeypatch.setattr(store, "FOLDER", tmp_path)
|
||||
app = FastAPI()
|
||||
app.include_router(router_module.router)
|
||||
@@ -80,10 +85,11 @@ def _make(client: TestClient, keys=SAMPLE, 이름="돌쌓기 한 벌", owner: st
|
||||
|
||||
|
||||
# ── 정본 파일 ─────────────────────────────────────────────────────────
|
||||
def test_정본_조합_파일은_빈_채로_있다() -> None:
|
||||
"""줄은 사용자가 화면에서 만듦 — 견본은 시험에서만."""
|
||||
def test_정본_조합_파일은_틀대로다() -> None:
|
||||
"""줄 수는 못 박지 않음 — 견본이 있어도 없어도 됨 · 줄은 조합 키(UA)와 열 한 벌만."""
|
||||
data = store.cm.load([mcb.FILE], folder=REAL)[mcb.FILE]
|
||||
assert data["그룹"] == mcb.GROUP and data["줄"] == []
|
||||
assert data["그룹"] == mcb.GROUP
|
||||
assert all(row["키"].startswith("UA") and set(row) <= set(mcb.COLS) for row in data["줄"])
|
||||
assert "원문" not in data # 관리자가 만드는 것이라 원문 근거가 없음
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user