Skip to content

Commit f9001e7

Browse files
Add mapping input compatibility test for tool wrappers
Co-authored-by: Shri Sukhani <shrisukhani@users.noreply.github.com>
1 parent 345ecc8 commit f9001e7

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

tests/test_tools_mapping_inputs.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
from types import MappingProxyType
2+
3+
from hyperbrowser.models.scrape import StartScrapeJobParams
4+
from hyperbrowser.tools import WebsiteScrapeTool
5+
6+
7+
class _Response:
8+
def __init__(self, data):
9+
self.data = data
10+
11+
12+
class _ScrapeManager:
13+
def __init__(self):
14+
self.last_params = None
15+
16+
def start_and_wait(self, params: StartScrapeJobParams):
17+
self.last_params = params
18+
return _Response(type("Data", (), {"markdown": "ok"})())
19+
20+
21+
class _Client:
22+
def __init__(self):
23+
self.scrape = _ScrapeManager()
24+
25+
26+
def test_tool_wrappers_accept_mapping_inputs():
27+
client = _Client()
28+
params = MappingProxyType({"url": "https://example.com"})
29+
30+
output = WebsiteScrapeTool.runnable(client, params)
31+
32+
assert output == "ok"
33+
assert isinstance(client.scrape.last_params, StartScrapeJobParams)

0 commit comments

Comments
 (0)