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
@@ -154,12 +154,8 @@ async def test_cron_tool_keeps_task_local_context(tmp_path) -> None:
|
||||
}
|
||||
|
||||
|
||||
# --- Basic single-task regression tests ---
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_message_tool_basic_request_context_and_execute() -> None:
|
||||
"""A bound request context should route a single execution correctly."""
|
||||
seen: list[tuple[str, str, str]] = []
|
||||
|
||||
async def send_callback(msg):
|
||||
@@ -176,7 +172,6 @@ async def test_message_tool_basic_request_context_and_execute() -> None:
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_message_tool_default_values_without_request_context() -> None:
|
||||
"""Without a request context, constructor defaults should be used."""
|
||||
seen: list[tuple[str, str, str]] = []
|
||||
|
||||
async def send_callback(msg):
|
||||
@@ -195,7 +190,6 @@ async def test_message_tool_default_values_without_request_context() -> None:
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_subagent_tool_basic_request_context_and_execute() -> None:
|
||||
"""A bound request context should provide the correct origin."""
|
||||
seen: list[tuple[str, str, str, str | None, str | None]] = []
|
||||
|
||||
class _Manager:
|
||||
@@ -237,7 +231,6 @@ async def test_subagent_tool_basic_request_context_and_execute() -> None:
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_subagent_tool_rejects_missing_request_runtime() -> None:
|
||||
"""Spawning cannot reconstruct a model runtime outside turn admission."""
|
||||
seen: list[tuple[str, str, str]] = []
|
||||
|
||||
class _Manager:
|
||||
@@ -273,7 +266,6 @@ async def test_subagent_tool_rejects_missing_request_runtime() -> None:
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_cron_tool_basic_request_context_and_execute(tmp_path) -> None:
|
||||
"""A bound request context should provide the correct cron owner."""
|
||||
tool = CronTool(CronService(tmp_path / "jobs.json"))
|
||||
with request_context(
|
||||
RequestContext(channel="wechat", chat_id="user-789", session_key="wechat:user-789")
|
||||
@@ -290,7 +282,6 @@ async def test_cron_tool_basic_request_context_and_execute(tmp_path) -> None:
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_webui_cron_tool_uses_origin_session_when_unified_enabled(tmp_path) -> None:
|
||||
"""WebUI-created cron jobs stay attached to the creating chat."""
|
||||
tool = CronTool(CronService(tmp_path / "jobs.json"))
|
||||
|
||||
with request_context(
|
||||
@@ -314,7 +305,6 @@ async def test_webui_cron_tool_uses_origin_session_when_unified_enabled(tmp_path
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_cron_tool_snapshots_only_persistable_request_metadata(tmp_path) -> None:
|
||||
"""Live runtime context must not poison a persisted WebUI cron job."""
|
||||
store_path = tmp_path / "jobs.json"
|
||||
service = CronService(store_path)
|
||||
tool = CronTool(service)
|
||||
@@ -349,7 +339,6 @@ async def test_cron_tool_snapshots_only_persistable_request_metadata(tmp_path) -
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_cron_tool_preserves_thread_scoped_session_key(tmp_path) -> None:
|
||||
"""Channel-provided thread session keys should remain the cron owner."""
|
||||
tool = CronTool(CronService(tmp_path / "jobs.json"))
|
||||
with request_context(
|
||||
RequestContext(
|
||||
@@ -372,7 +361,6 @@ async def test_cron_tool_preserves_thread_scoped_session_key(tmp_path) -> None:
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_cron_tool_no_context_returns_error(tmp_path) -> None:
|
||||
"""Without a request context, add should fail with a clear error."""
|
||||
tool = CronTool(CronService(tmp_path / "jobs.json"))
|
||||
|
||||
result = await tool.execute(action="add", message="test", every_seconds=60)
|
||||
|
||||
Reference in new issue
Block a user