Skip to content

Commit 4a6d7cd

Browse files
committed
Resolve PR review follow-ups
1 parent 4fc5eed commit 4a6d7cd

3 files changed

Lines changed: 14 additions & 24 deletions

File tree

tests/core/test_benchmark_slash.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ def _make_soul(runtime: Runtime, tmp_path: Path) -> PythinkerSoul:
5050
async def _run(soul: PythinkerSoul, args: str) -> None:
5151
result = benchmark(soul, args)
5252
if result is not None:
53-
await result
53+
_ = await result
5454

5555

5656
async def _run_registered(soul: PythinkerSoul, name: str, args: str = "") -> None:
5757
command = soul_slash_registry.find_command(name)
5858
assert command is not None
5959
result = command.func(soul, args)
6060
if result is not None:
61-
await result
61+
_ = await result
6262

6363

6464
@pytest.fixture
@@ -129,15 +129,13 @@ def test_parse_export_rejects_invalid_format() -> None:
129129

130130

131131
def test_run_id_is_unique_when_clock_repeats(monkeypatch: pytest.MonkeyPatch) -> None:
132-
import pythinker_code.benchmark.commands as commands
133-
134132
class FixedDatetime:
135133
@classmethod
136134
def now(cls, tz: object) -> datetime:
137135
assert tz is UTC
138136
return datetime(2026, 7, 5, 12, 0, 0, 1, tzinfo=UTC)
139137

140-
monkeypatch.setattr(commands, "datetime", FixedDatetime)
138+
monkeypatch.setattr("pythinker_code.benchmark.commands.datetime", FixedDatetime)
141139

142140
assert _run_id("same-task") != _run_id("same-task")
143141

tests/ui_and_conv/test_focus_tui_integration.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from pythinker_code.soul.agent import Agent, Runtime
1212
from pythinker_code.soul.context import Context
1313
from pythinker_code.soul.pythinkersoul import PythinkerSoul
14-
from pythinker_code.ui.shell import Shell
1514
from pythinker_code.ui.shell.focus_model import FocusTuiModel
1615
from pythinker_code.ui.shell.focus_surface import FocusTuiSurface
1716
from pythinker_code.ui.shell.visualize import _PromptLiveView, visualize
@@ -50,15 +49,15 @@ def detach_modal(self, delegate: object) -> None:
5049
self.modals.remove(delegate)
5150

5251

53-
def _make_shell(runtime: Runtime, tmp_path: Path) -> Shell:
52+
def _make_shell(runtime: Runtime, tmp_path: Path) -> shell_module.Shell:
5453
agent = Agent(
5554
name="Test Agent",
5655
system_prompt="Test system prompt.",
5756
toolset=EmptyToolset(),
5857
runtime=runtime,
5958
)
6059
soul = PythinkerSoul(agent, context=Context(file_backend=tmp_path / "history.jsonl"))
61-
return Shell(soul)
60+
return shell_module.Shell(soul)
6261

6362

6463
@pytest.mark.asyncio

