refactor: remove redundant comments and docstrings (#6527)
* refactor: remove redundant comments and docstrings * fix(signal): annotate async context manager as a generator
This commit is contained in:
1 parent
cb3ba45317
commit
a4d2430140
922 files changed
+406
-7738
No files matched your search
@@ -1,4 +1,3 @@
|
||||
"""Tests for tool plugin architecture: ToolLoader, ToolContext, metadata."""
|
||||
from __future__ import annotations
|
||||
|
||||
import shutil
|
||||
@@ -51,9 +50,6 @@ def test_tool_plugin_discoverable_default_is_true():
|
||||
assert _MinimalTool._plugin_discoverable is True
|
||||
|
||||
|
||||
# --- ToolContext tests ---
|
||||
|
||||
|
||||
def test_tool_context_has_required_fields():
|
||||
field_names = {f.name for f in fields(ToolContext)}
|
||||
required = {
|
||||
@@ -77,9 +73,6 @@ def test_tool_context_defaults():
|
||||
assert ctx.timezone == "UTC"
|
||||
|
||||
|
||||
# --- ToolLoader tests ---
|
||||
|
||||
|
||||
def test_skip_modules_excludes_infrastructure():
|
||||
infra = {"base", "schema", "registry", "context", "loader", "config",
|
||||
"file_state", "sandbox", "mcp", "__init__"}
|
||||
@@ -118,7 +111,6 @@ def test_discover_skips_private_classes():
|
||||
|
||||
|
||||
def test_loader_registers_exec_with_real_tools_config(tmp_path):
|
||||
"""Real config objects catch bad ctx.config attribute paths that mocks hide."""
|
||||
from types import SimpleNamespace
|
||||
|
||||
from nanobot.agent.tools.registry import ToolRegistry
|
||||
@@ -192,9 +184,6 @@ def test_loader_preserves_caller_supplied_tool(tmp_path):
|
||||
assert "read_file" not in registered
|
||||
|
||||
|
||||
# --- Task 4: _FsTool.create() ---
|
||||
|
||||
|
||||
def test_fs_tool_create_builds_from_context():
|
||||
from nanobot.agent.tools.filesystem import ReadFileTool
|
||||
mock_config = MagicMock()
|
||||
@@ -226,9 +215,6 @@ def test_fs_tool_create_respects_sandbox():
|
||||
assert tool._allowed_dir == Path("/tmp/test")
|
||||
|
||||
|
||||
# --- Message, subagent, and cron tool factories ---
|
||||
|
||||
|
||||
async def test_message_tool_create():
|
||||
from nanobot.agent.tools.message import MessageTool
|
||||
mock_bus = MagicMock()
|
||||
@@ -274,9 +260,6 @@ def test_cron_tool_create():
|
||||
assert isinstance(tool, CronTool)
|
||||
|
||||
|
||||
# --- Task 6: ExecTool, WebTools, ImageGenerationTool ---
|
||||
|
||||
|
||||
def test_exec_tool_config_cls():
|
||||
from nanobot.agent.tools.shell import ExecTool, ExecToolConfig
|
||||
assert ExecTool.config_cls() is ExecToolConfig
|
||||
@@ -387,9 +370,6 @@ def test_image_gen_tool_create():
|
||||
assert tool.provider_configs["openrouter"].api_key == "image-key"
|
||||
|
||||
|
||||
# --- Task 7: MyToolConfig + MCP wrappers ---
|
||||
|
||||
|
||||
def test_my_tool_config_cls():
|
||||
from nanobot.agent.tools.self import MyTool, MyToolConfig
|
||||
assert MyTool.config_key == "my"
|
||||
@@ -427,11 +407,7 @@ def test_mcp_wrappers_not_discoverable():
|
||||
assert MCPPromptWrapper._plugin_discoverable is False
|
||||
|
||||
|
||||
# --- Task 10: Integration test ---
|
||||
|
||||
|
||||
def test_loader_registers_builtin_tools():
|
||||
"""Verify the loader produces the same tool set as the old _register_default_tools."""
|
||||
from nanobot.agent.tools.loader import ToolLoader
|
||||
from nanobot.agent.tools.registry import ToolRegistry
|
||||
from nanobot.agent.tools.shell import ExecToolConfig
|
||||
|
||||
Reference in new issue
Block a user