akg-factor-bridge/test_plan_review_window.py

33 lines
1.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""复盘周报的固定动作入口2026-09-07 方案第五件之三):滚动窗口与调度步骤白名单。"""
import datetime as dt
import plan_review
import xxl
def test_weekly_window_default_span():
# 周五 2026-09-11 触发:截止 7 天前的 09-04起点再往前 21 天的 08-14
since, until = plan_review.weekly_window(dt.date(2026, 9, 11))
assert (since, until) == ("2026-08-14", "2026-09-04")
def test_weekly_window_is_rolling_and_iso():
a = plan_review.weekly_window(dt.date(2026, 9, 11))
b = plan_review.weekly_window(dt.date(2026, 9, 18))
assert b != a
assert (dt.date.fromisoformat(b[0]) - dt.date.fromisoformat(a[0])).days == 7
assert dt.date.fromisoformat(a[1]) - dt.date.fromisoformat(a[0]) == dt.timedelta(days=21)
def test_weekly_window_today_default():
since, until = plan_review.weekly_window()
assert dt.date.fromisoformat(until) == dt.date.today() - dt.timedelta(days=7)
assert since < until
def test_plan_review_step_registered_but_not_default():
assert "plan-review" in xxl.STEP_ORDER
assert xxl.STEP_CMDS["plan-review"] == ["run.py", "plan-review"]
assert "plan-review" not in xxl.DEFAULT_STEPS # 不进默认三步,平台单建周五任务
assert xxl.STEP_ORDER.index("plan-review") > xxl.STEP_ORDER.index("push-pool")