test: consolidate repetitive cases across the suite

This commit is contained in:
chengyongru authored and chengyongru committed 2026-09-25 14:28:21 +08:00
1 parent c406024b59
commit 6eccc2859a
31 files changed
+745 -1315

No files matched your search

+9 -27
View File
@@ -34,11 +34,17 @@ async def test_interactive_retry_wait_is_rendered_as_progress_even_when_progress
@pytest.mark.asyncio
async def test_reasoning_displayed_when_show_reasoning_enabled():
"""Reasoning content should be displayed when show_reasoning is True."""
@pytest.mark.parametrize(
"send_progress",
[
pytest.param(True, id="displayed_when_show_reasoning_enabled"),
pytest.param(False, id="shown_when_send_progress_disabled"),
],
)
async def test_reasoning_display_is_independent_of_send_progress(send_progress):
calls: list[str] = []
channels_config = SimpleNamespace(
send_progress=True, send_tool_hints=False, show_reasoning=True,
send_progress=send_progress, send_tool_hints=False, show_reasoning=True,
)
msg = SimpleNamespace(
content="Let me think about this...",
@@ -183,27 +189,3 @@ async def test_non_reasoning_progress_not_affected_by_show_reasoning():
assert handled is True
assert calls == ["working on it..."]
@pytest.mark.asyncio
async def test_reasoning_shown_when_send_progress_disabled():
"""Reasoning display is governed by `show_reasoning` alone, independent
of `send_progress` — the two knobs are orthogonal."""
calls: list[str] = []
channels_config = SimpleNamespace(
send_progress=False, send_tool_hints=False, show_reasoning=True,
)
msg = SimpleNamespace(
content="Let me think about this...",
event=ProgressEvent(content="Let me think about this...", reasoning=True),
metadata={},
)
with patch(
"nanobot.cli.terminal._print_cli_reasoning",
side_effect=lambda t, th, r=None: calls.append(t),
):
handled = await terminal._maybe_print_interactive_progress(msg, None, channels_config)
assert handled is True
assert calls == ["Let me think about this..."]