- 왼쪽 「실무문서」 칸(Practice.ts) · 일위대가 가져오기 「실무문서」 탭 · 복사 원본 고르기 · 낱 CSS · locale 열쇠 걷음 - 서버 `from_layer=practice`(_copy_practice) · `DELETE /api/m02/practice`(drop_practice) · 조합 목록 · 키 하나 읽기 길 걷음 · 조합 길 시스템 관리자 문 걷음(담을 로직 읽기는 그대로) - 옛 마스터 조합 파일 `일위대가조합.json`(UA 37) = 쓰는 곳 있음(구조물집계표 일위대가 칸 · labor 본뜬키 · 프로젝트 초기값 사본 · 불러오기 맞춤 씨앗) → 파일 · 읽기 길 유지 · 지우지 않음 - 낡은 시험: test_m02_practice 지움(화면 · 길 없음) · 조합 길 읽던 시험(combo · combo_inputs · combo_layers)은 저장소 함수로 · 실무문서 복사 시험(labor_copy · pair_copy) 줄 지움 · 탭 · 차례 단정(layer_screen · structure_options · structure_panel · 720 · precombo_scope · ui_loading) 고침 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
80 lines
3.6 KiB
Python
80 lines
3.6 KiB
Python
"""일위대가 ↔ 면적산출 함께 가져오기(PLAN 43-9a) · 새 항목 = 칸 셋 자동 생성.
|
|
|
|
시스템 층 = 견본 표(임시 폴더) · 개인 층 = 임시 storage (`test_m02_labor_copy` 의 world 를 씀).
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
from pathlib import Path
|
|
|
|
from M02_MasterTemplete import M02_Labor_Doc as labor
|
|
from M02_MasterTemplete import M02_MasterTemplete_Store as store
|
|
from resources.tester.test_m02_labor_copy import (
|
|
TEN,
|
|
URL,
|
|
_as,
|
|
world, # noqa: F401 — 고정물
|
|
)
|
|
|
|
|
|
def _doc(folder: Path, kind: str, cid: str) -> dict:
|
|
return json.loads((folder / kind / f"{cid}.json").read_bytes())
|
|
|
|
|
|
def _link_rv(system: Path) -> None:
|
|
"""원본 rv — 일위대가 수량은 알약 연결 · 면적산출 B6 = 5 에 그 알약."""
|
|
with store.at(system):
|
|
got = store.read("labor", "rv")
|
|
rows = [{"로직": TEN, "입력값": {}, "수량": None}]
|
|
store.write("labor", "rv", got["판"], {**got["문서"], "담은로직": rows})
|
|
pill = labor.pills(store.read("labor", "rv")["문서"])[0]["키"]
|
|
area = store.read("area", "rv")
|
|
sheet = area["문서"]["시트"][0]
|
|
sheet["칸"] = {"B6": {"값": "5"}}
|
|
sheet["연결"] = [{"키": pill, "이름": "x", "칸": "B6", "단위": "㎡"}]
|
|
store.write("area", "rv", area["판"], area["문서"])
|
|
|
|
|
|
def test_새_항목_칸_셋_빈_문서_자동_같은_뒷자리(world): # noqa: F811
|
|
personal = world["personal"]
|
|
numbers = [_doc(personal, k, "a")[key] for k, key in store._KEY.items()]
|
|
assert [n[:2] for n in numbers] == ["SD", "SU", "SA"]
|
|
assert len({n[2:] for n in numbers}) == 1
|
|
assert _doc(personal, "labor", "a")["담은로직"] == []
|
|
|
|
|
|
def test_일위대가_면적산출_함께_덮어씀_도면은_그대로(world): # noqa: F811
|
|
system, personal = world["system"], world["personal"]
|
|
_link_rv(system)
|
|
before = {k: _doc(personal, k, "a") for k in ("structure", "labor", "area")}
|
|
for kind in ("labor", "area"): # 어느 카드에서 불러도 같음
|
|
url = URL.format("personal", kind, "a") + "?from=rv&from_layer=system&pair=true"
|
|
got = _as(world).post(url)
|
|
assert got.status_code == 200 and set(got.json()) == {"area", "labor"}
|
|
area, doc = _doc(personal, "area", "a"), _doc(personal, "labor", "a")
|
|
assert area["시트"][0]["연결"][0]["칸"] == "B6" and area["면적번"] == before["area"]["면적번"]
|
|
assert (doc["담은로직"][0]["로직"], doc["일위대가번"]) == (TEN, before["labor"]["일위대가번"])
|
|
line = doc["계산값"]["줄"][0]
|
|
assert (line["수량"], line["수량출처"]) == (5, "칸") # 새 면적 칸 값으로 셈
|
|
assert _doc(personal, "structure", "a") == before["structure"]
|
|
|
|
|
|
def test_pair_없으면_예전처럼_한_칸만(world): # noqa: F811
|
|
system, personal = world["system"], world["personal"]
|
|
_link_rv(system)
|
|
url = URL.format("personal", "labor", "a") + "?from=rv&from_layer=system"
|
|
assert _as(world).post(url).status_code == 200
|
|
assert "연결" not in _doc(personal, "area", "a")["시트"][0]
|
|
|
|
|
|
def test_원본에_면적산출_없으면_일위대가만(world): # noqa: F811
|
|
system, personal = world["system"], world["personal"]
|
|
(system / "area" / "rv.json").unlink()
|
|
area = _doc(personal, "area", "a")
|
|
url = URL.format("personal", "area", "a") + "?from=rv&from_layer=system&pair=true"
|
|
got = _as(world).post(url)
|
|
assert got.status_code == 200 and set(got.json()) == {"labor"}
|
|
assert _doc(personal, "area", "a") == area
|
|
assert _doc(personal, "labor", "a")["담은로직"][0]["로직"] == TEN
|