File: test_skip_bad_events.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 (22 lines) | stat: -rw-r--r-- 662 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
21
22
from datetime import date

import pytest

from recurring_ical_events import InvalidCalendar, of


@pytest.mark.parametrize(
    ("calendar_name", "start", "end"),
    [
        ("end_before_start_event", date(2019, 1, 1), date(2019, 12, 31)),
        ("bad_rrule_missing_until_event", date(2019, 3, 1), date(2019, 12, 31)),
    ],
)
def test_skip_bad_events(calendars, calendar_name, start, end):
    calendar = calendars.raw[calendar_name]
    with pytest.raises(InvalidCalendar):
        rcalendar = of(calendar, skip_bad_series=False)
        rcalendar.between(start, end)

    rcalendar = of(calendar, skip_bad_series=True)
    rcalendar.between(start, end)