fix: 拆除后工参改用拆除日下一周的周一
停闭后一周的指标周三就有、下一周周一的工参周四才取,中间这一天周边站先按拆除前工参算,并在结果说明里写明。
This commit is contained in:
@@ -259,7 +259,7 @@ def test_next_to_fill_takes_one_at_a_time_and_backs_off_after_a_failure():
|
||||
assert platform.fetched == [date(2026, 11, 2), date(2026, 10, 26)]
|
||||
|
||||
|
||||
# 拆除日 2026-10-15 是周四:上一周的周一是 10-05,当周的周一是 10-12。
|
||||
# 拆除日 2026-10-15 是周四:上一周的周一是 10-05,下一周的周一是 10-19。
|
||||
REMOVAL = date(2026, 10, 15)
|
||||
TODAY = date(2026, 11, 12)
|
||||
|
||||
@@ -303,21 +303,22 @@ def test_before_uses_latest_available_monday_for_a_future_removal():
|
||||
assert platform.fetched == []
|
||||
|
||||
|
||||
def test_after_is_the_monday_of_the_removal_week_and_target_may_still_be_there():
|
||||
platform = Platform({date(2026, 10, 12): with_target()})
|
||||
store = make_store(platform, {date(2026, 10, 19): without_target()})
|
||||
assert asyncio.run(pick_after(store, CITY, SITE, REMOVAL, TODAY)) == AfterPick(date(2026, 10, 12), True)
|
||||
assert asyncio.run(pick_after(store, CITY, SITE, date(2026, 10, 19), TODAY)) == AfterPick(date(2026, 10, 19), False)
|
||||
assert platform.fetched == [date(2026, 10, 12)]
|
||||
def test_after_is_the_monday_after_the_removal_week_and_target_may_still_be_there():
|
||||
platform = Platform({date(2026, 10, 19): with_target()})
|
||||
store = make_store(platform, {date(2026, 10, 12): with_target(), date(2026, 10, 26): without_target()})
|
||||
assert asyncio.run(pick_after(store, CITY, SITE, REMOVAL, TODAY)) == AfterPick(date(2026, 10, 19), True)
|
||||
# 拆除日正好是周一,也用下一周的周一。
|
||||
assert asyncio.run(pick_after(store, CITY, SITE, date(2026, 10, 19), TODAY)) == AfterPick(date(2026, 10, 26), False)
|
||||
assert platform.fetched == [date(2026, 10, 19)]
|
||||
|
||||
|
||||
def test_after_is_empty_until_that_monday_can_be_fetched():
|
||||
store = make_store(Platform({}))
|
||||
# 11-09 这个周一 11-12 起可取;11-16 的还不行。
|
||||
assert asyncio.run(pick_after(store, CITY, SITE, date(2026, 11, 10), date(2026, 11, 11))) is None
|
||||
assert asyncio.run(pick_after(store, CITY, SITE, date(2026, 11, 17), TODAY)) is None
|
||||
# 拆除日 11-03 的下一周周一是 11-09,11-12 起可取;拆除日 11-10 的是 11-16,还不行。
|
||||
assert asyncio.run(pick_after(store, CITY, SITE, date(2026, 11, 3), date(2026, 11, 11))) is None
|
||||
assert asyncio.run(pick_after(store, CITY, SITE, date(2026, 11, 10), TODAY)) is None
|
||||
with pytest.raises(GongcanError, match="平台没有这一天"):
|
||||
asyncio.run(pick_after(store, CITY, SITE, date(2026, 11, 10), TODAY))
|
||||
asyncio.run(pick_after(store, CITY, SITE, date(2026, 11, 3), TODAY))
|
||||
|
||||
|
||||
def test_target_needs_cgis_or_site():
|
||||
|
||||
Reference in New Issue
Block a user