test: align test names with current assertions (#6130)
* test: align test names with current assertions * test: align suite names and explicit configuration cases
This commit is contained in:
1 parent
50256940be
commit
f04ed1c2eb
13 files changed
+24
-25
No files matched your search
@@ -250,8 +250,8 @@ class TestAgentLoopTTLParam:
|
||||
loop = _make_loop(tmp_path, session_ttl_minutes=25)
|
||||
assert loop.auto_compact._ttl == 25
|
||||
|
||||
def test_loop_default_ttl_zero(self, tmp_path):
|
||||
"""AutoCompact default TTL should be 0 (disabled)."""
|
||||
def test_explicit_zero_ttl_disables_loop_compaction(self, tmp_path):
|
||||
"""An explicit zero TTL disables idle compaction in the loop."""
|
||||
loop = _make_loop(tmp_path, session_ttl_minutes=0)
|
||||
assert loop.auto_compact._ttl == 0
|
||||
|
||||
@@ -1166,7 +1166,7 @@ class TestSummaryPersistence:
|
||||
await loop.aclose()
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_metadata_cleanup_on_inmemory_path(self, tmp_path):
|
||||
async def test_inmemory_summary_preserves_metadata_for_restart(self, tmp_path):
|
||||
"""The in-memory summary path preserves _last_summary for restart recovery."""
|
||||
loop = _make_loop(tmp_path, session_ttl_minutes=15)
|
||||
session = loop.sessions.get_or_create("cli:test")
|
||||
|
||||
@@ -1583,7 +1583,7 @@ class TestCompactIdleSession:
|
||||
assert not lock.locked()
|
||||
|
||||
|
||||
class TestRawArchiveTruncation:
|
||||
class TestRawArchiveChunks:
|
||||
"""raw_archive() keeps complete journal content with bounded individual entries."""
|
||||
|
||||
@pytest.mark.parametrize("boundary", ["A ", "\n\n", "<think>PRIVATE</think>"])
|
||||
@@ -1604,7 +1604,7 @@ class TestRawArchiveTruncation:
|
||||
assert "PRIVATE" not in joined
|
||||
assert "PUBLIC_TAIL" in joined
|
||||
|
||||
def test_raw_archive_truncates_large_content(self, store):
|
||||
def test_raw_archive_splits_large_content_into_bounded_entries(self, store):
|
||||
"""Large messages are split across bounded journal entries."""
|
||||
big = "x" * 50_000
|
||||
messages = [{"role": "user", "content": big}]
|
||||
|
||||
@@ -29,11 +29,11 @@ class FakeImageClient:
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_outbound_no_longer_carries_generated_media(
|
||||
async def test_generate_image_does_not_attach_media_to_final_response(
|
||||
tmp_path: Path,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
"""Media delivery is now the LLM's responsibility via the message tool."""
|
||||
"""Generating an image does not attach it to the final outbound response."""
|
||||
set_config_path(tmp_path / "config.json")
|
||||
monkeypatch.setattr(
|
||||
"nanobot.agent.tools.image_generation.get_image_gen_provider",
|
||||
@@ -80,6 +80,5 @@ async def test_outbound_no_longer_carries_generated_media(
|
||||
|
||||
assert result is not None
|
||||
assert result.content == "Done"
|
||||
# OutboundMessage no longer carries generated media —
|
||||
# the LLM sends images via the message tool instead.
|
||||
# Image delivery requires a separate message tool call.
|
||||
assert result.media == []
|
||||
@@ -276,7 +276,7 @@ class TestToolEventProgress:
|
||||
assert file_events == []
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bus_progress_forwards_tool_events_to_outbound_metadata(self, tmp_path: Path) -> None:
|
||||
async def test_bus_progress_delivers_tool_activity_in_progress_events(self, tmp_path: Path) -> None:
|
||||
"""Bus-dispatched turns deliver tool activity through ProgressEvent.tool_events."""
|
||||
bus = MessageBus()
|
||||
provider = MagicMock()
|
||||
|
||||
@@ -506,7 +506,7 @@ async def test_loop_retries_think_only_final_response(tmp_path):
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_streamed_flag_not_set_on_llm_error(tmp_path):
|
||||
async def test_llm_error_returns_regular_response_instead_of_streamed_event(tmp_path):
|
||||
"""LLM errors must not produce StreamedResponseEvent, so channels deliver the error."""
|
||||
from nanobot.agent.loop import AgentLoop
|
||||
from nanobot.bus.events import InboundMessage
|
||||
|
||||
@@ -850,8 +850,8 @@ class TestApiServerRegistration:
|
||||
assert config.api.api_key == "secret"
|
||||
|
||||
|
||||
class TestMainMenuUpdate:
|
||||
"""Tests for main menu including new Channel Common and API Server items."""
|
||||
class TestMainMenuInteraction:
|
||||
"""Main menu navigation, save actions, and terminal input behavior."""
|
||||
|
||||
def test_choice_viewport_keeps_long_menus_within_terminal_height(self):
|
||||
"""Long provider menus should render as a bounded scrolling slice."""
|
||||
|
||||
@@ -1617,7 +1617,7 @@ class TestFailoverOnAuthenticationError:
|
||||
factory.assert_called_once_with(fallback_preset)
|
||||
|
||||
|
||||
class TestNoFallbackOnNonRetryableError:
|
||||
class TestFallbackErrorClassification:
|
||||
@pytest.mark.asyncio
|
||||
async def test_bad_request(self) -> None:
|
||||
primary = _FakeProvider(
|
||||
@@ -1666,7 +1666,7 @@ class TestNoFallbackOnNonRetryableError:
|
||||
factory.assert_not_called()
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_timeout(self) -> None:
|
||||
async def test_timeout_triggers_fallback(self) -> None:
|
||||
primary = _FakeProvider(
|
||||
"primary",
|
||||
_make_response("timed out", finish_reason="error", error_kind="timeout"),
|
||||
|
||||
@@ -262,7 +262,7 @@ class TestToolHintMixedFolding:
|
||||
class TestToolHintMaxLength:
|
||||
"""Test max_length parameter controls truncation of tool hints."""
|
||||
|
||||
def test_exec_default_truncates_at_40(self):
|
||||
def test_exec_explicit_max_length_limits_hint(self):
|
||||
cmd = "cd /very/long/path/to/some/project && npm run build && npm test"
|
||||
result = _hint([_tc("exec", {"command": cmd})], max_length=40)
|
||||
assert len(result) <= 50 # "$ " prefix + 40 + ellipsis
|
||||
|
||||
@@ -300,11 +300,11 @@ class TestModifyBlocked:
|
||||
# set — free tier (setattr priority)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
class TestModifyFree:
|
||||
class TestRuntimeSettingsAndScratchpad:
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_modify_existing_attr_setattr(self):
|
||||
"""Modifying an existing loop attribute should use setattr."""
|
||||
async def test_set_updates_runtime_setting(self):
|
||||
"""Set a runtime setting through the runtime-control capability."""
|
||||
tool = _make_tool()
|
||||
result = await tool.execute(action="set", key="provider_retry_mode", value="persistent")
|
||||
assert "Set provider_retry_mode" in result
|
||||
@@ -395,7 +395,7 @@ class TestModifyFree:
|
||||
# set — previously BLOCKED/READONLY now open
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
class TestModifyOpen:
|
||||
class TestProtectedRuntimeState:
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_modify_tools_blocked(self):
|
||||
|
||||
@@ -10,7 +10,7 @@ from nanobot.providers.registry import create_dynamic_spec
|
||||
class TestCustomProviderThinkingStyle:
|
||||
"""Verify that thinking_style flows from config to ProviderSpec."""
|
||||
|
||||
def test_default_thinking_style_is_empty(self) -> None:
|
||||
def test_default_thinking_style_is_none(self) -> None:
|
||||
cfg = ProviderConfig()
|
||||
assert cfg.thinking_style is None
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
Validates that:
|
||||
- OpenRouter (no strip) keeps model names intact.
|
||||
- AiHubMix (strip_model_prefix=True) strips provider prefixes.
|
||||
- AiHubMix strips provider prefixes declared by its spec.
|
||||
- Standard providers pass model names through as-is.
|
||||
"""
|
||||
|
||||
@@ -614,7 +614,7 @@ async def test_openrouter_keeps_model_name_intact() -> None:
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_aihubmix_strips_model_prefix() -> None:
|
||||
"""AiHubMix strips the provider prefix (strip_model_prefix=True)."""
|
||||
"""AiHubMix strips provider prefixes declared by its spec."""
|
||||
mock_create = AsyncMock(return_value=_fake_chat_response())
|
||||
spec = find_by_name("aihubmix")
|
||||
|
||||
@@ -554,7 +554,7 @@ class TestOfficeDocTruncation:
|
||||
assert "truncated" not in result
|
||||
|
||||
|
||||
class TestReadDescriptionUpdate:
|
||||
class TestReadFileDescription:
|
||||
|
||||
def test_description_mentions_documents(self):
|
||||
tool = ReadFileTool()
|
||||
|
||||
@@ -707,7 +707,7 @@ async def test_unknown_provider():
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_default_provider_is_brave(monkeypatch):
|
||||
async def test_empty_provider_with_api_key_uses_brave(monkeypatch):
|
||||
async def mock_get(self, url, **kw):
|
||||
assert "brave" in url
|
||||
return _response(json={"web": {"results": []}})
|
||||
|
||||
Reference in new issue
Block a user