chore(853-2): 걸음 0 묶음 ③ — 부르는 곳 0 · 시험만 부르는 함수 걷음

- 서버: Elem_Alias.region_of · MyMachine.logic_for · Sangeun_Const.drop_add_keys · Sangeun_QtyLinks._hangul · Book.migrate_paths · Sangeun_Block.names
- 화면: laborGrid(+ 딸린 gridOf) · mountDrawingView · DRAWING_HELP · checkDraft(+ DraftCheck) · suggestPlaces · withFirst · putDraft · newTag · crewSummary · machineHourly(+ MachineHourly) · coverCalls · qtyText
- 시험: migrate_paths 만 보던 tree 한 함수 지움 · 거울 시험에서 걷은 TS 몫만 뺌(821-2 시간당 · 846-1 부름 · labor_values qtyText)
- 남김: Combo_Store listing · create · edit · delete — 시험 28 개가 조합 만들기 바탕으로 씀 · 지우면 M01 Store_Combo 만들기 길도 죽음(sub1 몫) · 브레인 판단
- 검증: 빌더 --check 같음 · 핵심 시험 99 통과 · 관련 시험 536 통과 · typecheck 0 · 서버 로그 오류 0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 12:09:31 +09:00
co-authored by Claude Opus 5.5
parent 37643e4d09
commit 47b2268939
21 changed files with 8 additions and 302 deletions
@@ -97,11 +97,6 @@ export async function loadStandard(): Promise<UnitStandard> {
}
}
/** 단위를 고르면 표준 표에서 소수자리 제안 — 없으면 null */
export async function suggestPlaces(unit: string): Promise<number | null> {
return (await loadStandard()).places[unit] ?? null;
}
export interface UnitPickOptions {
/** 지금 단위 — 「-」 = 없음 */
value: string;
-6
View File
@@ -36,12 +36,6 @@ _CODE = re.compile(r"\bM\d{10}\b")
LOCAL = "M0000000" # 공사 직접 번호(파일마다 다른 품목 · 거창 치즐 = 우리 표 Air Hammer) = 코드로 안 이음
def region_of(name: Any) -> tuple[str, str]:
"""가져온 자재 이름 → (지역 · 인도 조건 글 뗀 이름, 지역 | 빈 글) — 우리 줄 지역은 지역 칸."""
got = place.line(name, "")
return got["이름"], "" if got["지역"] == place.NONE else got["지역"]
def _same(name: Any, spec: Any) -> tuple[str, str]:
got = place.line(name, spec)
return am.norm(got["이름"]), am.norm(got["규격"])
@@ -131,16 +131,3 @@ def read() -> dict[str, Any]:
row["경로"] = tree.row_path(row)
row["이름"] = tree.name_of(row["경로"])
return doc
def migrate_paths() -> bool:
"""옛 집계표 · 장부 → 경로 모양(열 `경로` · 머리 줄 수 · 장부 `경로` · `이름`) — 한 번 · 두 번
돌려도 같음. 바뀐 것이 없으면 파일을 안 씀 · 바꿨으면 참. 지금 층(`store.at`) 기준."""
got = store.read("table", store.STRUCTURE_TABLE)
if tree.normalize_table(got["문서"]) != got["문서"]:
store.write("table", store.STRUCTURE_TABLE, got["판"], got["문서"])
return True
path = store.root() / store.COMBO_FILE
before = path.read_bytes() if path.is_file() else b""
sync()
return (path.read_bytes() if path.is_file() else b"") != before
@@ -19,8 +19,6 @@ import {
} from "./M02_MasterTemplete_Drawing";
import type { ItemSource } from "./M02_MasterTemplete_ItemSource";
export const DRAWING_HELP = "단축키 — 글자를 치고 Enter";
/** 단축키 도움말 — 전체 편집기 명령 별칭(openwebcad `commands.*.ts`)과 같은 것만 */
export const DRAWING_KEYS: [string, string][] = [
["L · PL", "선 · 폴리선"],
@@ -94,17 +92,6 @@ function mountStructure(
return handle;
}
/** 보기만 도면 — 카드 미리보기의 보기 갈래와 같은 길(확대 · 이동만 · 면적산출 오른쪽 도면 패널 47-6) */
export function mountDrawingView(
host: HTMLElement,
doc: StructureDoc,
source: Where,
column: string,
): { destroy: () => void } {
const handle = mountStructure(host, doc, source, column);
return { destroy: () => handle.destroy() };
}
export interface DrawingCardOptions {
/** 구조물 도면 문서 통째(`도번` · `도면` …) — 저장은 `도면` · `더한장` 칸만 갈아 끼움 */
doc: StructureDoc;
@@ -1,7 +1,7 @@
/* =============================================================================
* M02_MasterTemplete_Labor_Grid.ts
* 일위대가 엑셀 꼴 격자(704-3) — 문서 · 서버 calc 답 → 공용 격자(`ui_template_hopyo_grid` · B09 일위대가표와 같은 꼴).
* 일위대가 카드 · 상세(`Labor_Detail`)가 위에 붙임. 값은 calc 답 그대로(여기서 셈하지 않음):
* 호표 한 덩이(`laborBlock`) — 격자 그리기는 `Labor_Table` 몫. 값은 calc 답 그대로(여기서 셈하지 않음):
* 머리 = 일위대가번 · 단위 · 1 단위 합계(`반영합`)
* 로직 줄 = 이름(별칭 앞섬) · 규격(옵션 값 · 켜쌓기) · 수량 · 분모 · 단가 = 기준 ÷ 배 · 금액 = 반영 · 꼬리표 품셈
* 자재 줄 = 이름 · 규격 · 수량 · 단위 · 재료비 단가 = 기준단가 · 금액 = 반영 · 별도계상은 비고 「합계 밖」
@@ -11,7 +11,6 @@
* ========================================================================== */
import {
createHopyoGrid,
HOPYO_TAG,
type HopyoBlock,
type HopyoLine,
@@ -23,9 +22,7 @@ import { bornNote } from "./logic/M02_Born_Tag";
import { lineId } from "./M02_MasterTemplete_Labor_Calc";
import { tc } from "./M02_MasterTemplete_Labor_Text";
import { valueLine } from "./M02_Labor_Values_Model";
import { specBar, specCells, withSpecs, type SpecEdit } from "./M02_MasterTemplete_Labor_Spec";
import { pasteInto } from "./M02_MasterTemplete_Labor_Paste";
import { unlinkedBar } from "./M02_MasterTemplete_Labor_Unlinked";
import { withSpecs } from "./M02_MasterTemplete_Labor_Spec";
const money = (m: LaborCost | null | undefined, times = 1): HopyoMoney =>
m
@@ -117,36 +114,3 @@ export function laborBlock(
};
return withSpecs(block, doc, calc);
}
/** 격자 하나 — `edit` 있으면 Ctrl+V 붙여넣기(705-2 · `Labor_Paste`) · `spec` 이면 위에 규격 줄 · 규격 수량 칸 고침(704-4) */
export const laborGrid = (
doc: LaborDoc,
calc: LaborCalc | null,
logics: ReadonlyMap<string, ItemLogic>,
edit?: SpecEdit | false,
spec = true,
): HTMLElement => {
const grid = gridOf(doc, calc, logics, edit, spec);
const bar = unlinkedBar(doc, edit);
if (!bar) return grid;
const box = document.createElement("div");
box.append(bar, grid);
return box;
};
const gridOf = (
doc: LaborDoc,
calc: LaborCalc | null,
logics: ReadonlyMap<string, ItemLogic>,
edit?: SpecEdit | false,
spec = true,
): HTMLElement => {
const block = laborBlock(doc, calc, logics);
if (!edit) return createHopyoGrid([block]).root;
const paste = (text: string): void => void pasteInto(doc, text, () => edit(false));
if (!spec) return createHopyoGrid([block], {}, paste).root;
const grid = createHopyoGrid([block], specCells(block, doc, edit), paste).root;
const box = document.createElement("div");
box.append(specBar(doc, calc, edit), grid);
return box;
};
@@ -80,24 +80,6 @@ const BOOK = /^(건설|산림)품셈/;
const num = (v: number): string =>
Number(v.toPrecision(12)).toLocaleString("ko-KR", { maximumFractionDigits: 6 });
/** 수량 글 — 「수량 수기 입력 3 개소」 · 「수량 12.5 ㎡(B6)」(칸 = 그 알약을 이은 면적산출 칸 · 44-6) ·
* 이은 칸이 비었으면 「수량 빈 칸(A1)」(수량 없음 · 서버와 같음) · 아니면 빈 글 */
export function qtyText(
line: { 수량?: number | null; 수량출처?: string; 알약?: string | null } | undefined,
unit: string,
cells: ReadonlyMap<string, string> = new Map(),
): string {
if (!line) return "";
if (line.수량 === null || line.수량 === undefined) {
const at = line.알약 ? cells.get(line.알약) : undefined;
return at ? `${tc("Labor_Qty")} ${tc("In_QtyEmpty")}(${at})` : "";
}
const v = `${num(line.수량)}${unit ? ` ${unit}` : ""}`;
if (line.수량출처 === "손") return `${tc("Labor_Qty")} ${tc("In_QtyHand")} ${v}`;
const cell = (line.알약 && cells.get(line.알약)) || tc("In_QtyCell");
return `${tc("Labor_Qty")} ${v}(${cell})`;
}
/** 결과단위 기준 수량 — 분모 앞 수 · 분모(「10 ㎡」 · 「1 ㎥」) · 분모 없으면 빈 글 */
export function baseQtyText(
line: { 배?: number | null; 분모?: string | null } | undefined,
-8
View File
@@ -214,14 +214,6 @@ def logic_key(row: dict) -> str | None:
return LOGIC[(False, False)]
def logic_for(code: str) -> dict | None:
"""내 기계 원문번호 → 시간당 경비 식(채운 칸으로 고름) · 내 기계 아님 = None."""
index = whole()
row = (index.numbers.get("EQ") or {}).get(code)
key = logic_key(row) if row is not None and mine(row.get("키")) else None
return index.logic(key) if key else None
def hourly(row: dict, index: Any) -> dict[str, Any]:
"""`M02_Machine_Hourly.hourly` 꼴 — 직접 = 그 값 · 아니면 고른 GC 식(입력 기본값 · 기계 = 원문번호)."""
head = {"이름": row.get("이름"), "규격": row.get("규격"), "원문번호": row.get("원문번호")}
-23
View File
@@ -6,7 +6,6 @@
* ========================================================================== */
import type { MachinePick, MachineValues } from "../common_util/common_util_machine_sheet";
import type { DocRecord } from "../common_util/common_util_formula_doc_cache";
import { call } from "./M02_MasterTemplete_Api_Fetch";
import type { M01Element } from "./M02_MasterTemplete_Find_Pick";
@@ -170,28 +169,6 @@ export const mineElement = (
원문번호: row.원문번호,
});
/** 기계 창 [확인](827-1) — 초안 몸 검사 · 셈 꼴 값 · 시간당(식 키) · 그 식 셈 기록(계산기 캐시) · 쓰기 없음 */
export interface DraftCheck {
줄: MyMachine;
셈값: Record<string, unknown>;
시간당: MyHourly;
연결: DocRecord;
}
export const checkDraft = (
owner: string | null,
body: MyMachineBody,
target: { 표지: string; 키?: string; 본뜬?: string },
): Promise<DraftCheck> =>
call(at(owner, "/draft"), {
method: "POST",
body: JSON.stringify({
줄: body,
표지: target.표지,
키: target.키 ?? null,
본뜬: target.본뜬 ?? null,
}),
});
/** M01 기계 줄 값 + 시간당(기계 창 목록 · 양식 · 60 까지) */
export interface MachineBrief {
키: string;
-6
View File
@@ -86,9 +86,3 @@ def strict(doc: dict, whole: Any) -> None:
why = row_of(whole, one)[1]
if why:
raise sd.DocError(f"더한줄 {at}째 수식 고침 못 얹음 — " + " · ".join(why))
def names(doc: Any) -> list[str]:
"""끊은 기초 이름들([단가 갱신] · [재생성] 보고)."""
adds = (doc.get("더한줄") if isinstance(doc, dict) else None) or []
return [str(x.get("이름") or x.get("로직")) for x in adds if is_block(x) and x.get(CUT)]
-20
View File
@@ -297,26 +297,6 @@ def _top_add(key: str) -> bool:
return bool(hit) and not hit[2]
def drop_add_keys(doc: dict, k: int) -> dict:
"""더한줄 k 를 뺀 뒤 — 까닭 · 글줄 열쇠 `add:#j`(j > k) 를 한 칸 당김 · k 는 지움."""
def move(key: str) -> str | None:
hit = _ADD.match(key)
if not hit:
return key
j = int(hit[1])
return None if j == k else f"add:#{j - 1 if j > k else j}{hit[2] or ''}"
out = dict(doc)
if "까닭" in doc:
why = {move(x): v for x, v in doc["까닭"].items() if move(x)}
out.pop("까닭")
out |= {"까닭": why} if why else {}
if "글줄" in doc:
out["글줄"] = [{**t, "자리": move(t["자리"]) or ""} for t in doc["글줄"]]
return out
def kinds(doc: dict, spot: str) -> list[str]:
"""자리의 덮개 갈래 — 품 · 단가 · 상수 · 표값 · 뺌(차례 그대로)."""
cover, out = (doc.get("덮개") or {}).get(spot) or {}, []
@@ -40,10 +40,6 @@ def _flat(s: Any) -> str:
return re.sub(r"[^가-힣A-Za-z0-9]", "", str(s or ""))
def _hangul(s: Any) -> str:
return re.sub(r"[^가-힣]", "", str(s or ""))
def _literals(node: Any, out: list[Decimal]) -> None:
"""식 나무 → 수 글자(차례대로) — 비교 글자 · 찾기 · 로직 부름 인자는 뺌."""
if not isinstance(node, tuple):
@@ -90,9 +90,4 @@ export function resetQty(one: SkAdded): void {
if (one.처음수량 != null) one.수량 = one.처음수량;
}
/** 넣을 때 수량 적어 둠 */
export const withFirst = <T extends { 수량: number }>(line: T): T & { 처음수량: number } => ({
...line,
처음수량: line.수량,
});
/* ── 순수 셈 끝 ── */
@@ -337,15 +337,6 @@ export function workKey(
return has(info.기호) ? info.기호! : has(info.기계) ? info.기계 : (info.기호 ?? info.기계);
}
/** 문서 `기계덮음` 의 시간당 작업량 식 키(파이썬 `cover_calls` 짝) */
export function coverCalls(doc: FormulaDoc | null | undefined): string[] {
const got = (doc as { 기계덮음?: Cover } | null | undefined)?.기계덮음;
return Object.values(got && typeof got === "object" ? got : {}).flatMap((e) => {
const w = (e as { [WORK]?: WorkCover })?.[WORK];
return w && w.방식 === HOURLY && w.식 ? [String(w.식), ...(w.키 ? [String(w.키)] : [])] : []; // 847-1 굳은 기계 식 문서
});
}
// ── 셈(계산기 money 가 기계 줄마다 부름) ─────────────────────────────────
type Scope = Record<string, unknown>;
/** 계산기 셈 한 벌(`Run`)에서 쓰는 몫 */
@@ -7,7 +7,6 @@
* ========================================================================== */
import { varId, type FormulaDoc } from "./common_util_formula_doc";
import { repick, type Picked } from "./common_util_line_stack_pick";
export const DRAFT_FIELD = "내기계초안";
const TAG = /EQP초안-\d+/g;
@@ -29,10 +28,6 @@ export const draftsOf = (doc: FormulaDoc | null | undefined): DraftItem[] =>
export const isDraftNo = (no: string | null | undefined): boolean =>
/^개인 EQP초안-\d+$/.test(no ?? "");
let last = Date.now() % 1_000_000_000;
/** 새 표지 — 세션 안 겹치지 않게(캐시에 남은 옛 초안 값과 안 섞임) */
export const newTag = (): string => `EQP초안-${++last}`;
/** 문서가 안 쓰는 초안은 뺌 · 다 빠지면 칸 지움 */
export function pruneDrafts(doc: FormulaDoc): void {
const box = doc as Holder;
@@ -44,25 +39,6 @@ export function pruneDrafts(doc: FormulaDoc): void {
else delete box[DRAFT_FIELD];
}
/** 초안을 줄 `i`(단가 기호 `id`)에 끼움 — 내 기계 고침이면 이 문서에서 그 기계를 가리키던 줄 모두 초안으로 */
export function putDraft(doc: FormulaDoc, i: number, id: string, item: DraftItem, p: Picked): void {
const arg = p.입력?.기계 ?? "";
if (item.키) {
const was = `'개인 ${item.키}'`;
for (const v of doc.변수 ?? []) {
const l = v.연결;
if (l?.갈래 === "단가산출" && l.입력?.기계 === was) {
l.입력 = { ...l.입력, 기계: arg };
l.키 = p.키;
}
}
}
repick(doc, i, id, "기계", p);
const box = doc as Holder;
box[DRAFT_FIELD] = [...draftsOf(doc).filter((d) => d.표지 !== item.표지), item];
pruneDrafts(doc);
}
/** 기계 줄 연결 → 지금 기계 입력 글(따옴표 뗌) · 옵션 기호(`S_굴착기`)면 그 옵션 값 · 없음 = null */
export function machineNow(
doc: FormulaDoc,
+1 -42
View File
@@ -1,6 +1,6 @@
/* =============================================================================
* common_util_machine_coef.ts
* 기계 손료계수 · 시간당 경비 미리보기(PLAN 821-2 · 요구서 796 1 장) — 기계 양식 즉시 셈.
* 기계 손료계수(PLAN 821-2 · 요구서 796 1 장) — 기계 양식 즉시 셈 · 시간당 경비 미리보기 TS 몫은 화면 0 이라 걷음(894).
*
* ⚠ 짝: `resources/master_data/scripts/master_machine_coef.py` — 같은 셈 · 같은 차례
* (거울 시험 `resources/tester/test_821_2_machine_coef.py`). 한쪽만 고치면 화면과 저장이 갈림.
@@ -26,7 +26,6 @@ export const MACHINE_HOUR = ((((1 / 8) * 16) / 12) * 25) / 20; // 파이썬 짝
const num = (v: unknown): number => (typeof v === "number" && Number.isFinite(v) ? v : 0);
const halfUp = (x: number): number => Math.floor(x + 0.5 + E);
/** 줄 금액 = 0.1 원 아래 버림(B09 끝수 줄 자리). */
const tenth = (x: number): number => Math.floor(x * 10 + E) / 10;
/** (내용시간 · 연간표준가동시간 · 상각비율 · 정비비율 · 연간관리비율) → 계수 넷 · 못 셈 = null. */
export function machineCoef(
@@ -52,43 +51,3 @@ export function machineCoefOf(values: Record<string, unknown>): MachineCoefs | n
...(MACHINE_INPUTS.map((k) => values[k]) as [number, number, number, number, number]),
);
}
export interface MachineHourly {
손료: number;
주연료: number;
잡품: number;
전력: number;
조종원: number;
노무비: number;
재료비: number;
경비: number;
계: number;
}
/** 값 묶음 + 유가(원/ℓ) · 노임(원/일) · 전력(원/kWh) · 시간환산 → 시간당 줄 · 비목 · 계. */
export function machineHourly(
values: Record<string, unknown>,
fuel: number,
wage: number,
power = 0,
hour = MACHINE_HOUR,
): MachineHourly {
const loss = Math.floor((num(values["가격"]) * 1000 * num(values["손료계수"])) / 1e7 + E);
const oil = tenth(num(values["주연료"]) * num(fuel));
const elec = tenth(num(values["전력"]) * num(power));
const misc = tenth(((oil + elec) * num(values["잡재료율"])) / 100);
const crew = tenth(num(values["조종원"]) * hour * num(wage));
const labor = Math.floor(crew + E);
const material = Math.floor(oil + misc + elec + E);
return {
손료: loss,
주연료: oil,
잡품: misc,
전력: elec,
조종원: crew,
노무비: labor,
재료비: material,
경비: loss,
계: labor + material + loss,
};
}
-10
View File
@@ -68,13 +68,3 @@ export function fromOld(vals: Vals, base?: string[]): Vals {
out[MISC] = b.map((줄) => ({ 줄, 율: rate as unknown as number })); // 원문 범위 글 그대로
return out;
}
/** 목록 요약 글(M01 기계 목록 열) — 「1048 1인 · 잡품 주연료 22%」 */
export function crewSummary(vals: Vals | undefined, jobName?: (code: string) => string): string {
const crew = (crewOf(vals) ?? []).map((r) => {
const c = code(r.키);
return `${r.이름 || (c ? (jobName?.(c) ?? c) : "직종 고르기")} ${r.인}인`;
});
const misc = (miscOf(vals) ?? []).map((r) => `${r.이름 || r.줄 || r.키} ${r.율}%`);
return [...crew, ...(misc.length ? [`잡품 ${misc.join(", ")}`] : [])].join(" · ");
}
@@ -1,6 +1,6 @@
/* 846-1 기계 줄 시간당 작업량 거울 헬퍼 — common_util_formula_doc_work.ts · calc 를 그 자리에서 트랜스파일해 Node 로 돌림.
* stdin = {문서들: {키: 문서}, 대상: [{문서, 덮음?}], 기록: {열쇠: {값 | 빈 | 끊김}}, 글: [{문서, 수량}], 정리: [{덮음, 기본}]}
* stdout = {답: [calcDoc 답], 글: [{자리: [{꼴, 율, 단위}], 바꿈}], 정리: [pruneWork], 부름: [coverCalls]}
* stdout = {답: [calcDoc 답], 글: [{자리: [{꼴, 율, 단위}], 바꿈}], 정리: [pruneWork]}
* 기록 열쇠 = 갈래 + "|" + 값 글(helper_836_1 과 같은 꼴). */
const fs = require("fs");
const path = require("path");
@@ -48,7 +48,7 @@ const links = {
table: (p) => answer("표", p),
doc: (key) => (input.문서들 || {})[key] || null,
};
const out = { 답: [], 글: [], 정리: [], 부름: [] };
const out = { 답: [], 글: [], 정리: [] };
for (const one of input.대상 || [])
out.답.push(calc.calcDoc(one.덮음 ? { ...one.문서, 기계덮음: one.덮음 } : one.문서, links));
for (const one of input.글 || [])
@@ -57,5 +57,4 @@ for (const one of input.글 || [])
바꿈: work.swap(one.문서, one.수량),
});
for (const one of input.정리 || []) out.정리.push(work.pruneWork(one.덮음, one.기본));
for (const one of input.대상 || []) out.부름.push(work.coverCalls({ 기계덮음: one.덮음 }));
process.stdout.write(JSON.stringify(out));
+2 -22
View File
@@ -2,7 +2,7 @@
① 계수 전수 대조: M01 기계표에서 품셈 입력 다섯 · 계수 넷이 다 있는 줄 = 파이썬 계수 셈과 같음
(다른 줄 = 원문 표 값 그대로인 점보드릴 2 줄만 · 원문 777 · 셈 777.8).
② 파이썬 · TS 거울: 같은 입력 → 같은 계수 · 같은 시간당 미리보기.
② 파이썬 · TS 거울: 같은 입력 → 같은 계수(TS 시간당 미리보기는 화면 0 이라 894 에서 걷음).
③ 미리보기 = 서버 기계경비식(`M02_Machine_Hourly.hourly`) 견본 스무 대 · 비목 셋 같음.
"""
@@ -77,23 +77,8 @@ def test_coef_excavator_example():
def test_ts_mirror(tmp_path):
coef_cases = [[r["값"][k] for k in mc.INPUTS] for r in MACHINES if _full(r)]
coef_cases += [[10000, 1250, 0.9, 0.7, 0.1], [0, 1, 1, 1, 1], [3600, 540, 0.9, 1.15, 0.1]]
hour_cases = []
for r in MACHINES:
fuel, wage = _prices(r["값"])
hour_cases.append([r["값"], fuel, wage, 114.4, 0.125])
hour_cases.append(
[
{"가격": 2680, "손료계수": 5313, "주연료": 1.0, "잡재료율": 10, "전력": 3.73},
2000,
0,
114.4,
0.125,
]
)
src = tmp_path / "in.json"
src.write_text(
json.dumps({"coef": coef_cases, "hour": hour_cases}, ensure_ascii=False), encoding="utf-8"
)
src.write_text(json.dumps({"coef": coef_cases}, ensure_ascii=False), encoding="utf-8")
script = f"""
const fs = require("fs");
const ts = require({json.dumps(str(ROOT / "config" / "node_modules" / "typescript"))});
@@ -105,7 +90,6 @@ new Function("exports", "module", js)(m.exports, m);
const inp = JSON.parse(fs.readFileSync({json.dumps(str(src))}, "utf8"));
process.stdout.write(JSON.stringify({{
coef: inp.coef.map((c) => m.exports.machineCoef(...c)),
hour: inp.hour.map((h) => m.exports.machineHourly(...h)),
}}));
"""
out = subprocess.run(
@@ -113,11 +97,7 @@ process.stdout.write(JSON.stringify({{
)
got = json.loads(out.stdout)
want_coef = [mc.coef(*c) for c in coef_cases]
want_hour = [mc.preview(*h) for h in hour_cases]
assert got["coef"] == want_coef
assert len(got["hour"]) == len(want_hour)
for a, b in zip(got["hour"], want_hour):
assert a == pytest.approx(b, abs=1e-9)
def test_preview_equals_server_hourly():
@@ -337,7 +337,6 @@ def test_거울_파이썬_TS_같은_답(links):
assert [m["갈래"] for m in a["표지"]] == [m["갈래"] for m in b["표지"]], i
_same(text_want, got["글"], "글")
_same(ml._norm(prune_want), got["정리"], "정리")
_same([mw.cover_calls({mcv.COVER: c["덮음"]}) for c in cases], got["부름"], "부름")
assert text_want[0]["바꿈"] == "1 ÷ Q_시간당작업량"
assert text_want[2]["바꿈"] == "r_기계 ÷ 100 ÷ Q_시간당작업량"
assert text_want[4]["자리"] == []
+1 -13
View File
@@ -164,11 +164,6 @@ console.log(JSON.stringify([
m.qtyShort({ 수량: 12.5, 수량출처: "칸", 알약: "돌쌓기|㎡" }, "㎡", cells),
m.qtyShort({ 수량: null, 수량출처: "없음", 알약: "돌쌓기|㎡" }, "㎡", cells),
m.qtyShort({ 수량: null, 수량출처: "없음", 알약: "없는|㎡" }, "㎡", cells),
m.qtyText({ 수량: 20, 수량출처: "칸", 알약: "돌쌓기|㎡" }, "㎡", cells),
m.qtyText({ 수량: 20, 수량출처: "칸", 알약: "돌쌓기|㎡" }, "㎡"),
m.qtyText({ 수량: 3, 수량출처: "손", 알약: "돌쌓기|㎡" }, "㎡", cells),
m.qtyText({ 수량: null, 수량출처: "없음", 알약: "돌쌓기|㎡" }, "㎡", cells),
m.qtyText({ 수량: null, 수량출처: "없음", 알약: "돌쌓기|㎡" }, "㎡"),
]));
"""
@@ -184,11 +179,4 @@ def test_수량_글은_이은_칸_주소를_보임() -> None:
assert out.returncode == 0, out.stderr
got = json.loads(out.stdout)
# 수량산출 열(40-1) — 위 결과단위 기준 수량 · 아래 지금 수량 짧은 글
assert got[:7] == ["10 ㎡", "1 ㎥", "", "수기 5 ㎥", "12.5(B6)", "빈 칸(B6)", "—"]
assert got[7:] == [
"수량 20 ㎡(B6)", # 44-6 — 수량(칸 주소)
"수량 20 ㎡(면적산출 칸)",
"수량 수기 입력 3 ㎡",
"수량 빈 칸(B6)", # 이은 칸이 비었음 = 수량 없음(39-8 ② · 서버 area_values 와 같음)
"",
]
assert got == ["10 ㎡", "1 ㎥", "", "수기 5 ㎥", "12.5(B6)", "빈 칸(B6)", "—"]
-19
View File
@@ -19,7 +19,6 @@ from fastapi.testclient import TestClient
from common_util.common_util_auth import verify_session
from config import config_system
from M02_MasterTemplete import M02_MasterTemplete_Book as book
from M02_MasterTemplete import M02_MasterTemplete_Router_Items as items_router
from M02_MasterTemplete import M02_MasterTemplete_Router_Layers as layers_router
from M02_MasterTemplete import M02_MasterTemplete_Store as store
@@ -65,24 +64,6 @@ def test_옛_마스터_51_항목이_경로로_읽힘(tmp_path: Path, monkeypatch
]
def test_옮기기_함수는_두_번_돌려도_같음(tmp_path: Path, monkeypatch: pytest.MonkeyPatch):
for kind in store.KINDS:
(tmp_path / kind).mkdir()
for name in ("table/구조물집계표.json", store.COMBO_FILE):
(tmp_path / name).write_bytes((MASTER / name).read_bytes())
monkeypatch.setattr(store, "FOLDER", tmp_path)
before = json.loads((tmp_path / store.COMBO_FILE).read_bytes())["줄"]
store.backfill_missing_structures() # 사본에 세 파일(번호) — 옮기기가 번호를 안 바꾸는지 봄
assert book.migrate_paths() is True
assert book.migrate_paths() is False
after = json.loads((tmp_path / store.COMBO_FILE).read_bytes())["줄"]
assert [r["키"] for r in after] == [r["키"] for r in before]
assert all(r["경로"] == tree.row_path({**r, "경로": None}) for r in after)
table = json.loads((tmp_path / "table/구조물집계표.json").read_bytes())
assert table["층"] == ["종류", "분류1", "분류2", "분류3"] and table["폴더"] == []
assert all(c["경로"] == tree.path_of(c) for c in table["열"] if tree.is_item(c))
# ── ② 나무 고침 — 임시 storage ──────────────────────────