chore: auto release commit (2026-06-15 17:32:47)
All checks were successful
技能自动化发布 / release (push) Successful in 7s
All checks were successful
技能自动化发布 / release (push) Successful in 7s
This commit is contained in:
34
examples/real_browser_rpa/tests/test_stop_reason.py
Normal file
34
examples/real_browser_rpa/tests/test_stop_reason.py
Normal file
@@ -0,0 +1,34 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""stop_reason 用户友好文案单元测试。"""
|
||||
from __future__ import annotations
|
||||
|
||||
import unittest
|
||||
|
||||
from service.task_rpa import format_stop_reason_for_user
|
||||
|
||||
|
||||
class TestFormatStopReasonForUser(unittest.TestCase):
|
||||
def test_max_items(self) -> None:
|
||||
msg = format_stop_reason_for_user("max_items", 100)
|
||||
self.assertIn("默认采集规模", msg)
|
||||
self.assertIn("100", msg)
|
||||
|
||||
def test_end_marker(self) -> None:
|
||||
msg = format_stop_reason_for_user("end_marker", 42)
|
||||
self.assertIn("没有更多结果", msg)
|
||||
|
||||
def test_no_new_rounds(self) -> None:
|
||||
msg = format_stop_reason_for_user("no_new_rounds", 30)
|
||||
self.assertIn("连续多次加载没有发现新结果", msg)
|
||||
|
||||
def test_max_scrolls(self) -> None:
|
||||
msg = format_stop_reason_for_user("max_scrolls", 80)
|
||||
self.assertIn("页面加载保护范围", msg)
|
||||
|
||||
def test_none_or_unknown(self) -> None:
|
||||
self.assertEqual(format_stop_reason_for_user(None, 10), "本次采集已完成。")
|
||||
self.assertEqual(format_stop_reason_for_user("unknown", 10), "本次采集已完成。")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user