mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
Fix web_search tests
This commit is contained in:
@@ -58,7 +58,11 @@ def web_search(query: str, agent: Agent, num_results: int = 8) -> str:
|
||||
attempts += 1
|
||||
|
||||
search_results = [
|
||||
{"title": r["title"], "url": r["href"], "description": r["body"]}
|
||||
{
|
||||
"title": r["title"],
|
||||
"url": r["href"],
|
||||
**({"description": r["body"]} if r.get("body") else {}),
|
||||
}
|
||||
for r in search_results
|
||||
]
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ def test_safe_google_results_invalid_input():
|
||||
(
|
||||
"test",
|
||||
1,
|
||||
'[\n {\n "title": "Result 1",\n "link": "https://example.com/result1"\n }\n]',
|
||||
[{"title": "Result 1", "link": "https://example.com/result1"}],
|
||||
'[\n {\n "title": "Result 1",\n "url": "https://example.com/result1"\n }\n]',
|
||||
[{"title": "Result 1", "href": "https://example.com/result1"}],
|
||||
),
|
||||
("", 1, "[]", []),
|
||||
("no results", 1, "[]", []),
|
||||
|
||||
Reference in New Issue
Block a user