| 1 |
""" |
| 2 |
These are tests concerning issue 4 |
| 3 |
https://github.com/niccokunzmann/python-recurring-ical-events/issues/4 |
| 4 |
|
| 5 |
It seems the rrule until parameter includes the last date |
| 6 |
https://dateutil.readthedocs.io/en/stable/rrule.html |
| 7 |
""" |
| 8 |
|
| 9 |
import datetime |
| 10 |
|
| 11 |
import pytest |
| 12 |
import pytz |
| 13 |
|
| 14 |
chicago = pytz.timezone("America/Chicago") |
| 15 |
|
| 16 |
|
| 17 |
@pytest.mark.parametrize( |
| 18 |
("start_time", "end_time", "expected_count"), |
| 19 |
[ |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
( |
| 31 |
chicago.localize(datetime.datetime(2020, 12, 11, 10)), |
| 32 |
chicago.localize(datetime.datetime(2020, 12, 11, 15)), |
| 33 |
3, |
| 34 |
), |
| 35 |
], |
| 36 |
) |
| 37 |
def test_between(calendars, start_time, end_time, expected_count): |
| 38 |
events = calendars.issue_48_dst.between(start_time, end_time) |
| 39 |
assert len(events) == expected_count, ( |
| 40 |
f"{expected_count} events expected between {start_time} and {end_time}" |
| 41 |
) |