updated tests
This commit is contained in:
@@ -75,7 +75,7 @@ def test_reranking_enabled_reorders_candidates(monkeypatch: pytest.MonkeyPatch)
|
||||
results = rerank_chunks("query", candidates(), RerankConfig())
|
||||
|
||||
assert [result.chunk_id for result in results] == [2, 1, 3]
|
||||
assert [round(result.score, 3) for result in results] == [0.45, 0.1, 0.0]
|
||||
assert [round(result.score, 3) for result in results] == [0.78, 0.37, 0.28]
|
||||
assert [result.rerank_score for result in results] == [0.9, 0.1, 0.4]
|
||||
|
||||
|
||||
@@ -100,8 +100,8 @@ def test_reranking_cannot_ignore_hybrid_score(monkeypatch: pytest.MonkeyPatch) -
|
||||
results = rerank_chunks("query", candidates, RerankConfig())
|
||||
|
||||
assert [result.chunk_id for result in results] == [1, 2]
|
||||
assert results[0].score == 0.7
|
||||
assert results[1].score == 0.0
|
||||
assert results[0].score == pytest.approx(0.79)
|
||||
assert results[1].score == 0.7
|
||||
assert results[1].rerank_score == 1.0
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ def test_malformed_vllm_rerank_json_does_not_crash_search(monkeypatch: pytest.Mo
|
||||
|
||||
results = rerank_chunks("query", candidates()[:1], RerankConfig())
|
||||
|
||||
assert results[0].score == 0.0
|
||||
assert results[0].score == 0.3
|
||||
|
||||
|
||||
def test_vllm_rerank_scores_are_clamped(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
@@ -147,4 +147,4 @@ def test_vllm_rerank_scores_are_clamped(monkeypatch: pytest.MonkeyPatch) -> None
|
||||
|
||||
results = rerank_chunks("query", candidates()[:2], RerankConfig())
|
||||
|
||||
assert [result.rerank_score for result in results] == [0.0, 1.0]
|
||||
assert {result.chunk_id: result.rerank_score for result in results} == {1: 0.0, 2: 1.0}
|
||||
|
||||
Reference in New Issue
Block a user