Merge remote-tracking branches 'origin/main_laptop_1' and 'origin/sub_laptop_1' into sub_laptop_6
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
/* 784-2 — `logic/M02_MasterTemplete_Hopyo_Unit.ts` 단위 환산 보이기 판정을 트랜스파일해 Node 로 돌림.
|
||||
* stdin = {cases: [{part, from, to}]} · stdout = unitView 결과 배열 JSON. */
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const { makeLoader } = require("./helper_ts_stub_loader.cjs");
|
||||
|
||||
const ROOT = path.join(__dirname, "..", "..");
|
||||
const { loadTs } = makeLoader({ root: ROOT });
|
||||
const unit = loadTs(
|
||||
path.join(ROOT, "M02_MasterTemplete", "logic", "M02_MasterTemplete_Hopyo_Unit.ts"),
|
||||
);
|
||||
const input = JSON.parse(fs.readFileSync(0, "utf8"));
|
||||
process.stdout.write(JSON.stringify(input.cases.map((c) => unit.unitView(c.part, c.from, c.to))));
|
||||
@@ -78,7 +78,7 @@ def test_화면_층_단추_최상위_폴더_이름_바꾸기():
|
||||
|
||||
def test_구조물_조합_층_제자리_바꿈():
|
||||
"""720-4 — 해시 이동 없음 · replaceState · 나무 · 층 줄 · 띠를 감싼 칸에 갈아 끼움 · 권한 = 함수 ·
|
||||
도면 양식 = 누구나(단추는 관리자) · 불러오기 장부 = 열 때 층 · 권한."""
|
||||
도면 양식 = 누구나(단추는 관리자)."""
|
||||
page = _text("M02_MasterTemplete_UI_Page.ts")
|
||||
assert "navigateTo" not in page
|
||||
switch = page.split("const switchStructure = async")[1].split("const go =")[0]
|
||||
@@ -96,5 +96,3 @@ def test_구조물_조합_층_제자리_바꿈():
|
||||
assert "const drawing = opt.isSystem" not in side
|
||||
assert "if (!opt.isSystem) return [];" in side
|
||||
assert "items = await listTemplates(layer, null);" in side
|
||||
hopyo = _text("M02_MasterTemplete_Hopyo_Side.ts")
|
||||
assert "buildHopyoLedger({ scope: pageScope(), canWrite: opt.canWrite() })" in hopyo
|
||||
|
||||
@@ -26,6 +26,12 @@ mf = importlib.import_module("master_formula")
|
||||
mcut = importlib.import_module("master_cut")
|
||||
ms = importlib.import_module("master_formula_sum")
|
||||
|
||||
|
||||
def _nodes(rows):
|
||||
"""[{행, G}] → 줄 나무(옛 `San_Stmate.parse_block` 꼴 · 지금 길 = `Doc_FromNative._emit` 이 줄마다 `parse_line`)."""
|
||||
return [{"행": r.get("행"), "글": r.get("G") or "", **stm.parse_line(r.get("G"))} for r in rows]
|
||||
|
||||
|
||||
STMATE = { # 파일: (블록, 금액 줄, 계표시 줄, 끝전)
|
||||
"봉화": (62, 349, 184, "비목버림"),
|
||||
"동부청영월": (69, 411, 230, "합버림_큰나머지"),
|
||||
@@ -72,7 +78,7 @@ def _load(tag: str) -> dict:
|
||||
|
||||
|
||||
def _stmate(tag: str, blk: dict) -> tuple[list, dict]:
|
||||
nodes = stm.parse_block(blk["몸"])
|
||||
nodes = _nodes(blk["몸"])
|
||||
return nodes, em.stmate(blk, nodes, _load(tag)["단가"], STMATE[tag][3])
|
||||
|
||||
|
||||
@@ -150,7 +156,7 @@ def test_link_keys_m01() -> None:
|
||||
"""호표 줄 = 793-2 꼴(종류 · 단가 · 이음 = 1차 줄 판정 M01 키) · 덧칸 자원 · 원본."""
|
||||
tag = "봉화"
|
||||
blk = next(b for b in _load(tag)["블록"] if b["코드"] == "D00102")
|
||||
out = em.stmate(blk, stm.parse_block(blk["몸"]), _load(tag)["단가"], "비목버림", True)
|
||||
out = em.stmate(blk, _nodes(blk["몸"]), _load(tag)["단가"], "비목버림", True)
|
||||
labor = next(x for x in out["로직"]["호표"] if x["이름"] == "보통인부")
|
||||
assert {k: v for k, v in labor.items() if k != "자원"} == {
|
||||
"이름": "보통인부",
|
||||
@@ -207,7 +213,7 @@ def test_stmate_grammar_sample_engine() -> None:
|
||||
"'뒤 인부' &L00007& * 0.01 =",
|
||||
]
|
||||
rows = [{"행": i, "G": g} for i, g in enumerate(text)]
|
||||
nodes = stm.parse_block(rows)
|
||||
nodes = _nodes(rows)
|
||||
block = {"코드": "D00001", "이름": "견본", "꼬리": [], "몸": rows}
|
||||
block["머리"] = {"A": "", "B": "", "C": 0, "D": 0, "E": 0, "F": 0}
|
||||
out = em.stmate(block, nodes, prices, "비목버림")
|
||||
|
||||
@@ -24,6 +24,11 @@ NOTE = em.NOTE
|
||||
DOCS = golden.DOCS
|
||||
|
||||
|
||||
def _nodes(rows):
|
||||
"""[{행, G}] → 줄 나무(옛 `San_Stmate.parse_block` 꼴 · 지금 길 = `Doc_FromNative._emit` 이 줄마다 `parse_line`)."""
|
||||
return [{"행": r.get("행"), "글": r.get("G") or "", **stm.parse_line(r.get("G"))} for r in rows]
|
||||
|
||||
|
||||
def notes(out: dict) -> list[str]:
|
||||
return [m for m in out["원본"]["표지"] if NOTE in m]
|
||||
|
||||
@@ -60,7 +65,7 @@ def test_applied_or_first_column_is_flagged() -> None:
|
||||
)
|
||||
nothing = book.applied_how(_row((None,) * 4, (0, 0, 0, 0)))
|
||||
assert nothing[1] is None # 쓸 값이 없는 줄
|
||||
assert book.applied(_row((100, 40, 30, 30), (90, 40, 30, 20)))["T"] == 100
|
||||
assert book.applied_how(_row((100, 40, 30, 30), (90, 40, 30, 20)))[0]["T"] == 100
|
||||
|
||||
|
||||
def test_first_column_note_reaches_block_flags() -> None:
|
||||
@@ -88,7 +93,7 @@ def _stmate_out(meta: dict) -> dict:
|
||||
rows = [{"행": 0, "G": "'보통인부' &L00007& * 1 :=A01"}]
|
||||
block = {"코드": "D00001", "이름": "견본", "꼬리": [], "몸": rows}
|
||||
block["머리"] = {"A": "", "B": "", "C": 0, "D": 0, "E": 0, "F": 0}
|
||||
return em.stmate(block, stm.parse_block(rows), prices, "비목버림")
|
||||
return em.stmate(block, _nodes(rows), prices, "비목버림")
|
||||
|
||||
|
||||
def test_adjust_ratio_and_bid_rate_are_flagged() -> None:
|
||||
|
||||
@@ -173,7 +173,6 @@ def test_apart_item_zero(world) -> None:
|
||||
var = _var(conv, e["기호"])
|
||||
assert e["별도계상"] and var["연결"]["갈래"] == "숫자"
|
||||
assert f"별도계상 · 품목: {gov['이름']} {gov['규격']} · 셈은 프로젝트에서" in var["설명"]
|
||||
assert mp.item_key(mine["자원"]) == gov["키"]
|
||||
assert skpath.read(got["이름"])["셈"] == skpath.read(plain["이름"])["셈"]
|
||||
# 이미 만든(고름 전) SK 에 물음 예 = 품목 설명만 · 단가 0 그대로
|
||||
money = skpath.read(plain["이름"])["셈"]
|
||||
|
||||
Reference in New Issue
Block a user