Skip to content

Commit d185350

Browse files
Cover async extract non-mapping input validation
Co-authored-by: Shri Sukhani <shrisukhani@users.noreply.github.com>
1 parent e01de43 commit d185350

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

tests/test_tools_mapping_inputs.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ def __init__(self):
3737
self.scrape = _AsyncScrapeManager()
3838

3939

40+
class _AsyncExtractManager:
41+
async def start_and_wait(self, params):
42+
return _Response({"ok": True})
43+
44+
45+
class _AsyncExtractClient:
46+
def __init__(self):
47+
self.extract = _AsyncExtractManager()
48+
49+
4050
def test_tool_wrappers_accept_mapping_inputs():
4151
client = _Client()
4252
params = MappingProxyType({"url": "https://example.com"})
@@ -77,4 +87,11 @@ async def run() -> None:
7787
["https://example.com"], # type: ignore[arg-type]
7888
)
7989

90+
extract_client = _AsyncExtractClient()
91+
with pytest.raises(HyperbrowserError, match="tool params must be a mapping"):
92+
await WebsiteExtractTool.async_runnable(
93+
extract_client,
94+
"bad", # type: ignore[arg-type]
95+
)
96+
8097
asyncio.run(run())

0 commit comments

Comments
 (0)