Files
Aislo/resources/tester/spreadsheet/test_spreadsheet_node.py
eomsangdonandClaude Opus 5.5 cd824aca25 feat(spreadsheet): F 서버 재계산 · 산출근거 따로 저장 · M02 끼우기 · 금빛 시험
- common_util_spreadsheet_node.ts · common_util_spreadsheet.py · build:spreadsheet — [저장] 때 화면과 같은 TS 엔진을 Node 로 돌려 계산값 정본(브라우저 값 버림 · 못 풀면 503)
- M02 새 종류 basis — resources/master_template/basis/<열 id>.json(구조물집계표 열마다) · 층 복사 · 뼈대 검사 · 옛 구조물 문서 산출근거 49 벌 옮김(migrate_basis) · 새 열도 같이 만듦
- 상세 산출근거 카드 = 새 스프레드시트(import() 로 늦게 받음) · basis 읽기 · 저장
- ⚠ 임시 [스프레드시트 시험] 단추 — 빈 통합문서(시트 셋) · 저장 자리 tmp/spreadsheet_trial.json · 1단계 검증 뒤 지움
- 시험 resources/tester/spreadsheet/ — 저장 · 서버 다리 · 크기 예산 · M02 만 늦게 불러옴 · 실무 구조도 xlsx 세 벌 수식 2,699 칸 엑셀 캐시값 대조(엔진 빈 몸이면 건너뜀)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0168FQuoV7vDh5nhnSowW5cp
2026-09-27 20:12:39 +09:00

38 lines
1.5 KiB
Python

"""F — 서버 재계산 다리: 파이썬 → Node 번들(`build:spreadsheet`) → 화면과 같은 TS 엔진.
엔진(A · B)이 아직 빈 몸이면 `아직 없음` 까닭이 그대로 올라와 저장을 막는지 봄 ·
엔진이 차면 저장 견본(`spreadsheet_sample.json`)의 `계산값` 과 서버 풀이가 같은지 봄.
"""
import json
import shutil
from pathlib import Path
import pytest
from common_util import common_util_spreadsheet as spreadsheet
ROOT = Path(__file__).resolve().parents[3]
SAMPLE = ROOT / "A00_Common" / "spreadsheet" / "spreadsheet_sample.json"
pytestmark = pytest.mark.skipif(shutil.which("node") is None, reason="node 가 없음")
def test_견본_계산값_같음():
sample = json.loads(SAMPLE.read_text(encoding="utf-8"))
try:
saved = spreadsheet.with_server_values({**sample, "계산값": {"s1": {"H4": {"수": "틀림"}}}})
except spreadsheet.RecalcError as error:
assert "아직 없음" in str(error), error # 엔진이 빈 몸일 때만 봐줌
pytest.skip(f"엔진 아직 — {error}")
assert saved["계산값"] == sample["계산값"]
assert {k: v for k, v in saved.items() if k != "계산값"} == {
k: v for k, v in sample.items() if k != "계산값"
}
def test_못_푸는_문서는_까닭과_함께_막음():
with pytest.raises(spreadsheet.RecalcError) as caught:
spreadsheet.recalc_workbooks([{"종류": "통합문서", "시트": "깨짐"}])
assert "스프레드시트 계산 실패" in str(caught.value)