test: add basic test suites for all 18 hanzo-tools-* packages

This commit is contained in:
2025-12-27 14:57:15 -08:00
parent 058fffc218
commit ec7eabd9fc
16 changed files with 425 additions and 0 deletions
@@ -0,0 +1,34 @@
"""Tests for hanzo-tools-agent."""
import pytest
class TestImports:
"""Test that all modules can be imported."""
def test_import_package(self):
from hanzo_tools import agent
assert agent is not None
def test_import_tools(self):
from hanzo_tools.agent import TOOLS
assert len(TOOLS) > 0
def test_import_agent_tool(self):
from hanzo_tools.agent import AgentTool
assert AgentTool.name == "agent"
class TestAgentTool:
"""Tests for AgentTool."""
@pytest.fixture
def tool(self):
from hanzo_tools.agent import AgentTool
return AgentTool()
def test_has_description(self, tool):
assert tool.description
assert "agent" in tool.description.lower()
def test_has_agent_configs(self, tool):
assert hasattr(tool, 'agents') or hasattr(tool, 'agent_configs')
@@ -0,0 +1,31 @@
"""Tests for hanzo-tools-browser."""
import pytest
class TestImports:
"""Test that all modules can be imported."""
def test_import_package(self):
from hanzo_tools import browser
assert browser is not None
def test_import_tools(self):
from hanzo_tools.browser import TOOLS
assert len(TOOLS) > 0
def test_import_browser_tool(self):
from hanzo_tools.browser import BrowserTool
assert BrowserTool.name == "browser"
class TestBrowserTool:
"""Tests for BrowserTool."""
@pytest.fixture
def tool(self):
from hanzo_tools.browser import BrowserTool
return BrowserTool()
def test_has_description(self, tool):
assert tool.description
assert "browser" in tool.description.lower() or "playwright" in tool.description.lower()
@@ -0,0 +1,30 @@
"""Tests for hanzo-tools-computer."""
import pytest
class TestImports:
"""Test that all modules can be imported."""
def test_import_package(self):
from hanzo_tools import computer
assert computer is not None
def test_import_tools(self):
from hanzo_tools.computer import TOOLS
assert len(TOOLS) > 0
def test_import_computer_tool(self):
from hanzo_tools.computer import ComputerTool
assert ComputerTool.name == "computer"
class TestComputerTool:
"""Tests for ComputerTool."""
@pytest.fixture
def tool(self):
from hanzo_tools.computer import ComputerTool
return ComputerTool()
def test_has_description(self, tool):
assert tool.description
@@ -0,0 +1,27 @@
"""Tests for hanzo-tools-config."""
import pytest
class TestImports:
"""Test that all modules can be imported."""
def test_import_package(self):
from hanzo_tools import config
assert config is not None
def test_import_tools(self):
from hanzo_tools.config import TOOLS
assert len(TOOLS) > 0
class TestConfigTool:
"""Tests for config tools."""
@pytest.fixture
def tool(self):
from hanzo_tools.config import TOOLS
return TOOLS[0]() if TOOLS else None
def test_has_description(self, tool):
if tool:
assert tool.description
@@ -0,0 +1,14 @@
"""Tests for hanzo-tools-database."""
import pytest
class TestImports:
"""Test that all modules can be imported."""
def test_import_package(self):
from hanzo_tools import database
assert database is not None
def test_import_tools(self):
from hanzo_tools.database import TOOLS
assert len(TOOLS) > 0
@@ -0,0 +1,14 @@
"""Tests for hanzo-tools-editor."""
import pytest
class TestImports:
"""Test that all modules can be imported."""
def test_import_package(self):
from hanzo_tools import editor
assert editor is not None
def test_import_tools(self):
from hanzo_tools.editor import TOOLS
assert len(TOOLS) > 0
+52
View File
@@ -0,0 +1,52 @@
"""Tests for hanzo-tools-fs."""
import pytest
class TestImports:
"""Test that all modules can be imported."""
def test_import_package(self):
from hanzo_tools import fs
assert fs is not None
def test_import_tools(self):
from hanzo_tools.fs import TOOLS
assert len(TOOLS) > 0
def test_import_read_tool(self):
from hanzo_tools.fs import ReadTool
assert ReadTool.name == "read"
def test_import_write_tool(self):
from hanzo_tools.fs import WriteTool
assert WriteTool.name == "write"
def test_import_edit_tool(self):
from hanzo_tools.fs import EditTool
assert EditTool.name == "edit"
class TestReadTool:
"""Tests for ReadTool."""
@pytest.fixture
def tool(self):
from hanzo_tools.fs import ReadTool
return ReadTool()
def test_has_description(self, tool):
assert tool.description
assert "read" in tool.description.lower()
class TestWriteTool:
"""Tests for WriteTool."""
@pytest.fixture
def tool(self):
from hanzo_tools.fs import WriteTool
return WriteTool()
def test_has_description(self, tool):
assert tool.description
assert "write" in tool.description.lower()
@@ -0,0 +1,14 @@
"""Tests for hanzo-tools-jupyter."""
import pytest
class TestImports:
"""Test that all modules can be imported."""
def test_import_package(self):
from hanzo_tools import jupyter
assert jupyter is not None
def test_import_tools(self):
from hanzo_tools.jupyter import TOOLS
assert len(TOOLS) > 0
@@ -0,0 +1,14 @@
"""Tests for hanzo-tools-llm."""
import pytest
class TestImports:
"""Test that all modules can be imported."""
def test_import_package(self):
from hanzo_tools import llm
assert llm is not None
def test_import_tools(self):
from hanzo_tools.llm import TOOLS
assert len(TOOLS) > 0
@@ -0,0 +1,30 @@
"""Tests for hanzo-tools-lsp."""
import pytest
class TestImports:
"""Test that all modules can be imported."""
def test_import_package(self):
from hanzo_tools import lsp
assert lsp is not None
def test_import_tools(self):
from hanzo_tools.lsp import TOOLS
assert len(TOOLS) > 0
def test_import_lsp_tool(self):
from hanzo_tools.lsp import LspTool
assert LspTool.name == "lsp"
class TestLspTool:
"""Tests for LspTool."""
@pytest.fixture
def tool(self):
from hanzo_tools.lsp import LspTool
return LspTool()
def test_has_description(self, tool):
assert tool.description
@@ -0,0 +1,14 @@
"""Tests for hanzo-tools-mcp."""
import pytest
class TestImports:
"""Test that all modules can be imported."""
def test_import_package(self):
from hanzo_tools import mcp_tools
assert mcp_tools is not None
def test_import_tools(self):
from hanzo_tools.mcp_tools import TOOLS
assert len(TOOLS) > 0
@@ -0,0 +1,27 @@
"""Tests for hanzo-tools-memory."""
import pytest
class TestImports:
"""Test that all modules can be imported."""
def test_import_package(self):
from hanzo_tools import memory
assert memory is not None
def test_import_tools(self):
from hanzo_tools.memory import TOOLS
assert len(TOOLS) > 0
class TestMemoryTool:
"""Tests for MemoryTool."""
@pytest.fixture
def tool(self):
from hanzo_tools.memory import TOOLS
return TOOLS[0]() if TOOLS else None
def test_has_description(self, tool):
if tool:
assert tool.description
@@ -0,0 +1,48 @@
"""Tests for hanzo-tools-reasoning."""
import pytest
class TestImports:
"""Test that all modules can be imported."""
def test_import_package(self):
from hanzo_tools import reasoning
assert reasoning is not None
def test_import_tools(self):
from hanzo_tools.reasoning import TOOLS
assert len(TOOLS) >= 2 # think, critic
def test_import_think_tool(self):
from hanzo_tools.reasoning import ThinkTool
assert ThinkTool.name == "think"
def test_import_critic_tool(self):
from hanzo_tools.reasoning import CriticTool
assert CriticTool.name == "critic"
class TestThinkTool:
"""Tests for ThinkTool."""
@pytest.fixture
def tool(self):
from hanzo_tools.reasoning import ThinkTool
return ThinkTool()
def test_has_description(self, tool):
assert tool.description
assert "think" in tool.description.lower()
class TestCriticTool:
"""Tests for CriticTool."""
@pytest.fixture
def tool(self):
from hanzo_tools.reasoning import CriticTool
return CriticTool()
def test_has_description(self, tool):
assert tool.description
assert "critic" in tool.description.lower()
@@ -0,0 +1,31 @@
"""Tests for hanzo-tools-refactor."""
import pytest
class TestImports:
"""Test that all modules can be imported."""
def test_import_package(self):
from hanzo_tools import refactor
assert refactor is not None
def test_import_tools(self):
from hanzo_tools.refactor import TOOLS
assert len(TOOLS) > 0
def test_import_refactor_tool(self):
from hanzo_tools.refactor import RefactorTool
assert RefactorTool.name == "refactor"
class TestRefactorTool:
"""Tests for RefactorTool."""
@pytest.fixture
def tool(self):
from hanzo_tools.refactor import RefactorTool
return RefactorTool()
def test_has_description(self, tool):
assert tool.description
assert "refactor" in tool.description.lower()
@@ -0,0 +1,31 @@
"""Tests for hanzo-tools-todo."""
import pytest
class TestImports:
"""Test that all modules can be imported."""
def test_import_package(self):
from hanzo_tools import todo
assert todo is not None
def test_import_tools(self):
from hanzo_tools.todo import TOOLS
assert len(TOOLS) > 0
def test_import_todo_tool(self):
from hanzo_tools.todo import TodoTool
assert TodoTool.name == "todo"
class TestTodoTool:
"""Tests for TodoTool."""
@pytest.fixture
def tool(self):
from hanzo_tools.todo import TodoTool
return TodoTool()
def test_has_description(self, tool):
assert tool.description
assert "todo" in tool.description.lower()
@@ -0,0 +1,14 @@
"""Tests for hanzo-tools-vector."""
import pytest
class TestImports:
"""Test that all modules can be imported."""
def test_import_package(self):
from hanzo_tools import vector
assert vector is not None
def test_import_tools(self):
from hanzo_tools.vector import TOOLS
assert len(TOOLS) > 0