fix(m02-cf): 입력 상자 단위를 요소 · 변수 단위에 맞춤 — 열 때 바로잡음(견본 인력 상자 원/일)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019ACSGaHdLgnkEkoA4LDtMU
This commit is contained in:
@@ -219,3 +219,36 @@ def test_환율_유가전력_알약_이름에_날짜가_안_들어감():
|
||||
"값": 1900,
|
||||
}
|
||||
assert call("elementOf", "유가전력", oil)["name"] == "휘발유 서울"
|
||||
|
||||
|
||||
def test_단위가_안_맞게_저장된_상자는_열_때_맞춤():
|
||||
el1, el2 = call("elementOf", "인력", LABOR), call("elementOf", "인력", LABOR2)
|
||||
lg = logic()
|
||||
lg["boxes"][0]["input"] = {
|
||||
"mode": "group",
|
||||
"group": "인력",
|
||||
"elements": [el1, el2],
|
||||
"variables": [],
|
||||
}
|
||||
assert lg["boxes"][0]["unit"] == "-"
|
||||
fixed = run([{"op": "fn", "name": "reconcileUnit", "args": [lg, "b1"]}])[0]
|
||||
assert fixed["boxes"][0]["unit"] == "원/일"
|
||||
again = run([{"op": "fn", "name": "reconcileUnit", "args": [fixed, "b1"]}])[0]
|
||||
assert again == fixed
|
||||
oil = {"ref": "X", "name": "경유", "spec": "", "unit": "원/L"}
|
||||
lg["boxes"][0]["input"]["elements"].append(oil)
|
||||
lg["boxes"][0]["unit"] = "원/일"
|
||||
assert (
|
||||
run([{"op": "fn", "name": "reconcileUnit", "args": [lg, "b1"]}])[0]["boxes"][0]["unit"]
|
||||
== "-"
|
||||
)
|
||||
one = {
|
||||
"mode": "variable",
|
||||
"elements": [],
|
||||
"variables": [{"name": "면적", "type": "number", "unit": "㎡", "example": 1}],
|
||||
}
|
||||
lg["boxes"][0]["input"] = one
|
||||
assert (
|
||||
run([{"op": "fn", "name": "reconcileUnit", "args": [lg, "b1"]}])[0]["boxes"][0]["unit"]
|
||||
== "㎡"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user