@@ -229,6 +229,37 @@ def test_send_markdown_table_uses_structured_card_elements(self, mock_post):
229229 self .assertNotIn ("```" , serialized )
230230 self .assertNotIn ("| 指标 |" , serialized )
231231
232+ @mock .patch ("src.notification_sender.feishu_sender.time.sleep" , return_value = None )
233+ @mock .patch ("src.notification_sender.feishu_sender.requests.post" )
234+ def test_chunked_markdown_table_does_not_promote_data_rows_to_headers (self , mock_post , _mock_sleep ):
235+ mock_post .return_value = _response (200 , {"code" : 0 })
236+ cfg = _config (feishu_webhook_url = "https://feishu.example/hook" , feishu_max_bytes = 130 )
237+ sender = FeishuSender (cfg )
238+ rows = "\n " .join (
239+ f"| { index :06d} | 股票{ index :02d} | { index } |"
240+ for index in range (1 , 10 )
241+ )
242+ content = f"""# 人气股票
243+
244+ | 代码 | 名称 | 热度 |
245+ | --- | --- | --- |
246+ { rows }
247+ """
248+
249+ result = sender .send_to_feishu (content )
250+
251+ self .assertTrue (result )
252+ self .assertGreater (mock_post .call_count , 1 )
253+ continuation_elements = [
254+ call .kwargs ["json" ]["card" ]["elements" ]
255+ for call in mock_post .call_args_list [1 :]
256+ ]
257+ serialized = json .dumps (continuation_elements , ensure_ascii = False )
258+ self .assertIn ("000004" , serialized )
259+ self .assertIn ("000006" , serialized )
260+ self .assertNotIn ("**000002**" , serialized )
261+ self .assertNotIn ("**000006**" , serialized )
262+
232263 @mock .patch ("src.notification_sender.feishu_sender.requests.post" )
233264 def test_send_error_response_returns_false (self , mock_post ):
234265 mock_post .return_value = _response (200 , {"code" : 19024 , "msg" : "keyword not found" })
0 commit comments