-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathtest_goat.py
More file actions
29 lines (19 loc) · 1 KB
/
test_goat.py
File metadata and controls
29 lines (19 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import pytest
from thirdweb_ai.tools.tool import Tool
def test_get_goat_tools(test_tools: list[Tool]):
"""Test converting thirdweb tools to GOAT tools."""
# Skip this test if module not fully installed
pytest.importorskip("goat.tools")
from goat.tools import BaseTool as GoatBaseTool # type: ignore[import]
from thirdweb_ai.adapters.goat import get_goat_tools
# Convert tools to GOAT tools
goat_tools = get_goat_tools(test_tools)
# Assert we got the correct number of tools
assert len(goat_tools) == len(test_tools)
# Check all tools were properly converted
assert all(isinstance(tool, GoatBaseTool) for tool in goat_tools)
# Check properties were preserved
assert [tool.name for tool in goat_tools] == [tool.name for tool in test_tools]
assert [tool.description for tool in goat_tools] == [tool.description for tool in test_tools]
# Check all tools have a callable run method
assert all(callable(getattr(tool, "run", None)) for tool in goat_tools)