| 1 | import pytest |
| 2 | |
| 3 | calendars_parametrized = pytest.mark.parametrize( |
| 4 | "ical_file", |
| 5 | [ |
| 6 | "issue_97_simple_todo", |
| 7 | "issue_97_simple_journal", |
| 8 | "issue_97_todo_nodtstart", |
| 9 | ], |
| 10 | ) |
| 11 | |
| 12 | |
| 13 | @calendars_parametrized |
| 14 | def test_recurring_task_is_not_included1(calendars, ical_file): |
| 15 | """The three files given starts in late 1991, no recurrences |
| 16 | should be found before 1991. Refers to |
| 17 | https://github.com/niccokunzmann/python-recurring-ical-events/issues/97. |
| 18 | Test passes prior to fixing #97, should still pass after #97 is |
| 19 | fixed. |
| 20 | """ |
| 21 | calendars.components = ["VJOURNAL", "VTODO", "VEVENT"] |
| 22 | tasks = calendars[ical_file].between((1989, 1, 1), (1991, 1, 1)) |
| 23 | assert not tasks |
| 24 | |
| 25 | |
| 26 | @calendars_parametrized |
| 27 | def test_recurring_task_is_not_included2(calendars, ical_file): |
| 28 | """Every recurrence of the three ical files is in October, hence |
| 29 | no recurrences should be found. Refers to |
| 30 | https://github.com/niccokunzmann/python-recurring-ical-events/issues/97. |
| 31 | Test passes prior to fixing #97, should still pass after #97 is |
| 32 | fixed. |
| 33 | """ |
| 34 | calendars.components = ["VJOURNAL", "VTODO", "VEVENT"] |
| 35 | tasks = calendars[ical_file].between((1998, 1, 1), (1998, 4, 14)) |
| 36 | assert not tasks |
| 37 | |
| 38 | |
| 39 | @calendars_parametrized |
| 40 | def test_recurring_task_is_repeated(calendars, ical_file): |
| 41 | """Expansion of a yearly task over seven years. |
| 42 | The issue |
| 43 | https://github.com/niccokunzmann/python-recurring-ical-events/issues/97 |
| 44 | needs to be fixed before this test can pass |
| 45 | """ |
| 46 | calendars.components = ["VJOURNAL", "VTODO", "VEVENT"] |
| 47 | events = calendars[ical_file].between((1995, 1, 1), (2002, 1, 1)) |
| 48 | assert len(events) == 7 |