forked from Rockachopa/Timmy-time-dashboard
fix: remove unused variable in repl test
This commit is contained in:
@@ -229,7 +229,7 @@ def test_chat_stdin_empty_exits_with_error():
|
|||||||
def test_repl_exits_on_ctrl_c():
|
def test_repl_exits_on_ctrl_c():
|
||||||
"""repl should exit gracefully on Ctrl+C (KeyboardInterrupt)."""
|
"""repl should exit gracefully on Ctrl+C (KeyboardInterrupt)."""
|
||||||
with patch("builtins.input", side_effect=KeyboardInterrupt):
|
with patch("builtins.input", side_effect=KeyboardInterrupt):
|
||||||
result = runner.invoke(app, ["repl"])
|
runner.invoke(app, ["repl"])
|
||||||
|
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
assert "Goodbye" in result.output
|
assert "Goodbye" in result.output
|
||||||
@@ -238,7 +238,7 @@ def test_repl_exits_on_ctrl_c():
|
|||||||
def test_repl_exits_on_ctrl_d():
|
def test_repl_exits_on_ctrl_d():
|
||||||
"""repl should exit gracefully on Ctrl+D (EOFError)."""
|
"""repl should exit gracefully on Ctrl+D (EOFError)."""
|
||||||
with patch("builtins.input", side_effect=EOFError):
|
with patch("builtins.input", side_effect=EOFError):
|
||||||
result = runner.invoke(app, ["repl"])
|
runner.invoke(app, ["repl"])
|
||||||
|
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
assert "Goodbye" in result.output
|
assert "Goodbye" in result.output
|
||||||
@@ -247,7 +247,7 @@ def test_repl_exits_on_ctrl_d():
|
|||||||
def test_repl_exits_on_quit_command():
|
def test_repl_exits_on_quit_command():
|
||||||
"""repl should exit when user types 'quit'."""
|
"""repl should exit when user types 'quit'."""
|
||||||
with patch("builtins.input", return_value="quit"):
|
with patch("builtins.input", return_value="quit"):
|
||||||
result = runner.invoke(app, ["repl"])
|
runner.invoke(app, ["repl"])
|
||||||
|
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
assert "Goodbye" in result.output
|
assert "Goodbye" in result.output
|
||||||
@@ -256,7 +256,7 @@ def test_repl_exits_on_quit_command():
|
|||||||
def test_repl_exits_on_exit_command():
|
def test_repl_exits_on_exit_command():
|
||||||
"""repl should exit when user types 'exit'."""
|
"""repl should exit when user types 'exit'."""
|
||||||
with patch("builtins.input", return_value="exit"):
|
with patch("builtins.input", return_value="exit"):
|
||||||
result = runner.invoke(app, ["repl"])
|
runner.invoke(app, ["repl"])
|
||||||
|
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
assert "Goodbye" in result.output
|
assert "Goodbye" in result.output
|
||||||
@@ -269,7 +269,7 @@ def test_repl_sends_message_to_chat():
|
|||||||
patch("timmy.session.chat") as mock_chat,
|
patch("timmy.session.chat") as mock_chat,
|
||||||
):
|
):
|
||||||
mock_chat.return_value = "Hi there!"
|
mock_chat.return_value = "Hi there!"
|
||||||
result = runner.invoke(app, ["repl"])
|
runner.invoke(app, ["repl"])
|
||||||
|
|
||||||
mock_chat.assert_called()
|
mock_chat.assert_called()
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
@@ -282,7 +282,7 @@ def test_repl_skips_empty_input():
|
|||||||
patch("timmy.session.chat") as mock_chat,
|
patch("timmy.session.chat") as mock_chat,
|
||||||
):
|
):
|
||||||
mock_chat.return_value = "Response"
|
mock_chat.return_value = "Response"
|
||||||
result = runner.invoke(app, ["repl"])
|
runner.invoke(app, ["repl"])
|
||||||
|
|
||||||
# chat should only be called once (for "hello"), empty lines are skipped, exit breaks
|
# chat should only be called once (for "hello"), empty lines are skipped, exit breaks
|
||||||
assert mock_chat.call_count == 1
|
assert mock_chat.call_count == 1
|
||||||
@@ -309,7 +309,7 @@ def test_repl_handles_chat_errors():
|
|||||||
patch("timmy.session.chat") as mock_chat,
|
patch("timmy.session.chat") as mock_chat,
|
||||||
):
|
):
|
||||||
mock_chat.side_effect = Exception("Chat error")
|
mock_chat.side_effect = Exception("Chat error")
|
||||||
result = runner.invoke(app, ["repl"])
|
runner.invoke(app, ["repl"])
|
||||||
|
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
assert "Error" in result.output
|
assert "Error" in result.output
|
||||||
|
|||||||
Reference in New Issue
Block a user