Skip to content

Use Claude Code, Codex, VSCode, Pi, and OpenCode (and 6 other harnesses) for free (1.3B+ free tokens) from your terminal, app, IDE, or phone, and now from the browser with native browser sessions (multi-harness + multi-model) like OpenClaw (voice supported + ToS friendly)

Python

Apply ruff format

Cursor Agentb5e95849e3ef
diff --git a/tests/test_converter.py b/tests/test_converter.py
index 9930aa2c..cdb493a2 100644
--- a/tests/test_converter.py
+++ b/tests/test_converter.py
@@ -354,9 +354,7 @@ def test_convert_assistant_interleaved_order_preserved():
assert len(result) == 1
msg = result[0]
# Expected: thinking1, text, thinking2 in that order within content; tool_calls at end
- expected_content = (
- "<think>\nFirst thought.\n</think>\n\nHere is the answer.\n\n<think>\nSecond thought.\n</think>"
- )
+ expected_content = "<think>\nFirst thought.\n</think>\n\nHere is the answer.\n\n<think>\nSecond thought.\n</think>"
assert msg["content"] == expected_content, (
f"Interleaved order lost. Got: {msg['content']!r}"
)
diff --git a/tests/test_handler_markdown_and_status_edges.py b/tests/test_handler_markdown_and_status_edges.py
index 86f18ed7..a5211a77 100644
--- a/tests/test_handler_markdown_and_status_edges.py
+++ b/tests/test_handler_markdown_and_status_edges.py
@@ -80,14 +80,18 @@ def test_get_initial_status_branches():
handler = ClaudeMessageHandler(platform, cli_manager, session_store)
with (
- patch.object(handler.tree_queue, "is_node_tree_busy", MagicMock(return_value=True)),
+ patch.object(
+ handler.tree_queue, "is_node_tree_busy", MagicMock(return_value=True)
+ ),
patch.object(handler.tree_queue, "get_queue_size", MagicMock(return_value=2)),
):
s1 = handler._get_initial_status(tree=object(), parent_node_id="p")
assert "Queued" in s1
assert "position 3" in s1 or "position 3" in s1.replace("\\", "")
- with patch.object(handler.tree_queue, "is_node_tree_busy", MagicMock(return_value=False)):
+ with patch.object(
+ handler.tree_queue, "is_node_tree_busy", MagicMock(return_value=False)
+ ):
s2 = handler._get_initial_status(tree=object(), parent_node_id="p")
assert "Continuing" in s2
@@ -151,7 +155,9 @@ async def test_process_node_session_limit_marks_error_and_updates_ui():
fake_tree = MagicMock()
fake_tree.update_state = AsyncMock()
- with patch.object(handler.tree_queue, "get_tree_for_node", MagicMock(return_value=fake_tree)):
+ with patch.object(
+ handler.tree_queue, "get_tree_for_node", MagicMock(return_value=fake_tree)
+ ):
incoming = IncomingMessage(
text="hi",
chat_id="c",
@@ -195,7 +201,9 @@ async def test_stop_all_tasks_saves_tree_for_cancelled_nodes():
tree.to_dict = MagicMock(return_value={"root": "ok"})
with (
patch.object(handler.tree_queue, "cancel_all", AsyncMock(return_value=[node])),
- patch.object(handler.tree_queue, "get_tree_for_node", MagicMock(return_value=tree)),
+ patch.object(
+ handler.tree_queue, "get_tree_for_node", MagicMock(return_value=tree)
+ ),
):
count = await handler.stop_all_tasks()
assert count == 1
diff --git a/tests/test_response_models.py b/tests/test_response_models.py
index 0cab9b41..8f649ef3 100644
--- a/tests/test_response_models.py
+++ b/tests/test_response_models.py
@@ -159,7 +159,9 @@ class TestMessagesResponse:
"""All valid stop_reason values should be accepted."""
from typing import Literal
- reasons: list[Literal["end_turn", "max_tokens", "stop_sequence", "tool_use"]] = [
+ reasons: list[
+ Literal["end_turn", "max_tokens", "stop_sequence", "tool_use"]
+ ] = [
"end_turn",
"max_tokens",
"stop_sequence",
diff --git a/tests/test_telegram_edge_cases.py b/tests/test_telegram_edge_cases.py
index 26846fd0..c82921ca 100644
--- a/tests/test_telegram_edge_cases.py
+++ b/tests/test_telegram_edge_cases.py
@@ -121,7 +121,9 @@ async def test_queue_send_message_without_limiter_calls_send_message():
platform = TelegramPlatform(bot_token="t")
platform._limiter = None
- with patch.object(platform, "send_message", new_callable=AsyncMock) as mock_send:
+ with patch.object(
+ platform, "send_message", new_callable=AsyncMock
+ ) as mock_send:
mock_send.return_value = "1"
assert await platform.queue_send_message("c", "t") == "1"
mock_send.assert_awaited_once()
@@ -134,7 +136,9 @@ async def test_queue_edit_message_without_limiter_calls_edit_message():
platform = TelegramPlatform(bot_token="t")
platform._limiter = None
- with patch.object(platform, "edit_message", new_callable=AsyncMock) as mock_edit:
+ with patch.object(
+ platform, "edit_message", new_callable=AsyncMock
+ ) as mock_edit:
await platform.queue_edit_message("c", "1", "t")
mock_edit.assert_awaited_once()
@@ -158,7 +162,9 @@ async def test_on_start_command_replies_and_forwards():
from messaging.telegram import TelegramPlatform
platform = TelegramPlatform(bot_token="t")
- with patch.object(platform, "_on_telegram_message", new_callable=AsyncMock) as mock_msg:
+ with patch.object(
+ platform, "_on_telegram_message", new_callable=AsyncMock
+ ) as mock_msg:
update = MagicMock()
update.message.reply_text = AsyncMock()
@@ -173,7 +179,10 @@ async def test_on_telegram_message_handler_error_sends_error_message():
from messaging.telegram import TelegramPlatform
platform = TelegramPlatform(bot_token="t", allowed_user_id="123")
- with patch.object(platform, "send_message", new_callable=AsyncMock) as mock_send:
+ with patch.object(
+ platform, "send_message", new_callable=AsyncMock
+ ) as mock_send:
+
async def _boom(_incoming):
raise RuntimeError("bad")