File: test_at_function.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 (28 lines) | stat: -rw-r--r-- 637 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
from datetime import date, datetime

import pytest


@pytest.mark.parametrize(
    ("a_date", "count"),
    [
        # Year
        (2018, 3),
        ((2018,), 3),
        # Month
        ((2018, 1), 3),
        # Day
        ((2018, 1, 11), 1),
        (date(2018, 1, 11), 1),
        ("20180111", 1),
        ((2018, 1, 9), 0),
        (date(2018, 1, 9), 0),
        ("20180109", 0),
        # Datetime
        (datetime(2018, 1, 11, 10, 0, 0), 1),
        (datetime(2018, 1, 9, 10, 0, 0), 0),
    ],
)
def test_at_input_arguments(a_date, count, calendars):
    events = calendars.duration.at(a_date)
    assert len(events) == count