feat(assistant): #91 etapes enrichies (sous-sections Reflechon/Sources, chevrons, indicateur anime, suppression barre de chargement)
CI / lint (push) Successful in 1m23s
CI / security (push) Successful in 58s
CI / test (push) Successful in 2m43s
CI / build (push) Successful in 55s
CI / e2e (push) Successful in 11m8s

This commit is contained in:
2026-09-15 22:53:15 -04:00
parent 431fb5626d
commit f630771150
13 changed files with 477 additions and 80 deletions
+24
View File
@@ -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")