Files
douyin_guaji-main/tests
CodexandClaude Opus 4.7 ffd048ffa5 refactor(fudai): 抽 run_once_basic 0.1 高价值预约检查到 helper (2079 → 1541)
新增 5 个 helper 到 run_once_basic_helpers.py:
- handle_reservation_check          0.1 预约检查主入口
- _maybe_clear_reservations_on_first_run  首次运行清空队列 + 状态文件
- _log_reservation_check_trigger    调试日志:检查触发条件
- _run_reservation_attend_window    队列满处理 / 抢占逻辑
- _log_reservation_attend_check     调试日志:第一个预约信息

净减 538 行重复嵌套样板。新增 7 个单元测试覆盖:
- 高价值未启用 / 队列空 → return False
- 首次运行清空队列
- 正常路径调 process_reservation_attend_window
- 队列满 → return True
- needswitch=False 走单间模式 + cleanup
- 等待开奖标志不阻断流程

至此 run_once_basic 总长 612 → 88 行(-86%),douyin_fudai.py
累计 4121 → 1541(-2580 行 / -63%),不再是项目最大文件。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 22:45:51 +08:00
..