File: test_issue_97_simple_recurrent_todos_and_journals.py

package info (click to toggle)
python-recurring-ical-events 3.3.3-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,128 kB
  • sloc: python: 2,896; sh: 15; makefile: 3
file content (48 lines) | stat: -rw-r--r-- 1,671 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import pytest

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


@calendars_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.
    """
    calendars.components = ["VJOURNAL", "VTODO", "VEVENT"]
    tasks = calendars[ical_file].between((1989, 1, 1), (1991, 1, 1))
    assert not tasks


@calendars_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.
    """
    calendars.components = ["VJOURNAL", "VTODO", "VEVENT"]
    tasks = calendars[ical_file].between((1998, 1, 1), (1998, 4, 14))
    assert not tasks


@calendars_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
    """
    calendars.components = ["VJOURNAL", "VTODO", "VEVENT"]
    events = calendars[ical_file].between((1995, 1, 1), (2002, 1, 1))
    assert len(events) == 7