tests/ui_and_conv/test_visualize_running_prompt.py

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,6 @@ def test_render_agent_prompt_message_keeps_empty_card_during_first_load(
512512
from prompt_toolkit.formatted_text import FormattedText
513513

514514
import pythinker_code.ui.shell.prompt as prompt_module
515-
from pythinker_code.ui.shell.prompt import PROMPT_SYMBOL_AGENT_INPUT
516515

517516
border = "──────── ● off"
518517
session = _card_session(turn_starting=True, delegate=None)
@@ -526,7 +525,7 @@ def test_render_agent_prompt_message_keeps_empty_card_during_first_load(
526525

527526
frame = "".join(text for _style, text, *_ in session._render_agent_prompt_message())
528527

529-
assert frame == f"{border}\n {PROMPT_SYMBOL_AGENT_INPUT} "
528+
assert frame == f"{border}\n {prompt_module.PROMPT_SYMBOL_AGENT_INPUT} "
530529

531530

532531
def test_render_agent_prompt_message_keeps_prompt_marker_when_card_gate_hides_buffer(
@@ -538,7 +537,6 @@ def test_render_agent_prompt_message_keeps_prompt_marker_when_card_gate_hides_bu
538537
from prompt_toolkit.formatted_text import FormattedText
539538

540539
import pythinker_code.ui.shell.prompt as prompt_module
541-
from pythinker_code.ui.shell.prompt import PROMPT_SYMBOL_AGENT_INPUT
542540

543541
border = "──────── ● off"
544542
session = object.__new__(CustomPromptSession)
@@ -558,11 +556,11 @@ def _rendered(hidden: bool) -> str:
558556
return "".join(text for _style, text, *_ in session._render_agent_prompt_message())
559557

560558
hidden_frame = _rendered(True)
561-
assert hidden_frame == f"{border}\n {PROMPT_SYMBOL_AGENT_INPUT} "
559+
assert hidden_frame == f"{border}\n {prompt_module.PROMPT_SYMBOL_AGENT_INPUT} "
562560

563561
shown_frame = _rendered(False)
564562
assert border in shown_frame
565-
assert PROMPT_SYMBOL_AGENT_INPUT in shown_frame
563+
assert prompt_module.PROMPT_SYMBOL_AGENT_INPUT in shown_frame
566564

567565

568566
def test_render_agent_prompt_message_keeps_prompt_marker_in_classic_style_pre_stream(
@@ -571,7 +569,6 @@ def test_render_agent_prompt_message_keeps_prompt_marker_in_classic_style_pre_st
571569
from prompt_toolkit.formatted_text import FormattedText
572570

573571
import pythinker_code.ui.shell.prompt as prompt_module
574-
from pythinker_code.ui.shell.prompt import PROMPT_SYMBOL_AGENT_INPUT
575572

576573
session = _card_session(turn_starting=True, delegate=None)
577574
session._shortcut_help_open = False
@@ -582,7 +579,7 @@ def test_render_agent_prompt_message_keeps_prompt_marker_in_classic_style_pre_st
582579

583580
frame = "".join(text for _style, text, *_ in session._render_agent_prompt_message())
584581

585-
assert frame == f"\n{PROMPT_SYMBOL_AGENT_INPUT} "
582+
assert frame == f"\n{prompt_module.PROMPT_SYMBOL_AGENT_INPUT} "
586583

587584

588585
def test_render_agent_prompt_message_keeps_prompt_marker_when_delegate_hides_buffer(
@@ -594,7 +591,6 @@ def test_render_agent_prompt_message_keeps_prompt_marker_when_delegate_hides_buf
594591
from prompt_toolkit.formatted_text import FormattedText
595592

596593
import pythinker_code.ui.shell.prompt as prompt_module
597-
from pythinker_code.ui.shell.prompt import PROMPT_SYMBOL_AGENT_INPUT
598594

599595
border = "──────── ● off"
600596
session = _card_session(delegate=_body_delegate("", hide_card=True))
@@ -608,7 +604,7 @@ def test_render_agent_prompt_message_keeps_prompt_marker_when_delegate_hides_buf
608604

609605
frame = "".join(text for _style, text, *_ in session._render_agent_prompt_message())
610606

611-
assert frame == f"{border}\n {PROMPT_SYMBOL_AGENT_INPUT} "
607+
assert frame == f"{border}\n {prompt_module.PROMPT_SYMBOL_AGENT_INPUT} "
612608

613609

614610
def test_render_agent_prompt_message_uses_scene_order_for_stream_and_input_card(
@@ -619,7 +615,6 @@ def test_render_agent_prompt_message_uses_scene_order_for_stream_and_input_card(
619615
from prompt_toolkit.formatted_text import FormattedText
620616

621617
import pythinker_code.ui.shell.prompt as prompt_module
622-
from pythinker_code.ui.shell.prompt import PROMPT_SYMBOL_AGENT_INPUT
623618

624619
border = "──────── ● off"
625620
session = _card_session(delegate=_body_delegate("assistant chunk", hide_card=True))
@@ -633,7 +628,7 @@ def test_render_agent_prompt_message_uses_scene_order_for_stream_and_input_card(
633628

634629
frame = "".join(text for _style, text, *_ in session._render_agent_prompt_message())
635630

636-
assert frame == f"assistant chunk\n{border}\n {PROMPT_SYMBOL_AGENT_INPUT} "
631+
assert frame == f"assistant chunk\n{border}\n {prompt_module.PROMPT_SYMBOL_AGENT_INPUT} "
637632

638633

639634
def test_render_agent_prompt_message_preserves_scene_fragment_styles(monkeypatch) -> None:
@@ -642,7 +637,6 @@ def test_render_agent_prompt_message_preserves_scene_fragment_styles(monkeypatch
642637
from prompt_toolkit.formatted_text import FormattedText
643638

644639
import pythinker_code.ui.shell.prompt as prompt_module
645-
from pythinker_code.ui.shell.prompt import PROMPT_SYMBOL_AGENT_INPUT
646640

647641
class _StyledDelegate:
648642
def render_running_prompt_body(self, columns: int) -> FormattedText:
@@ -688,7 +682,7 @@ def handle_running_prompt_key(self, key: str, event) -> None: # noqa: ANN001
688682
assert ("class:placeholder", "keep typing") in fragments
689683
assert (
690684
session._thinking_prompt_prefix_style(),
691-
f"{PROMPT_SYMBOL_AGENT_INPUT} ",
685+
f"{prompt_module.PROMPT_SYMBOL_AGENT_INPUT} ",
692686
) in fragments
693687

694688

@@ -701,7 +695,6 @@ def test_render_agent_prompt_message_keeps_live_view_chrome_before_first_commit(
701695
from prompt_toolkit.formatted_text import FormattedText
702696

703697
import pythinker_code.ui.shell.prompt as prompt_module
704-
from pythinker_code.ui.shell.prompt import PROMPT_SYMBOL_AGENT_INPUT
705698

706699
border = "──────── ● off"
707700
view = object.__new__(_PromptLiveView)
@@ -724,12 +717,12 @@ def test_render_agent_prompt_message_keeps_live_view_chrome_before_first_commit(
724717

725718
frame = "".join(text for _style, text, *_ in session._render_agent_prompt_message())
726719

727-
assert frame == f"{border}\n {PROMPT_SYMBOL_AGENT_INPUT} "
720+
assert frame == f"{border}\n {prompt_module.PROMPT_SYMBOL_AGENT_INPUT} "
728721

729722
view._committed_scrollback_this_turn = True
730723
frame = "".join(text for _style, text, *_ in session._render_agent_prompt_message())
731724

732-
assert frame == f"{border}\n {PROMPT_SYMBOL_AGENT_INPUT} "
725+
assert frame == f"{border}\n {prompt_module.PROMPT_SYMBOL_AGENT_INPUT} "
733726

734727

735728
def test_prompt_composing_activity_is_pinned_below_stream_body() -> None:

0 commit comments

Comments
 (0)