Debian Codegraph @

recurring_ical_events/test/test_issue_48_daylight.py

raw symbols SCIP
1 """These tests are for Issue 48
2 https://github.com/niccokunzmann/python-recurring-ical-events/issues/48
3
4 These were the events occurring when the issue was raised:
5 EVENT2:
6 start: 2020-11-02 11:30:00+00:00
7 stop: 2020-11-02 13:00:00+00:00
8
9 March to October: UTC+1
10 October to March: UTC+0
11
12 """
13
14 from datetime import datetime
15
16 import pytest
17 from pytz import timezone
18
19 TZ = timezone("Europe/Lisbon")
20
21
22 @pytest.mark.parametrize(
23 ("date", "event_name"),
24 [
25 (datetime(2020, 11, 2, 11, 15, 0, 0), 0),
26 (datetime(2020, 11, 2, 11, 31, 0, 0), "EVENT2"),
27 (datetime(2020, 11, 2, 12, 0, 0, 0), "EVENT2"),
28 (datetime(2020, 11, 2, 12, 1, 0, 0), "EVENT2"),
29 (datetime(2020, 11, 2, 12, 59, 0, 0), "EVENT2"),
30 (datetime(2020, 11, 2, 13, 1, 0, 0), 0),
31 ],
32 )
33 def test_event_timing(calendars, date, event_name):
34 date = TZ.localize(date)
35 events = calendars.issue_48_daylight_aware_repeats.at(date)
36 if event_name:
37 assert len(events) == 1
38 assert events[0]["UID"] == event_name
39 else:
40 assert not events, "no events expected"