fix pipelines

This commit is contained in:
2026-06-02 22:43:12 -07:00
parent 40a4274fd3
commit b2c0c6ccdb
4 changed files with 92 additions and 1 deletions
+44
View File
@@ -30,6 +30,50 @@ def test_parse_clip_response():
assert candidates[0].title_zh == "标题"
def test_parse_clip_response_accepts_candidates_key_and_score_out_of_ten():
candidates = parse_clip_response(
"""
{
"candidates": [
{
"start_sec": 10,
"end_sec": 60,
"title_zh": "标题",
"summary_zh": "摘要",
"reason": "有趣",
"score": 8.5,
"tags": ["反应"],
"subtitle_priority": "high"
}
]
}
"""
)
assert candidates[0].score == 0.85
def test_parse_clip_response_normalizes_score_out_of_hundred():
candidates = parse_clip_response(
"""
{
"clips": [
{
"start_sec": 10,
"end_sec": 60,
"title_zh": "标题",
"summary_zh": "摘要",
"reason": "有趣",
"score": 92,
"tags": ["反应"],
"subtitle_priority": "high"
}
]
}
"""
)
assert candidates[0].score == 0.92
def test_dedupe_and_rank_candidates_filters_short_and_overlapping():
candidates = [
ClipCandidate(