Skip to content

Commit

Permalink
modified according to code review, refers to niccokunzmann#97 and cod…
Browse files Browse the repository at this point in the history
…e reviews for commit d25b425
  • Loading branch information
tobixen committed Nov 3, 2022
1 parent d25b425 commit ddc9a1a
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 31 deletions.
4 changes: 4 additions & 0 deletions recurring_ical_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,10 @@ def __init__(self, calendar, keep_recurrence_attributes=False):
self.repetitions = []
for event in calendar.walk("VEVENT"):
self.repetitions.append(RepeatedEvent(event, keep_recurrence_attributes))
for event in calendar.walk("VTODO"):
self.repetitions.append(RepeatedTodo(event, keep_recurrence_attributes))
for event in calendar.walk("VJOURNAL"):
self.repetitions.append(RepeatedJournal(event, keep_recurrence_attributes))

@staticmethod
def to_datetime(date):
Expand Down
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions test/calendars/issue-97-todo-nodtstart.ics
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Example Corp.//CalDAV Client//EN
BEGIN:VTODO
UID:19920901T130000Z-123408@host.com
DTSTAMP:19920901T130000Z
DUE:19920516T045959Z
SUMMARY:Yearly Income Tax Preparation
RRULE:FREQ=YEARLY
CLASS:CONFIDENTIAL
CATEGORIES:FAMILY,FINANCE
PRIORITY:1
END:VTODO
END:VCALENDAR
44 changes: 44 additions & 0 deletions test/test_issue_97_simple_recurrent_todos_and_journals.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import pytest
from recurring_ical_events import DATE_MAX

testdata_parametrized = pytest.mark.parametrize("ical_file", [
"issue_97_simple_todo",
"issue_97_simple_journal",
"issue_97_todo_nodtstart",
])

@testdata_parametrized
def test_recurring_task_is_not_included1(calendars, ical_file):
"""The three files given starts in late 1991, no recurrences
should be found before 1991. Refers to
https://github.com/niccokunzmann/python-recurring-ical-events/issues/97.
Test passes prior to fixing #97, should still pass after #97 is
fixed.
"""
calendar = getattr(calendars, ical_file)
tasks = calendar.between((1989, 1, 1), (1991,1,1))
assert not tasks

@testdata_parametrized
def test_recurring_task_is_not_included2(calendars, ical_file):
"""Every recurrence of the three ical files is in October, hence
no recurrences should be found. Refers to
https://github.com/niccokunzmann/python-recurring-ical-events/issues/97.
Test passes prior to fixing #97, should still pass after #97 is
fixed.
"""
calendar = getattr(calendars, ical_file)
tasks = calendar.between((1998, 1, 1), (1998,4,14))
assert not tasks

@testdata_parametrized
def test_recurring_task_is_repeated(calendars, ical_file):
"""Expansion of a yearly task over seven years.
The issue
https://github.com/niccokunzmann/python-recurring-ical-events/issues/97
needs to be fixed before this test can pass
"""
calendar = getattr(calendars, ical_file)
events = calendar.between((1995, 1, 1), (2022,1,1))
assert len(events) == 7

31 changes: 0 additions & 31 deletions test/test_simple_recurrent_todos_and_journals.py

This file was deleted.

0 comments on commit ddc9a1a

Please sign in to comment.