Skip to content

Commit 39fdf35

Browse files
committed
Format Feishu message rendering tests
1 parent d217aaa commit 39fdf35

1 file changed

Lines changed: 7 additions & 21 deletions

File tree

tests/test_feishu_message_rendering.py

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,7 @@ def test_build_completed_card_long_body_has_no_collapsible_panel(self, mock_feis
181181
)
182182
assert "".join(element["content"] for element in card["body"]["elements"]) == long_text
183183

184-
def test_build_completed_card_places_streaming_history_above_result(
185-
self, mock_feishu_channel
186-
):
184+
def test_build_completed_card_places_streaming_history_above_result(self, mock_feishu_channel):
187185
task = {
188186
"id": 103,
189187
"title": "Finished task",
@@ -308,9 +306,7 @@ def test_send_final_patch_preserves_streaming_history(self, mock_feishu_channel)
308306
writer.on_event
309307
)
310308

311-
def test_build_completed_card_removes_final_answer_from_history(
312-
self, mock_feishu_channel
313-
):
309+
def test_build_completed_card_removes_final_answer_from_history(self, mock_feishu_channel):
314310
task = {
315311
"id": 9,
316312
"title": "Streaming final",
@@ -380,9 +376,7 @@ def test_streaming_card_normalizes_crlf_newlines(self, mock_feishu_channel):
380376
panel = card["body"]["elements"][0]
381377
assert _panel_texts(panel) == ["first line", "second line"]
382378

383-
def test_streaming_card_preserves_blank_lines_as_separate_rows(
384-
self, mock_feishu_channel
385-
):
379+
def test_streaming_card_preserves_blank_lines_as_separate_rows(self, mock_feishu_channel):
386380
card = mock_feishu_channel._build_streaming_card(
387381
12, "Streaming task", "first line\n\nthird line"
388382
)
@@ -402,22 +396,16 @@ def test_streaming_card_keeps_full_output_in_collapsible_panel(self, mock_feishu
402396
assert panel["header"]["title"]["content"] == "思考过程"
403397
assert _panel_texts(panel) == ["start", "A" * 1600, "end"]
404398

405-
def test_streaming_card_uses_code_block_fallback_for_many_lines(
406-
self, mock_feishu_channel
407-
):
399+
def test_streaming_card_uses_code_block_fallback_for_many_lines(self, mock_feishu_channel):
408400
long_text = "\n".join(f"line {i}" for i in range(220))
409401

410402
card = mock_feishu_channel._build_streaming_card(12, "Streaming task", long_text)
411403

412404
panel = card["body"]["elements"][0]
413-
assert panel["elements"] == [
414-
{"tag": "markdown", "content": f"```\n{long_text}\n```"}
415-
]
405+
assert panel["elements"] == [{"tag": "markdown", "content": f"```\n{long_text}\n```"}]
416406
assert _count_card_elements(card) <= 200
417407

418-
def test_stream_writer_appends_thinking_events_without_resplitting(
419-
self, mock_feishu_channel
420-
):
408+
def test_stream_writer_appends_thinking_events_without_resplitting(self, mock_feishu_channel):
421409
from channels.feishu_channel import _FeishuStreamWriter
422410

423411
writer = _FeishuStreamWriter(12, "om_msg", mock_feishu_channel, "Streaming task")
@@ -472,9 +460,7 @@ def test_stream_writer_resets_when_run_changes(self, mock_feishu_channel):
472460
12, "Streaming task", "new"
473461
)
474462

475-
def test_stream_writer_keeps_plain_assistant_text_for_live_card(
476-
self, mock_feishu_channel
477-
):
463+
def test_stream_writer_keeps_plain_assistant_text_for_live_card(self, mock_feishu_channel):
478464
from channels.feishu_channel import _FeishuStreamWriter
479465

480466
writer = _FeishuStreamWriter(12, "om_msg", mock_feishu_channel, "Streaming task")

0 commit comments

Comments
 (0)