You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1.2 KiB
Python
31 lines
1.2 KiB
Python
import pytest
|
|
|
|
from app.llm.heuristic import HeuristicProvider
|
|
|
|
CTX = {
|
|
"projects": [
|
|
{"id": "life-trip", "name": "여행 — 한국", "folder_id": "life"},
|
|
{"id": "life-fam", "name": "가족", "folder_id": "life"},
|
|
{"id": "onb", "name": "온보딩 리디자인", "folder_id": "work"},
|
|
]
|
|
}
|
|
|
|
GOLDEN = [
|
|
# (raw, type, sphere, proj_label 포함어, extra 포함어)
|
|
("다음 주에 한국 놀러가는 비행기 티켓 사기", "task", "life", "여행", "가격"),
|
|
("수요일 11시 자전거 수리 맡기기", "event", "life", "캘린더", ""),
|
|
("엄마 생신 선물 미리 알아보기", "task", "life", "가족", ""),
|
|
("온보딩 환영 화면에 짧은 애니메이션 넣으면 어떨까", "idea", "work", "온보딩", ""),
|
|
]
|
|
|
|
|
|
@pytest.mark.parametrize("raw,typ,sphere,proj_kw,extra_kw", GOLDEN)
|
|
def test_golden(raw, typ, sphere, proj_kw, extra_kw):
|
|
c = HeuristicProvider().classify_capture(raw, CTX)
|
|
assert c.type == typ, f"{raw} → type {c.type}"
|
|
assert c.sphere == sphere, f"{raw} → sphere {c.sphere}"
|
|
assert proj_kw in c.proj_label, f"{raw} → proj_label {c.proj_label}"
|
|
if extra_kw:
|
|
assert extra_kw in c.extra
|
|
assert c.reason # 한국어 reason 비어있지 않음
|