| 1 | """These tests are for Issue 27 |
| 2 | https://github.com/niccokunzmann/python-recurring-ical-events/issues/27 |
| 3 | https://github.com/niccokunzmann/python-recurring-ical-events/pull/32 |
| 4 | |
| 5 | Diff of the two files: |
| 6 | |
| 7 | diff test/calendars/issue-27-t1.ics test/calendars/issue-27-t2.ics |
| 8 | |
| 9 | < RRULE:FREQ=DAILY;UNTIL=20200429T000000 |
| 10 | < EXDATE:20200427T120000Z |
| 11 | --- |
| 12 | > RRULE:FREQ=DAILY;UNTIL=20200429T000000Z |
| 13 | > EXDATE:20200427T140000Z |
| 14 | |
| 15 | """ |
| 16 | |
| 17 | start_date = (2020, 4, 25) |
| 18 | end_date = (2020, 4, 30) |
| 19 | |
| 20 | |
| 21 | def print_events(events): |
| 22 | for event in events: |
| 23 | start = event["DTSTART"].dt |
| 24 | duration = event["DTEND"].dt - event["DTSTART"].dt |
| 25 | print(f"start {start} duration {duration}") |
| 26 | |
| 27 | |
| 28 | def test_until_value_with_UNKNOWN_timezone_works_with_exdate(calendars): |
| 29 | """The until value has no time zone attached.""" |
| 30 | events = calendars.issue_27_t1.between(start_date, end_date) |
| 31 | print_events(events) |
| 32 | assert len(events) == 2, "two events, exdate matches one" |
| 33 | |
| 34 | |
| 35 | def test_until_value_with_DEFAULT_timezone_works_with_exdate(calendars): |
| 36 | """The until value uses the default time zone.""" |
| 37 | events = calendars.issue_27_t2.between(start_date, end_date) |
| 38 | print_events(events) |
| 39 | assert len(events) == 2, "two events, exdate matches one" |