Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
20 lines
653 B
Python
20 lines
653 B
Python
import json
|
|
from pathlib import Path
|
|
import pytest
|
|
import sys
|
|
|
|
sys.path.insert(0, str(Path(__file__).parent / "src"))
|
|
from search_tools import search_knowledge_base
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_search_knowledge_base_negative_top_k(tmp_path: Path):
|
|
(tmp_path / "doc1.txt").write_text("test content one", encoding="utf-8")
|
|
(tmp_path / "doc2.txt").write_text("test content two", encoding="utf-8")
|
|
|
|
res = await search_knowledge_base("test", str(tmp_path), top_k=-1)
|
|
payload = json.loads(res.text)
|
|
assert payload["success"] is True
|
|
assert payload["message"]["total_found"] == 0
|
|
assert payload["message"]["results"] == []
|