Files
Aislo/resources/tester/test_794_1b_flow_gone.py
T
eomsangdonandClaude Opus 5.5 ab559c418c chore(853-2): 걸음 0 묶음 ⑤ — DataFlow 남은 흐름도 잔재 · 금액 표준 표 걷음
- 지움: DataFlow/M02_DF_Round.ts(가져가는 곳 0) · _standard/금액단위표준.json · /df/standards 답의 money 칸(단위 고르기는 unit 만 씀)
- M02_DF_Values: 흐름도 입력 값 길(values · one_value · materials · slot_price · group_find · standards_check 와 딸린 함수 · 550 → 62 줄) — 남김 = Item_Prices 가 쓰는 _pick · _group_rows · GROUP_RULE · MACHINE_SEP · HOURLY + standards
- 시험: 옛 값 찾기만 보던 test_m02_df_values_old 지움 · 794-1b 표준 표 기대를 unit 만으로
- 검증: 빌더 --check 같음 · 핵심 시험 99 통과 · 관련 시험 182 + 3 통과 · typecheck 0 · 서버 로그 오류 0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 12:44:47 +09:00

72 lines
2.8 KiB
Python

"""794-1b — M01 흐름도 걷음 뒤 지킴(마스터 사본 폴더 · 정본 안 바뀜).
못박는 것
- 흐름 길(`/api/m01/logic/flow` · `/api/m02/df/values` …) 없음 · 남긴 바닥 `GET /api/m02/df/standards` 는 그대로
- [신규 로직] = 흐름 없는 빈 시트 줄 → `/save` 가 자체 파일 GX 새 키 · 구분 자체 · 셈은 옛 셈
- 줄에 「흐름」 이 남아 있으면 엔진이 까닭 글로 막음(조용히 틀린 값 안 냄)
"""
from __future__ import annotations
import shutil
from pathlib import Path
import pytest
from fastapi import FastAPI
from fastapi.testclient import TestClient
from M01_MasterData import M01_MasterData_Router as m01_router
from M01_MasterData import M01_MasterData_Store as store
from M02_MasterTemplete.DataFlow import M02_DF_Router as df
REAL = store.FOLDER
OWN = "로직_자체.json"
@pytest.fixture
def client(tmp_path: Path, monkeypatch) -> TestClient:
master = tmp_path / "master"
master.mkdir()
for path in REAL.glob("*.json"):
shutil.copy(path, master / path.name)
shutil.copytree(REAL / "기계", master / "기계") # 기계 = 폴더(826-2)
monkeypatch.setattr(store, "FOLDER", master)
app = FastAPI()
app.include_router(m01_router.router)
app.include_router(df.router)
return TestClient(app)
def test_흐름_길은_없고_표준_표는_남음(client: TestClient) -> None:
assert client.get("/api/m01/logic/flow", params={"key": "GF000219"}).status_code == 404
assert client.post("/api/m02/df/values", json={"items": []}).status_code == 404
got = client.get("/api/m02/df/standards").json()
assert got["unit"]["줄"] and "money" not in got # 금액 표준 표는 894 에서 걷음(화면 0)
def test_신규_로직은_시트_줄로_자체_GX(client: TestClient) -> None:
version = store.read(OWN)[1] if (store.FOLDER / OWN).is_file() else ""
row = {
"키": "",
"이름": "sub3임시 새 로직",
"결과단위": "원/㎡",
"출처": "자체",
"입력": [],
"중간": [],
"호표": [],
"끝수": None,
}
part = {"file": OWN, "version": version, "changes": [{"op": "add", "row": row}]}
res = client.post("/api/m01/save", json={"files": [part]})
assert res.status_code == 200, res.text
added = res.json()["added"]
assert len(added) == 1 and added[0]["key"].startswith("GX")
saved = client.get("/api/m01/logic", params={"key": added[0]["key"]}).json()["logic"]
assert saved["구분"] == "자체" and saved["이름"] == "sub3임시 새 로직" and "흐름" not in saved
def test_흐름이_남은_줄은_까닭으로_막음() -> None:
mf = store.cm.mf
with pytest.raises(mf.FormulaError, match="흐름도 로직은 걷음"):
mf.inputs_of({"흐름": {"boxes": [], "links": []}})