File: test_issue_48_dst.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 (41 lines) | stat: -rw-r--r-- 1,198 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
"""
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

import pytest
import pytz

chicago = pytz.timezone("America/Chicago")


@pytest.mark.parametrize(
    ("start_time", "end_time", "expected_count"),
    [
        # (
        #     chicago.localize(datetime.datetime(2020, 12, 11, 8)),
        #     chicago.localize(datetime.datetime(2020, 12, 11, 15)),
        #     4,
        # ),
        # (
        #     chicago.localize(datetime.datetime(2020, 12, 11, 9)),
        #     chicago.localize(datetime.datetime(2020, 12, 11, 15)),
        #     3,
        # ),
        (
            chicago.localize(datetime.datetime(2020, 12, 11, 10)),
            chicago.localize(datetime.datetime(2020, 12, 11, 15)),
            3,
        ),
    ],
)
def test_between(calendars, start_time, end_time, expected_count):
    events = calendars.issue_48_dst.between(start_time, end_time)
    assert (
        len(events) == expected_count
    ), f"{expected_count} events expected between {start_time} and {end_time}"