# ruff: noqa: E501 """799-2 옛 탭 넷 걷음 지킴 — 시트 · 인력/재료/경비 · 시험 계산 · 텍스트 수식 (M01 로직 상세 · M02 단가산출 상세). - 걷은 파일은 없고 어디서도 안 부름 · 보기 = 수식 · 단가산출 상세 둘 · 기본정보는 맨 위 - 셈 구동은 화면 칸 없이 `_Logic_Drive.ts`(서버 셈) — M01 상세는 구동만 · 시험 계산 칸(`Logic_Calc`)은 로직 복사 화면 몫 - 서버 길은 남김(`/logic/sheet` · 시트 문서 칸 · 수식 검사가 같은 엔진) """ from __future__ import annotations import re import subprocess from pathlib import Path ROOT = Path(__file__).resolve().parents[2] M01 = ROOT / "M01_MasterData" M02 = ROOT / "M02_MasterTemplete" GONE = [ M01 / "M01_MasterData_UI_LogicLab_Sheet.ts", M01 / "logic" / "M01_Logic_Sheet_Model.ts", M01 / "M01_MasterData_UI_LogicLab_Formula.ts", M01 / "M01_MasterData_UI_LogicLab_FormulaTokens.ts", M01 / "M01_MasterData_UI_LogicLab_Formula.css", M01 / "M01_MasterData_UI_LogicLab_Est.ts", M02 / "M02_MasterTemplete_Sangeun_Sheet.ts", M02 / "M02_MasterTemplete_Sangeun_SheetEdit.ts", M02 / "M02_MasterTemplete_Sangeun_SheetFormula.ts", M02 / "M02_MasterTemplete_Sangeun_Sheet.css", M02 / "logic" / "M02_Sangeun_Sheet_Model.ts", M02 / "logic" / "M02_Sangeun_Const_Model.ts", M02 / "logic" / "M02_Sangeun_Formula_Model.ts", ] def _text(p: Path) -> str: return p.read_text(encoding="utf-8") def _tracked() -> list[Path]: out = subprocess.run( ["git", "-c", "core.quotepath=off", "ls-files", "*.ts", "*.css"], cwd=ROOT, capture_output=True, text=True, encoding="utf-8", check=True, ).stdout # fmt: skip return [ROOT / x for x in out.splitlines() if x and not x.startswith(("docs/", "tmp/"))] def test_걷은_파일_없고_부르는_곳_없음(): assert not [p for p in GONE if p.exists()] names = [p.name.rsplit(".", 1)[0] for p in GONE] for p in _tracked(): text = _text(p) for n in names: assert f'/{n}"' not in text and f'./{n}"' not in text and f"{n}.css" not in text, ( p.name, n, ) def test_보기는_수식_단가산출상세_둘(): m01 = _text(M01 / "M01_MasterData_UI_LogicLab_View.ts") m02 = _text(M02 / "M02_MasterTemplete_Sangeun_Tabs.ts") for src in (m01, m02): assert re.findall(r'\{ value: "(\w+)", label: ', src) == ["stack", "ho"] # 804-6 assert 'export type LabView = "stack" | "ho";' in m01 css = _text(M01 / "M01_MasterData_UI_LogicLab_Style.css") assert '[data-view="ho"] [data-block]:not([data-block="ho"])' in css assert 'data-view="sheet"' not in css and 'data-view="calc"' not in css def test_셈_구동은_화면_없이_상세는_구동만(): drive = _text(M01 / "M01_MasterData_UI_Logic_Drive.ts") assert "document." not in drive and "sessionStorage." not in drive assert "export async function driveRun(" in drive and "export function createDrive(" in drive lab = _text(M01 / "M01_MasterData_UI_LogicLab.ts") assert "createDrive()" in lab and "buildCalc" not in lab and "data-calc-run" not in lab assert "rerun: () => void drive.run()," in lab detail = _text(M01 / "M01_MasterData_UI_LogicLab_Detail.ts") assert "calcHost" not in detail and "data-calc-run" not in detail and "ctx.rerun?.()" in detail calc = _text( M01 / "M01_MasterData_UI_Logic_Calc.ts" ) # 로직 복사 화면이 쓰는 시험 계산 칸 — 구동은 공용 assert "driveRun(ctx)" in calc and "runCalc" not in calc m02 = _text(M02 / "M02_MasterTemplete_Sangeun_Detail.ts") assert "buildCalc" not in m02 and "calcHost" not in m02 and "createSangeunTabs(editor" in m02 def test_파일_700줄_안(): for p in (M01 / "M01_MasterData_UI_LogicLab.ts", M01 / "M01_MasterData_UI_LogicLab_Detail.ts", M02 / "M02_MasterTemplete_Sangeun_Detail.ts", M02 / "M02_MasterTemplete_Sangeun_Tabs.ts", M01 / "M01_MasterData_UI_Logic_Drive.ts"): # fmt: skip assert len(_text(p).splitlines()) <= 700, p.name