test: clean up type: ignore comments and add package markers

- Remove unnecessary type: ignore comments in test files
- Add __init__.py markers for tests and tests/unit packages
This commit is contained in:
LIghtJUNction
2026-03-31 20:14:47 +08:00
parent 7ff6df9853
commit 97077ed32e
7 changed files with 10 additions and 8 deletions

1
tests/__init__.py Normal file
View File

@@ -0,0 +1 @@
# Package marker for stable pytest module names.

View File

@@ -75,7 +75,7 @@ class TestContextManager:
"""Test initialization with LLM-based compression."""
mock_provider = MockProvider()
config = ContextConfig(
llm_compress_provider=mock_provider, # type: ignore
llm_compress_provider=mock_provider,
llm_compress_keep_recent=5,
llm_compress_instruction="Summarize the conversation",
)
@@ -665,7 +665,7 @@ class TestContextManager:
"""Test LLM compression using MockProvider."""
mock_provider = MockProvider()
config = ContextConfig(
llm_compress_provider=mock_provider, # type: ignore
llm_compress_provider=mock_provider,
llm_compress_keep_recent=3,
llm_compress_instruction="请总结对话内容",
max_context_tokens=100,

View File

@@ -25,7 +25,7 @@ async def test_collect_and_register_commands_ignores_daily_create_limit() -> Non
adapter.client = MockDiscordBuilder.create_client()
exc = HTTPException("daily limit")
exc.code = 30034 # type: ignore[attr-defined]
exc.code = 30034 [attr-defined]
adapter.client.sync_commands.side_effect = exc
await adapter._collect_and_register_commands()

View File

@@ -225,7 +225,7 @@ class TestSSEMessageParserProcess:
parser.process_message(
ParsedMessage(type=MessageType.REASONING, data="Thinking...")
)
parser._tool_calls["tc1"] = object() # type: ignore
parser._tool_calls["tc1"] = object()
parser.reset()

1
tests/unit/__init__.py Normal file
View File

@@ -0,0 +1 @@
# Package marker for stable pytest module names.

View File

@@ -83,14 +83,14 @@ class TestToolSetAddTool:
parameters = {"type": "object"}
mock_tool = MockTool()
toolset.add_tool(mock_tool) # type: ignore
toolset.add_tool(mock_tool)
# Should be added successfully
assert len(toolset.tools) == 1
# Adding another tool without active should overwrite
mock_tool2 = MockTool()
toolset.add_tool(mock_tool2) # type: ignore
toolset.add_tool(mock_tool2)
assert len(toolset.tools) == 1

View File

@@ -59,8 +59,8 @@ class TestSplitUmo:
def test_non_string_returns_none(self):
"""UMO that is not a string returns None."""
assert UmopConfigRouter._split_umo(None) is None # type: ignore 故意这样测试的
assert UmopConfigRouter._split_umo(123) is None # type: ignore 故意这样测试的
assert UmopConfigRouter._split_umo(None) is None # 故意这样测试的
assert UmopConfigRouter._split_umo(123) is None # 故意这样测试的
def test_four_parts_returns_three(self):
"""UMO with four parts splits to three (last keeps colon)."""