Skip to content

Commit f1bcd30

Browse files
committed
Fix remaining tests
1 parent d2d4956 commit f1bcd30

File tree

5 files changed

+19
-3
lines changed

5 files changed

+19
-3
lines changed

docs/changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ We use [Semantic Versioning](https://semver.org)
1515

1616
To avoid breaking changes breaking your code, install this library fixed to a specific version.
1717

18+
## v3.8.0
19+
20+
- Fix: Invalid events and todos that swapped start and end are now calculated with start before end. See [Issue 132](https://github.com/niccokunzmann/python-recurring-ical-events/issues/132).
21+
1822
## v3.7.1
1923

2024
- Fix: RECURENCE-ID is now not identical to DTSTART. See [Issue 243](https://github.com/niccokunzmann/python-recurring-ical-events/issues/243).

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ extend-safe-fixes = [
128128
"PT012", # pytest.raises() block should contain a single simple statement
129129
"PT015", # Assertion always fails, replace with pytest.fail()
130130
"T201", # print found
131+
"N803", # ZoneInfo should be lowercase
131132
]
132133
"example.py" = [
133134
"T201", # print found

recurring_ical_events/test/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def tzp(request):
125125

126126

127127
# for parametrizing fixtures, see https://docs.pytest.org/en/latest/fixture.html#parametrizing-fixtures
128-
@pytest.fixture(params=[Calendars, ReversedCalendars], scope="module")
128+
@pytest.fixture(params=[Calendars, ReversedCalendars])
129129
def calendars(request, tzp) -> ICSCalendars:
130130
"""The calendars we can use in the tests."""
131131
return request.param(tzp)

recurring_ical_events/test/test_issue_132_swapped_start_and_end.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from datetime import datetime
44

5+
import pytest
6+
57

68
def test_event_case(calendars):
79
"""Test an event with swapped start and end."""
@@ -19,7 +21,17 @@ def test_todo_case(calendars):
1921
assert todo.end.replace(tzinfo=None) == datetime(2023, 12, 18, 23, 45)
2022

2123

22-
def test_old_example_works_now(calendars):
24+
@pytest.mark.parametrize("skip_invalid", [True, False])
25+
def test_old_example_works_now(calendars, ZoneInfo, skip_invalid):
2326
"""The old tests works now."""
27+
calendars.skip_bad_series = skip_invalid
2428
events = calendars.end_before_start_event.at(2019)
29+
print(list(calendars.end_before_start_event.all()))
2530
assert len(events) == 1
31+
event = events[0]
32+
assert event.start == datetime(
33+
2019, 3, 4, 8, tzinfo=ZoneInfo("Europe/Berlin")
34+
) # 20190304T080000
35+
assert event.end == datetime(
36+
2019, 3, 4, 8, 30, tzinfo=ZoneInfo("Europe/Berlin")
37+
) # 20190304T080300

recurring_ical_events/test/test_skip_bad_events.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
@pytest.mark.parametrize(
1010
("calendar_name", "start", "end"),
1111
[
12-
("end_before_start_event", date(2019, 1, 1), date(2019, 12, 31)),
1312
("bad_rrule_missing_until_event", date(2019, 3, 1), date(2019, 12, 31)),
1413
],
1514
)

0 commit comments

Comments
 (0)