arcade-mcp/arcade/tests/core/test_parse.py
Sam Partee 35baaf0dc8
Pass ToolContext and CLI cleanup (#13)
Added
-  `arcade dev` - serves a simple fastapi actor
- `arcade config` - show/edit/change config in `~/.arcade`
- `arcade chat` - chat with LLM without toolcalls

Changed:
- `arcade show`, `arcade run` - can now use all installed toolkits

---------

Co-authored-by: Nate Barbettini <nate@arcade-ai.com>
2024-08-13 15:40:08 -07:00

52 lines
1 KiB
Python

import ast
import pytest
from arcade.core.parse import get_tools_from_ast
@pytest.mark.parametrize(
"source, expected_tools",
[
pytest.param(
"""
@tool
def my_function():
pass
""",
["my_function"],
id="function with tool decorator",
),
pytest.param(
"""
import arcade.sdk as arc
@arc.tool
def another_function():
pass
""",
["another_function"],
id="function with arc.tool decorator",
),
pytest.param(
"""
def no_decorator_function():
pass
""",
[],
id="function without decorator",
),
pytest.param(
"""
@other_decorator
def different_function():
pass
""",
[],
id="function with other decorator",
),
],
)
def test_get_function_name_if_decorated(source, expected_tools):
tree = ast.parse(source)
tools = get_tools_from_ast(tree)
assert tools == expected_tools