Skip to content

Commit ec380c7

Browse files
Expand async tool mapping-response coverage
Co-authored-by: Shri Sukhani <shrisukhani@users.noreply.github.com>
1 parent 53125cc commit ec380c7

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

tests/test_tools_response_handling.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,3 +365,40 @@ async def run() -> None:
365365
await BrowserUseTool.async_runnable(client, {"task": "search docs"})
366366

367367
asyncio.run(run())
368+
369+
370+
def test_async_scrape_tool_supports_mapping_response_data():
371+
async def run() -> None:
372+
client = _AsyncScrapeClient(_Response(data={"markdown": "async mapping"}))
373+
output = await WebsiteScrapeTool.async_runnable(
374+
client,
375+
{"url": "https://example.com"},
376+
)
377+
assert output == "async mapping"
378+
379+
asyncio.run(run())
380+
381+
382+
def test_async_crawl_tool_supports_mapping_page_items():
383+
async def run() -> None:
384+
client = _AsyncCrawlClient(
385+
_Response(data=[{"url": "https://example.com", "markdown": "async body"}])
386+
)
387+
output = await WebsiteCrawlTool.async_runnable(
388+
client, {"url": "https://example.com"}
389+
)
390+
assert "Url: https://example.com" in output
391+
assert "async body" in output
392+
393+
asyncio.run(run())
394+
395+
396+
def test_async_browser_use_tool_supports_mapping_response_data():
397+
async def run() -> None:
398+
client = _AsyncBrowserUseClient(
399+
_Response(data={"final_result": "async mapping output"})
400+
)
401+
output = await BrowserUseTool.async_runnable(client, {"task": "search docs"})
402+
assert output == "async mapping output"
403+
404+
asyncio.run(run())

0 commit comments

Comments
 (0)