Skip to content

Commit e3e6f90

Browse files
authored
Merge pull request #30 from MattMorgis/oai/issue-23
Resolve mypy arg-type errors in console tests
2 parents 149e0d0 + bb281c3 commit e3e6f90

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

tests/test_rendering.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from rich.console import Console
33

44
import oai_coding_agent.console.rendering as rendering
5+
from oai_coding_agent.console.state import UIMessage
56

67

78
@pytest.fixture(autouse=True)
@@ -20,14 +21,14 @@ def test_clear_terminal_callable():
2021

2122

2223
def test_render_message_user(record_console):
23-
msg = {"role": "user", "content": "hello user"}
24+
msg: UIMessage = {"role": "user", "content": "hello user"}
2425
rendering.render_message(msg)
2526
out = record_console.export_text()
2627
assert "You: hello user" in out
2728

2829

2930
def test_render_message_assistant(record_console):
30-
msg = {"role": "assistant", "content": "**bold** and `code`"}
31+
msg: UIMessage = {"role": "assistant", "content": "**bold** and `code`"}
3132
rendering.render_message(msg)
3233
out = record_console.export_text()
3334
assert "oai:" in out
@@ -36,22 +37,22 @@ def test_render_message_assistant(record_console):
3637

3738

3839
def test_render_message_system(record_console):
39-
msg = {"role": "system", "content": "system info"}
40+
msg: UIMessage = {"role": "system", "content": "system info"}
4041
rendering.render_message(msg)
4142
out = record_console.export_text()
4243
assert "System:" in out
4344
assert "system info" in out
4445

4546

4647
def test_render_message_thought(record_console):
47-
msg = {"role": "thought", "content": "thinking..."}
48+
msg: UIMessage = {"role": "thought", "content": "thinking..."}
4849
rendering.render_message(msg)
4950
out = record_console.export_text()
5051
assert "thinking..." in out
5152

5253

5354
def test_render_message_tool(record_console):
54-
msg = {"role": "tool", "content": "tool output"}
55+
msg: UIMessage = {"role": "tool", "content": "tool output"}
5556
rendering.render_message(msg)
5657
out = record_console.export_text()
5758
assert "Tool: tool output" in out

tests/test_slash_commands.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import pytest
22
from rich.console import Console
33

4-
from oai_coding_agent.console.state import UIState
4+
from oai_coding_agent.console.state import UIState, UIMessage
55
from oai_coding_agent.console.slash_commands import (
66
register_slash_commands,
77
handle_slash_command,
@@ -42,7 +42,8 @@ def test_handle_help_command_appends_help_message(record_console):
4242

4343
def test_handle_clear_command_clears_messages(record_console):
4444
state = UIState()
45-
state.messages.append({"role": "user", "content": "hi"})
45+
msg: UIMessage = {"role": "user", "content": "hi"}
46+
state.messages.append(msg)
4647
register_slash_commands(state)
4748
cont = handle_slash_command(state, "/clear")
4849
assert cont is True

0 commit comments

Comments
 (0)