feat(insta-lab): Claude Haiku 카드가치 판단(graceful)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
20
insta-lab/tests/test_selection_judge.py
Normal file
20
insta-lab/tests/test_selection_judge.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from app import selection_judge
|
||||
|
||||
|
||||
def test_parse_judge_response_ok():
|
||||
raw = '[{"keyword_id": 1, "score": 0.8}, {"keyword_id": 2, "score": 0.3}]'
|
||||
assert selection_judge.parse_judge_response(raw) == {1: 0.8, 2: 0.3}
|
||||
|
||||
|
||||
def test_parse_judge_response_codefence():
|
||||
raw = '```json\n[{"keyword_id": 5, "score": 0.5}]\n```'
|
||||
assert selection_judge.parse_judge_response(raw) == {5: 0.5}
|
||||
|
||||
|
||||
def test_parse_judge_response_garbage_returns_empty():
|
||||
assert selection_judge.parse_judge_response("not json") == {}
|
||||
|
||||
|
||||
def test_judge_candidates_no_key_returns_empty(monkeypatch):
|
||||
monkeypatch.setattr(selection_judge, "ANTHROPIC_API_KEY", "")
|
||||
assert selection_judge.judge_candidates([{"id": 1, "keyword": "x", "category": "economy"}]) == {}
|
||||
Reference in New Issue
Block a user