Fix tests
This commit is contained in:
parent
9aa8d020e1
commit
d19d2b7f00
3 changed files with 8 additions and 4 deletions
|
|
@ -159,7 +159,7 @@ async def test_search(app: HaikuRAGApp, monkeypatch):
|
||||||
with patch("haiku.rag.app.HaikuRAG", return_value=mock_client):
|
with patch("haiku.rag.app.HaikuRAG", return_value=mock_client):
|
||||||
await app.search("query")
|
await app.search("query")
|
||||||
|
|
||||||
mock_client.search.assert_called_once_with("query", limit=5)
|
mock_client.search.assert_called_once_with("query", limit=5, filter=None)
|
||||||
assert mock_rich_print_search.call_count == len(mock_results)
|
assert mock_rich_print_search.call_count == len(mock_results)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -176,7 +176,7 @@ async def test_search_no_results(app: HaikuRAGApp, monkeypatch):
|
||||||
with patch("haiku.rag.app.HaikuRAG", return_value=mock_client):
|
with patch("haiku.rag.app.HaikuRAG", return_value=mock_client):
|
||||||
await app.search("query")
|
await app.search("query")
|
||||||
|
|
||||||
mock_client.search.assert_called_once_with("query", limit=5)
|
mock_client.search.assert_called_once_with("query", limit=5, filter=None)
|
||||||
mock_print.assert_called_once_with("[yellow]No results found.[/yellow]")
|
mock_print.assert_called_once_with("[yellow]No results found.[/yellow]")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,9 @@ def test_search():
|
||||||
result = runner.invoke(cli, ["search", "query"])
|
result = runner.invoke(cli, ["search", "query"])
|
||||||
|
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
mock_app_instance.search.assert_called_once_with(query="query", limit=5)
|
mock_app_instance.search.assert_called_once_with(
|
||||||
|
query="query", limit=5, filter=None
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_serve_no_flags():
|
def test_serve_no_flags():
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,10 @@ chunks = [
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_reranker_base():
|
async def test_reranker_base():
|
||||||
|
from haiku.rag.config import Config
|
||||||
|
|
||||||
reranker = RerankerBase()
|
reranker = RerankerBase()
|
||||||
assert reranker._model == ""
|
assert reranker._model == Config.reranking.model
|
||||||
|
|
||||||
with pytest.raises(NotImplementedError):
|
with pytest.raises(NotImplementedError):
|
||||||
await reranker.rerank("query", [])
|
await reranker.rerank("query", [])
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue