- 원본 처리 근거대로 설계·심사·절감액·절감율 네 줄과 표별 조정 목록 생성 - 심사 내역 사본에 설계 원가 금액 보존 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
43 lines
1.9 KiB
Python
43 lines
1.9 KiB
Python
"""EST 테스트 앱 계약심사 자동입력(원본 TfrmInvest 심사평가결과·주요심사내용)."""
|
|
|
|
import json
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
|
|
|
|
def test_result_and_content_text():
|
|
script = """
|
|
const fs = require('fs'), vm = require('vm');
|
|
const ctx = vm.createContext({});
|
|
vm.runInContext(fs.readFileSync('tools/est-test/native-review-auto.js', 'utf8'), ctx);
|
|
ctx.p = { tables: {
|
|
Wonga: [{ Name: '도 급 액', Cost: 1 }, { Name: '총 공 사 비', Cost_: 1000000, Cost: 876543.21 }],
|
|
StuffcDat: [{ Name: '레 미 콘', Size: '25-24|150', NewItem: true }, { Name: 'x' }, { Name: 'y', NewItem: true }, { NewItem: true }],
|
|
LaborcDat: [{ Name: '보통 인부', Size: '일반', NewItem: true }],
|
|
HeadTitleDat: [{ Name: '거푸집', Size: '합판' }] } };
|
|
const r = vm.runInContext('EstReviewAuto.result(p)', ctx);
|
|
ctx.q = { tables: { Wonga: [{ Name: '총공사비', Cost_: 100, Cost: 150 }] } };
|
|
const up = vm.runInContext('EstReviewAuto.result(q)', ctx);
|
|
const none = vm.runInContext('EstReviewAuto.result({ tables: { Wonga: [] } })', ctx);
|
|
const c = vm.runInContext('EstReviewAuto.content(p)', ctx);
|
|
process.stdout.write(JSON.stringify({ r, up, none, c }));
|
|
"""
|
|
out = json.loads(subprocess.check_output(["node", "-e", script], cwd=ROOT).decode("utf-8"))
|
|
assert out["r"].split("\n") == [
|
|
f"o 설계금액 : {'1,000,000':>16} 원",
|
|
f"o 심사금액 : {'876,543.21':>16} 원",
|
|
f"o 절 감 액 : {'-123,456.79':>16} 원",
|
|
f"o 절 감 율 : {'-12.34':>16} %",
|
|
]
|
|
assert out["up"].split("\n")[2:] == [
|
|
f"o 절 감 액 : {'+50':>16} 원",
|
|
f"o 절 감 율 : {'+50':>16} %",
|
|
]
|
|
assert out["none"] is None
|
|
assert out["c"].split("\n") == [
|
|
"노임단가 조정 : 보통인부 외1 종",
|
|
"자재단가 조정 : 레미콘(25-24150) 외3 종",
|
|
]
|