File: test_issue_107_omitting_last_event.py

package info (click to toggle)
python-recurring-ical-events 3.3.3-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,128 kB
  • sloc: python: 2,896; sh: 15; makefile: 3
file content (20 lines) | stat: -rw-r--r-- 1,165 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
"""bug: recurring event series that start in daylight savings time and end in standard time omit last event

Using a calendar application, I created a weekly event series in Pacific Standard Time that begins on January 5th and ends on June 8th. I filtered out events using between from today's date (~January 2023) and 1 year in the future (~January 2024). However, it incorrectly omitted the last event in the series on June 8th.

Upon further investigation, it seems to just be an issue for a recurring event series that begin in standard time but end in daylight savings time.

see https://github.com/niccokunzmann/python-recurring-ical-events/issues/107
see also test_issue_20_exdate_ignored.py - same problem with pytz
"""

import datetime


def test_last_event_is_present(calendars):
    today = datetime.date(2023, 1, 30)
    future = today + datetime.timedelta(days=365)
    events = calendars.issue_107_omitting_last_event.between(today, future)
    dates = [event["DTSTART"].dt.date() for event in events]
    assert datetime.date(2023, 6, 1) in dates, "event before last is present"
    assert datetime.date(2023, 6, 8) in dates, "last event is present"