|
3 | 3 | import pytest |
4 | 4 | from pydantic import BaseModel, ValidationError |
5 | 5 |
|
6 | | -from sentience.tools import ToolContext, ToolRegistry, ToolSpec, register_default_tools |
| 6 | +from sentience.tools import ( |
| 7 | + ToolContext, |
| 8 | + ToolRegistry, |
| 9 | + ToolSpec, |
| 10 | + UnsupportedCapabilityError, |
| 11 | + register_default_tools, |
| 12 | +) |
7 | 13 |
|
8 | 14 |
|
9 | 15 | class EchoInput(BaseModel): |
@@ -143,7 +149,7 @@ def can(self, _name: str) -> bool: |
143 | 149 | return False |
144 | 150 |
|
145 | 151 | ctx = ToolContext(RuntimeStub()) |
146 | | - with pytest.raises(ValueError, match="unsupported_capability"): |
| 152 | + with pytest.raises(UnsupportedCapabilityError, match="unsupported_capability"): |
147 | 153 | ctx.require("tabs") |
148 | 154 |
|
149 | 155 |
|
@@ -213,10 +219,10 @@ async def snapshot(self, **_kwargs): |
213 | 219 | ctx = ToolContext(RuntimeStub()) |
214 | 220 | register_default_tools(registry, ctx) |
215 | 221 |
|
216 | | - with pytest.raises(ValueError, match="unsupported_capability"): |
| 222 | + with pytest.raises(UnsupportedCapabilityError, match="unsupported_capability"): |
217 | 223 | await registry.execute("press", {"key": "Enter"}, ctx=ctx) |
218 | 224 |
|
219 | | - with pytest.raises(ValueError, match="unsupported_capability"): |
| 225 | + with pytest.raises(UnsupportedCapabilityError, match="unsupported_capability"): |
220 | 226 | await registry.execute( |
221 | 227 | "scroll_to_element", |
222 | 228 | {"element_id": 1, "behavior": "instant", "block": "center"}, |
|
0 commit comments