feat(assistant): #91 etapes enrichies (sous-sections Reflechon/Sources, chevrons, indicateur anime, suppression barre de chargement)
This commit is contained in:
@@ -67,6 +67,30 @@ class TestWebSearch:
|
||||
with pytest.raises(ToolError):
|
||||
web.web_search(_ctx(), web.WebSearchInput(query=" "))
|
||||
|
||||
def test_empty_result_set_warns_about_blocked_engines(self, monkeypatch):
|
||||
"""An all-blocked instance answers 200 with no results: the model must
|
||||
be told instead of retrying the same search until the quota burns."""
|
||||
monkeypatch.setattr(web.httpx, "get", lambda *a, **kw: FakeResponse(json_data={
|
||||
"results": [],
|
||||
"number_of_results": 0,
|
||||
"unresponsive_engines": [["duckduckgo", "CAPTCHA"], ["google", "access denied"]],
|
||||
}))
|
||||
out = web.web_search(_ctx(), web.WebSearchInput(query="meteo montreal"))
|
||||
assert out["count"] == 0
|
||||
assert out["unresponsive_engines"] == ["duckduckgo", "google"]
|
||||
assert "warning" in out
|
||||
assert "indisponibles" in out["warning"]
|
||||
|
||||
def test_results_carry_no_warning(self, monkeypatch):
|
||||
monkeypatch.setattr(web.httpx, "get", lambda *a, **kw: FakeResponse(json_data={
|
||||
"results": [{"title": "A", "url": "https://a.dev", "content": "x"}],
|
||||
"unresponsive_engines": [["brave", "rate limited"]],
|
||||
}))
|
||||
out = web.web_search(_ctx(), web.WebSearchInput(query="pizza"))
|
||||
assert out["count"] == 1
|
||||
assert "warning" not in out
|
||||
assert out["unresponsive_engines"] == ["brave"]
|
||||
|
||||
def test_engine_unavailable_maps_to_tool_error(self, monkeypatch):
|
||||
def boom(*a, **kw):
|
||||
raise web.httpx.ConnectError("down")
|
||||
|
||||
Reference in New Issue
Block a user