|
6 | 6 | def test_basic_structure(): |
7 | 7 | event = event_from_yaml( |
8 | 8 | parse_yaml( |
9 | | - ''' |
| 9 | + """ |
10 | 10 | summary: Earth Day |
11 | 11 | begin: 2021-04-22 |
12 | 12 | url: https://earthday.org |
13 | 13 | location: Earth |
14 | | - ''' |
| 14 | + """ |
15 | 15 | ) |
16 | 16 | ) |
17 | 17 |
|
18 | 18 | # All lines must be separated by CRLF |
19 | 19 | event_str = event.serialize() |
20 | | - lines = event_str.split('\n') |
| 20 | + lines = event_str.split("\n") |
21 | 21 | for line in lines[:-1]: |
22 | | - assert line.endswith('\r') |
23 | | - assert 'SUMMARY:Earth Day' in event_str |
24 | | - assert 'URL:https://earthday.org' in event_str |
25 | | - assert 'LOCATION:Earth' in event_str |
| 22 | + assert line.endswith("\r") |
| 23 | + assert "SUMMARY:Earth Day" in event_str |
| 24 | + assert "URL:https://earthday.org" in event_str |
| 25 | + assert "LOCATION:Earth" in event_str |
26 | 26 | # All events must have a DTSTAMP |
27 | | - assert 'DTSTAMP' in event_str |
| 27 | + assert "DTSTAMP" in event_str |
28 | 28 |
|
29 | 29 |
|
30 | 30 | def test_all_day_event(): |
31 | 31 | event = event_from_yaml( |
32 | 32 | parse_yaml( |
33 | | - ''' |
| 33 | + """ |
34 | 34 | summary: Earth Day |
35 | 35 | begin: 2021-04-22 |
36 | 36 | url: https://earthday.org |
37 | | - ''' |
| 37 | + """ |
38 | 38 | ) |
39 | 39 | ) |
40 | 40 | event_str = event.serialize() |
41 | | - assert event_str.startswith('BEGIN:VEVENT') |
42 | | - assert event_str.endswith('END:VEVENT') |
43 | | - assert 'DTSTART;VALUE=DATE:20210422' in event_str |
| 41 | + assert event_str.startswith("BEGIN:VEVENT") |
| 42 | + assert event_str.endswith("END:VEVENT") |
| 43 | + assert "DTSTART;VALUE=DATE:20210422" in event_str |
44 | 44 | # ics 0.8.0 does have DTEND that is the next day. |
45 | | - #assert 'DTEND' not in event_str |
| 45 | + # assert 'DTEND' not in event_str |
46 | 46 |
|
47 | 47 |
|
48 | 48 | def test_rrule(): |
49 | 49 | event = event_from_yaml( |
50 | 50 | parse_yaml( |
51 | | - ''' |
| 51 | + """ |
52 | 52 | summary: Earth Day |
53 | 53 | begin: 2021-04-22 |
54 | 54 | url: https://earthday.org |
55 | 55 | repeat: |
56 | 56 | interval: |
57 | 57 | years: 1 |
58 | 58 | until: 2030-04-22 |
59 | | - ''' |
| 59 | + """ |
60 | 60 | ) |
61 | 61 | ) |
62 | 62 | event_str = event.serialize() |
63 | 63 | # DTEND exists and is the next day, calendar tools import this |
64 | 64 | # correctly as being a one-day event |
65 | | - assert 'RRULE:FREQ=YEARLY;UNTIL=20300422T000000' in event_str |
| 65 | + assert "RRULE:FREQ=YEARLY;UNTIL=20300422T000000" in event_str |
66 | 66 |
|
67 | 67 |
|
68 | 68 | def test_event_with_time_range(): |
69 | 69 | event = event_from_yaml( |
70 | 70 | parse_yaml( |
71 | | - ''' |
| 71 | + """ |
72 | 72 | summary: Event of the Century |
73 | 73 | begin: 2021-09-21 15:00:00 -07:00 |
74 | 74 | end: 2021-09-21 15:30:00 -07:00 |
75 | 75 | description: | |
76 | 76 | Meet the team on the northern side of the field. |
77 | | - ''' |
| 77 | + """ |
78 | 78 | ) |
79 | 79 | ) |
80 | 80 | event_str = event.serialize() |
81 | | - assert 'DTSTART' in event_str |
82 | | - assert 'DTEND' in event_str |
| 81 | + assert "DTSTART" in event_str |
| 82 | + assert "DTEND" in event_str |
83 | 83 |
|
84 | 84 |
|
85 | 85 | def test_event_with_duration(): |
86 | 86 | event = event_from_yaml( |
87 | 87 | parse_yaml( |
88 | | - ''' |
| 88 | + """ |
89 | 89 | summary: Event of the Century |
90 | 90 | begin: 2021-09-21 15:00:00 -07:00 |
91 | 91 | duration: |
92 | 92 | minutes: 30 |
93 | 93 | description: | |
94 | 94 | Meet the team on the northern side of the field. |
95 | | - ''' |
| 95 | + """ |
96 | 96 | ) |
97 | 97 | ) |
98 | 98 | event_str = event.serialize() |
99 | | - assert 'DURATION:PT30M' in event_str |
100 | | - assert 'DTEND' not in event_str |
101 | | - assert 'DTSTART' in event_str |
102 | | - |
| 99 | + assert "DURATION:PT30M" in event_str |
| 100 | + assert "DTEND" not in event_str |
| 101 | + assert "DTSTART" in event_str |
0 commit comments