Skip to content

Commit edea621

Browse files
committed
simplify tests
1 parent 7406424 commit edea621

1 file changed

Lines changed: 31 additions & 31 deletions

File tree

tests/custom/test_client.py

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
from scrapybara.tools import BashTool, ComputerTool, EditTool
2121

2222

23-
class YCStats(BaseModel):
24-
number_of_startups: int
25-
combined_valuation: int
23+
class ExampleSite(BaseModel):
24+
title: str
25+
has_links: bool
2626

2727

2828
def _check_api_key() -> None:
@@ -47,19 +47,19 @@ def test_ubuntu() -> None:
4747
response = client.act(
4848
model=Anthropic(),
4949
system=UBUNTU_SYSTEM_PROMPT_ANTHROPIC,
50-
prompt="Go to the YC website and get the number of funded startups and combined valuation",
50+
prompt="Go to example.com and get the page title and whether it has any links",
5151
tools=[
5252
ComputerTool(ubuntu_instance),
5353
BashTool(ubuntu_instance),
5454
EditTool(ubuntu_instance),
5555
],
56-
schema=YCStats,
56+
schema=ExampleSite,
5757
on_step=lambda step: print(step.text, step.tool_calls),
5858
)
5959
print(response.output)
6060
assert response.output is not None
61-
assert response.output.number_of_startups is not None
62-
assert response.output.combined_valuation is not None
61+
assert response.output.title is not None
62+
assert isinstance(response.output.has_links, bool)
6363
ubuntu_instance.browser.stop()
6464
ubuntu_instance.stop()
6565

@@ -80,19 +80,19 @@ def test_ubuntu_openai() -> None:
8080
response = client.act(
8181
model=OpenAI(),
8282
system=UBUNTU_SYSTEM_PROMPT_OPENAI,
83-
prompt="Go to the YC website and get the number of funded startups and combined valuation",
83+
prompt="Go to example.com and get the page title and whether it has any links",
8484
tools=[
8585
ComputerTool(ubuntu_instance),
8686
BashTool(ubuntu_instance),
8787
EditTool(ubuntu_instance),
8888
],
89-
schema=YCStats,
89+
schema=ExampleSite,
9090
on_step=lambda step: print(step.text, step.tool_calls),
9191
)
9292
print(response.output)
9393
assert response.output is not None
94-
assert response.output.number_of_startups is not None
95-
assert response.output.combined_valuation is not None
94+
assert response.output.title is not None
95+
assert isinstance(response.output.has_links, bool)
9696
ubuntu_instance.browser.stop()
9797
ubuntu_instance.stop()
9898

@@ -111,17 +111,17 @@ def test_browser() -> None:
111111
response = client.act(
112112
model=Anthropic(),
113113
system=BROWSER_SYSTEM_PROMPT_ANTHROPIC,
114-
prompt="Go to the YC website and get the number of funded startups and combined valuation",
114+
prompt="Go to example.com and get the page title and whether it has any links",
115115
tools=[
116116
ComputerTool(browser_instance),
117117
],
118-
schema=YCStats,
118+
schema=ExampleSite,
119119
on_step=lambda step: print(step.text, step.tool_calls),
120120
)
121121
print(response.output)
122122
assert response.output is not None
123-
assert response.output.number_of_startups is not None
124-
assert response.output.combined_valuation is not None
123+
assert response.output.title is not None
124+
assert isinstance(response.output.has_links, bool)
125125
browser_instance.stop()
126126

127127
def test_browser_openai() -> None:
@@ -138,17 +138,17 @@ def test_browser_openai() -> None:
138138
response = client.act(
139139
model=OpenAI(),
140140
system=BROWSER_SYSTEM_PROMPT_OPENAI,
141-
prompt="Go to the YC website and get the number of funded startups and combined valuation",
141+
prompt="Go to example.com and get the page title and whether it has any links",
142142
tools=[
143143
ComputerTool(browser_instance),
144144
],
145-
schema=YCStats,
145+
schema=ExampleSite,
146146
on_step=lambda step: print(step.text, step.tool_calls),
147147
)
148148
print(response.output)
149149
assert response.output is not None
150-
assert response.output.number_of_startups is not None
151-
assert response.output.combined_valuation is not None
150+
assert response.output.title is not None
151+
assert isinstance(response.output.has_links, bool)
152152
browser_instance.stop()
153153

154154

@@ -165,17 +165,17 @@ def test_windows() -> None:
165165
response = client.act(
166166
model=Anthropic(),
167167
system=WINDOWS_SYSTEM_PROMPT_ANTHROPIC,
168-
prompt="Go to the YC website and get the number of funded startups and combined valuation",
168+
prompt="Go to example.com and get the page title and whether it has any links",
169169
tools=[
170170
ComputerTool(windows_instance),
171171
],
172-
schema=YCStats,
172+
schema=ExampleSite,
173173
on_step=lambda step: print(step.text, step.tool_calls),
174174
)
175175
print(response.output)
176176
assert response.output is not None
177-
assert response.output.number_of_startups is not None
178-
assert response.output.combined_valuation is not None
177+
assert response.output.title is not None
178+
assert isinstance(response.output.has_links, bool)
179179
windows_instance.stop()
180180

181181

@@ -197,19 +197,19 @@ def test_ubuntu_thinking() -> None:
197197
response = client.act(
198198
model=Anthropic(name="claude-3-7-sonnet-20250219-thinking"),
199199
system=UBUNTU_SYSTEM_PROMPT_ANTHROPIC,
200-
prompt="Go to the YC website and get the number of funded startups and combined valuation",
200+
prompt="Go to example.com and get the page title and whether it has any links",
201201
tools=[
202202
ComputerTool(ubuntu_instance),
203203
BashTool(ubuntu_instance),
204204
EditTool(ubuntu_instance),
205205
],
206-
schema=YCStats,
206+
schema=ExampleSite,
207207
on_step=lambda step: print(step.text, step.tool_calls, step.reasoning_parts),
208208
)
209209
print(response.output)
210210
assert response.output is not None
211-
assert response.output.number_of_startups is not None
212-
assert response.output.combined_valuation is not None
211+
assert response.output.title is not None
212+
assert isinstance(response.output.has_links, bool)
213213
ubuntu_instance.browser.stop()
214214
ubuntu_instance.stop()
215215

@@ -229,17 +229,17 @@ def test_browser_thinking() -> None:
229229
response = client.act(
230230
model=Anthropic(name="claude-3-7-sonnet-20250219-thinking"),
231231
system=BROWSER_SYSTEM_PROMPT_ANTHROPIC,
232-
prompt="Go to the YC website and get the number of funded startups and combined valuation",
232+
prompt="Go to example.com and get the page title and whether it has any links",
233233
tools=[
234234
ComputerTool(browser_instance),
235235
],
236-
schema=YCStats,
236+
schema=ExampleSite,
237237
on_step=lambda step: print(step.text, step.tool_calls, step.reasoning_parts),
238238
)
239239
print(response.output)
240240
assert response.output is not None
241-
assert response.output.number_of_startups is not None
242-
assert response.output.combined_valuation is not None
241+
assert response.output.title is not None
242+
assert isinstance(response.output.has_links, bool)
243243
browser_instance.stop()
244244

245245

0 commit comments

Comments
 (0)