From d3e6935d62eb7a1d0f7016566127e6b4ca45f727 Mon Sep 17 00:00:00 2001 From: raf <146721410+rafdog1222@users.noreply.github.com> Date: Thu, 4 Jun 2026 21:19:51 +0800 Subject: [PATCH] fix(tests): update search service mock to match current API signature (#2334) comprehensive_web_search now called with (query, max_pages, return_sources) and returns a tuple (_context, results). The test mock still used the old async signature with max_results/fetch_content and returned a plain list, causing TypeError on every run. Fixes #2331 --- tests/test_search_service_nondict_rows.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_search_service_nondict_rows.py b/tests/test_search_service_nondict_rows.py index 1e1b179..fc6ae3c 100644 --- a/tests/test_search_service_nondict_rows.py +++ b/tests/test_search_service_nondict_rows.py @@ -3,18 +3,18 @@ import asyncio import services.search.service as svc_mod from services.search.service import SearchService - def test_search_skips_non_dict_results(monkeypatch): # comprehensive_web_search aggregates external provider + cache results; # a malformed row (string/None) made the old loop call r.get and crash, # losing the whole search. - async def fake_search(query, max_results=10, fetch_content=False): - return [ - {"url": "https://a.com", "title": "A", "snippet": "x"}, + def fake_search(query, max_pages=10, return_sources=False): + results = [ + {"url": "https://a.com", "title": "A"}, "junk-row", None, - {"url": "https://b.com", "title": "B", "snippet": "y"}, + {"url": "https://b.com", "title": "B"}, ] + return ("", results) monkeypatch.setattr(svc_mod, "comprehensive_web_search", fake_search) svc = SearchService()