test: replace the unreachable day+7 guard with a full trailing-day sweep
This commit is contained in:
@@ -213,11 +213,12 @@ def test_fifth_weekday_skips_four_occurrence_months() -> None:
|
|||||||
hit = _d(f"2026-{month:02d}-{day:02d}")
|
hit = _d(f"2026-{month:02d}-{day:02d}")
|
||||||
assert hit.weekday() == 0
|
assert hit.weekday() == 0
|
||||||
assert occurs_on(rule, hit) is True, hit
|
assert occurs_on(rule, hit) is True, hit
|
||||||
# It is the FINAL Monday of the month: no Monday after it.
|
# It is the FINAL Monday of the month: sweep EVERY remaining
|
||||||
if day + 7 <= _month_end_days(2026, month):
|
# calendar day after the hit — none may fire.
|
||||||
|
for later in range(day + 1, _month_end_days(2026, month) + 1):
|
||||||
assert occurs_on(
|
assert occurs_on(
|
||||||
rule, datetime.date(2026, month, day + 7)
|
rule, datetime.date(2026, month, later)
|
||||||
) is False
|
) is False, f"2026-{month:02d}-{later:02d}"
|
||||||
# The Monday a week earlier is not the fifth.
|
# The Monday a week earlier is not the fifth.
|
||||||
assert occurs_on(
|
assert occurs_on(
|
||||||
rule, datetime.date(2026, month, day - 7)
|
rule, datetime.date(2026, month, day - 7)
|
||||||
|
|||||||
Reference in New Issue
Block a user