Files
Aislo/resources/tester/test_m01_logic_source.py
T
eomsangdonandClaude Opus 5.5 712d3f19d5 fix(ui): 49 오른쪽 접는 패널 = 좌측 패널 손잡이 양식 · 패널 몸만 따로 스크롤 · 원문 보기 한 벌
- 49-1 공용 ui_template_side_panels — 세로 글 띠 · 접기 ▸ 걷어내고 공용 createWorkflowPanelHandle(side · right · 이름표) 손잡이를 패널 왼쪽 가장자리에 붙임 · 패널마다 손잡이 하나 · 하나만 열림 · 폭 공유 · 모두 접힘(폭 0 · 손잡이만 남음) — M01 로직 상세 · M02 일위대가 상세 · 면적산출 상세 모두 따라감
- 49-3 패널 묶음을 보이는 칸 안에 붙임(followView · 위 칸 overflow 가 CSS sticky 를 막아 JS) — 높이 = 보이는 칸 · 머리띠 아래 멈춤 · 몸만 스크롤
- 49-2 원문 md 읽기 — 빈 줄 · 주석이 붙은 표 둘을 가름(한 표로 합쳐지던 깨짐) · 칸 안 <br> = 줄바꿈
- 49-4 원문 칸 80vh 제한 걷어냄 — 표 높이 = 내용 · 가로 넓은 표만 가로 스크롤
- 49-5 원문 꼴 한 벌 — M01 둘레 글자 크기(14) 안 따르고 본문 크기(M02 와 같음)
- 확인 시나리오 ui_checks/49_오른쪽패널_양식.js · 시험 test_m01_logic_source 표 가름 한 줄

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NPJGtfXo6GMbcpiboQC4uK
2026-10-05 16:16:59 +09:00

64 lines
2.6 KiB
Python

"""M01 로직 원문 — 출처 글 → 품셈 본문 절(44-4). 원본은 읽기만."""
from __future__ import annotations
import json
from fastapi import FastAPI
from fastapi.testclient import TestClient
from M01_MasterData import M01_MasterData_Router as router_module
from M01_MasterData import M01_MasterData_Store as store
from M01_MasterData import M01_MasterData_Store_Make as make
def test_build_civil_section_with_table() -> None:
got = make.source("건설품셈 토목 1-1-2")
assert len(got["found"]) == 1
one = got["found"][0]
assert one["matched"] == "1-1-2"
assert one["file"].startswith("원가계산/건설공사_표준품셈/본문/02_토목부문/제01장_")
assert one["blocks"][0]["h"] == 3 and one["blocks"][0]["text"].startswith("1-1-2 유도선")
table = next(b["table"] for b in one["blocks"] if "table" in b)
assert table[0][0] == "구분" and ["특별인부", "인", "2", "1,350", "1,560"] in table
# 다음 절(1-1-3 …) 앞에서 끊김 · 주석 줄 뺌
assert not any("1-1-3" in b.get("text", "") for b in one["blocks"])
assert not any(b.get("p", "").startswith("<!--") for b in one["blocks"])
def test_forest_and_many_numbers() -> None:
forest = make.source("산림품셈 3-4-2 1")["found"]
assert [x["matched"] for x in forest] == ["3-4-2"]
many = make.source("건설품셈 공통 8-1-5 · 8-1-6")["found"]
assert [x["number"] for x in many] == ["8-1-5", "8-1-6"]
def test_no_link() -> None:
assert make.source("현장 자체 단가")["found"] == []
assert make.source("건설품셈 토목 99-9-9")["found"] == []
def test_most_master_logics_link() -> None:
"""정본 로직 출처 대부분이 원문 절에 닿음."""
hit = total = 0
for path in store.FOLDER.glob("로직_*품셈_*.json"):
for row in json.loads(path.read_text(encoding="utf-8"))["줄"]:
total += 1
hit += bool(make.source(row.get("출처", ""))["found"])
assert total > 1000 and hit / total > 0.9, (hit, total)
def test_route() -> None:
app = FastAPI()
app.include_router(router_module.router)
got = TestClient(app).get("/api/m01/logic/source", params={"src": "산림품셈 3-1"}).json()
assert got["found"][0]["matched"] == "3-1"
def test_tables_split_and_br() -> None:
"""빈 줄 · 주석이 붙은 표 둘을 가름(49-2) · 칸 안 `<br>` = 줄바꿈."""
one = make.source("건설품셈 공통 6-1-1")["found"][0]
tables = [b["table"] for b in one["blocks"] if "table" in b]
assert [len(t[0]) for t in tables] == [7, 2]
assert tables[0][2][0] == "인력운반\n타설"