"""338-1 옵션 거꾸로 찾기(`M02_Hopyo_Option`) — 레미콘 소량 「하나만」 · 합판 갈리는 칸 · 무근 R 맞음 · 구조물터파기 없음(다른 점) · 펌프차 기계 칸 · 견줌 · 반올림 폭. 실물 = 북부청 임도 · 사방(읽기만).""" import pytest from M02_MasterTemplete import M02_Hopyo_Finger as finger from M02_MasterTemplete import M02_Hopyo_Option as option from M02_MasterTemplete import M02_Hopyo_Ours as ours from resources.tester.helper_m02_hopyo_golden import line_of def _find(lid: str, code: str) -> dict: block, line = line_of(lid) return option.find(code, finger.excel(block, line), (block or {}).get("글")) def test_레미콘_소량_하나만(): got = _find("N000", "GC000198") assert got["수준"] == 0 and got["판정"] == "하나만" assert got["입력"] == {"타설방법": "장비사용타설", "구조물": "철근구조물", "소량감률": 50} assert got["우리품"]["인력"] == {"콘크리트공": 0.109091, "보통인부": 0.036364} def test_합판_보통_갈리는_칸(): got = _find("N001", "GC000211") assert got["수준"] == 0 and got["판정"] == "여럿(같은 품)" assert got["입력"]["유형"] == "보통" and got["입력"]["사용횟수"] == "4회" assert set(got["갈리는칸"]) == {"측압", "폼타이규격"} def test_무근_반올림_맞음(): got = _find("N013", "GC000198") assert got["수준"] <= 1 and got["입력"]["구조물"] == "무근구조물" def test_구조물터파기_없음_가까운_옵션(): got = _find("N008", "GC000083") assert got["수준"] == 9 and got["판정"] == "없음" and got["직종같음"] assert got["견줌"]["직종"] == "직종 같음" and got["거리"] < 0.1 def test_펌프차_기계_칸(): efp = finger.machine({"이름": "콘크리트 펌프차", "규격": "41m,80~95㎥/hr", "단위": "hr"}) got = option.find("GC000268", efp) assert got["수준"] == 0 code = got["입력"]["기계"] assert ours.eq_of(code)[0] == {"콘크리트펌프"} and 41.0 in option.eq_numbers(code) def test_없는_로직_못_셈(): efp = finger.machine({"이름": "굴착기", "규격": "0.6㎥", "단위": "hr"}) assert option.find("없는로직", efp)["판정"] == "못 셈" def test_반올림_폭_견줌(): assert option.ru(0.15) == pytest.approx(0.005) and option.ru(0.1) == 0.0 assert option.ru(0.109091) == 0.0 e = {"인력": {"보통인부": {"품": 0.15, "밑품": 0.15}}, "장비": [], "자재": []} v = {"L": {"보통인부": 0.1545}, "X": [], "M": {}, "S": {}} assert not option.compare(e, v, 0.005)["핵심"] and option.compare(e, v, 0.005, rnd=True)["핵심"] assert not option.strong(e, option.compare(e, v, 0.03)) # 보통인부 하나뿐 = 우연 맞음