From 1f998f98e099d0fb8e02be432f998eded4108333 Mon Sep 17 00:00:00 2001 From: Albert Villanova del Moral <8515462+albertvillanova@users.noreply.github.com> Date: Tue, 18 Feb 2025 20:06:53 +0100 Subject: [PATCH] Test validate_tool_attributes (#696) --- .github/workflows/tests.yml | 5 +++++ tests/test_tool_validation.py | 9 +++++++++ 2 files changed, 14 insertions(+) create mode 100644 tests/test_tool_validation.py diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f93d4fc..c16a90a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -93,6 +93,11 @@ jobs: uv run pytest ./tests/test_tools.py if: ${{ success() || failure() }} + - name: Tool validation tests + run: | + uv run pytest ./tests/test_tool_validation.py + if: ${{ success() || failure() }} + - name: Types tests run: | uv run pytest ./tests/test_types.py diff --git a/tests/test_tool_validation.py b/tests/test_tool_validation.py new file mode 100644 index 0000000..16cbe21 --- /dev/null +++ b/tests/test_tool_validation.py @@ -0,0 +1,9 @@ +import pytest + +from smolagents.default_tools import DuckDuckGoSearchTool, GoogleSearchTool, VisitWebpageTool +from smolagents.tool_validation import validate_tool_attributes + + +@pytest.mark.parametrize("tool_class", [DuckDuckGoSearchTool, GoogleSearchTool, VisitWebpageTool]) +def test_validate_tool_attributes(tool_class): + assert validate_tool_attributes(tool_class) is None, f"failed for {tool_class.name} tool"