refactor(B08,B09): 폴더째 old_code 로 옮기고 빈 화면 둘만 남김 (PLAN 7-3)
B08_Quantity 86 · B09_Estimation 111 파일을 old_code/ 로 옮김(지우지 않음). 화면은 메뉴·주소·단계 막대만 남은 빈 틀 둘 — main.py 라우터 13 개는 끊음. B07 이 빌려 쓰던 비탈 길이·면적은 필요한 함수만 B07_DesignDetail_Engine_SlopeGeometry 로 옮겨 적음(면적 적분·노면 면적·측점 묶음은 안 옮김) · 시험 하나를 새로 둠. B07 구조물도 조립(Cad_StandardSheet)은 2026-09-13 에 이미 도면 목록에서 빠져 부르는 곳이 없어 old_code 로 같이 보냄 — 구조물 그림은 되살리지 않음. B06 구조물 몫 조회는 빈 값으로 두어 화면이 그대로 서게 함. B08·B09 를 부르던 시험 25 개도 old_code/resources/tester 로 옮김. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PAdA5ThqmtVSsbzjusk1cJ
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
"""별칭표 한 벌 (2026-09-13 축 C 명세 5장·17장 · `common_util_aliases`).
|
||||
|
||||
지키는 것
|
||||
① 정본 파일의 모든 줄에 scope·pum_edition 이 있다
|
||||
② 별칭은 **범위 안·같은 판**에서만 옮긴다 — 「리핑암 → 파쇄암」은 10-11 에서만
|
||||
③ 양방향 조회 — 품셈 이름으로도 우리 이름을 찾는다
|
||||
④ scope 없음 · 모르는 축 · 겹친 범위의 두 대상은 읽을 때 오류
|
||||
⑤ B09 갈래 고르기와 B08 인계본이 **같은 파일**을 읽는다
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
|
||||
import pytest
|
||||
|
||||
from B08_Quantity.B08_Quantity_Engine_Handoff import load_mapping
|
||||
from common_util.common_util_aliases import (
|
||||
ALIAS_FILE,
|
||||
AliasError,
|
||||
alias_target,
|
||||
load_aliases,
|
||||
parse_aliases,
|
||||
)
|
||||
|
||||
ROW = {
|
||||
"axis": "variant",
|
||||
"from": "리핑암",
|
||||
"to": "파쇄암",
|
||||
"scope": "FP-10-11",
|
||||
"pum_edition": "2026-01-01",
|
||||
}
|
||||
|
||||
|
||||
def test_정본_파일_모든_줄에_범위와_판():
|
||||
rows = parse_aliases(json.loads(ALIAS_FILE.read_text(encoding="utf-8"))["aliases"])
|
||||
assert rows
|
||||
assert all(row["scope"].startswith("FP-") and row["pum_edition"] for row in rows)
|
||||
|
||||
|
||||
def test_범위_안_같은_판에서만_옮긴다():
|
||||
rows = load_aliases("variant")
|
||||
assert alias_target(rows, "리핑암", "FP-10-11", "2026-01-01") == "파쇄암"
|
||||
assert alias_target(rows, "리 핑 암", "FP-10-12-02", "2026-01-01") == "암절취"
|
||||
assert alias_target(rows, "리핑암", "FP-09-19-02", "2026-01-01") is None
|
||||
assert alias_target(rows, "리핑암", "FP-10-11", "2027-01-01") is None
|
||||
assert alias_target(rows, "발파암", "FP-10-11", "2026-01-01") is None
|
||||
|
||||
|
||||
def test_양방향_조회():
|
||||
rows = load_aliases("variant")
|
||||
assert alias_target(rows, "파쇄암", "FP-10-11", "2026-01-01", reverse=True) == "리핑암"
|
||||
assert alias_target(rows, "파쇄암", "FP-10-12", "2026-01-01", reverse=True) is None
|
||||
|
||||
|
||||
def test_규약_어기면_읽을_때_오류():
|
||||
with pytest.raises(AliasError):
|
||||
parse_aliases([{**ROW, "scope": ""}])
|
||||
with pytest.raises(AliasError):
|
||||
parse_aliases([{**ROW, "axis": "ground"}])
|
||||
with pytest.raises(AliasError):
|
||||
parse_aliases([ROW, {**ROW, "to": "암절취", "scope": "FP-10"}])
|
||||
# 범위가 안 겹치거나 판이 다르면 같은 이름이 다른 곳으로 가도 된다
|
||||
assert len(parse_aliases([ROW, {**ROW, "to": "암절취", "scope": "FP-10-12"}])) == 2
|
||||
assert len(parse_aliases([ROW, {**ROW, "to": "암절취", "pum_edition": "2027-01-01"}])) == 2
|
||||
|
||||
|
||||
def test_B08_인계본은_범위째_싣는다():
|
||||
view = load_mapping().ground_aliases["aliases"]["리핑암"]
|
||||
assert view["scopes"] == {"파쇄암": "FP-10-11", "암절취": "FP-10-12"}
|
||||
|
||||
|
||||
def test_B09_갈래_고르기가_별칭표를_읽는다():
|
||||
from B09_Estimation.B09_Estimation_UnitPrice import find_variant_code
|
||||
|
||||
assert find_variant_code("FP-10-11", "리핑암") == "B-FP-10-11#파쇄암"
|
||||
assert find_variant_code("FP-10-11", "발파암") == "B-FP-10-11#발파암"
|
||||
Reference in New Issue
Block a user