File: test_issue_4.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 (43 lines) | stat: -rw-r--r-- 1,135 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
"""
These are tests concerning issue 4
https://github.com/niccokunzmann/python-recurring-ical-events/issues/4

It seems the rrule until parameter includes the last date
https://dateutil.readthedocs.io/en/stable/rrule.html
"""

import datetime

start_date = (2019, 6, 13, 12, 00, 00, 00)
end_date = (2019, 6, 14)
a_date = (2019, 6, 13)


def test_print_events(calendars):
    events = calendars.issue_4.between((2019, 6, 1), (2019, 7, 1))
    for event in events:
        print(event["DTSTART"].dt)


def test_between(calendars):
    events = calendars.issue_4.between(start_date, end_date)
    print(events)
    assert len(events) == 1
    assert events[0]["DTSTART"].dt == datetime.date(2019, 6, 13)


def test_at(calendars):
    events = calendars.issue_4.at(a_date)
    print(events)
    assert len(events) == 1
    assert events[0]["DTSTART"].dt == datetime.date(2019, 6, 13)


def test_can_use_different_rrule_until(calendars):
    events = list(calendars.issue_4_rrule_until.all())
    assert len(events) == 12


def test_weidenrinde(calendars):
    events = list(calendars.issue_4_weidenrinde.all())
    assert len(events) == 2