File: test_util_functions.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-- 692 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
"""Check some utility functions."""

from typing import NamedTuple

import pytest

from recurring_ical_events import with_highest_sequence


class Component(NamedTuple):
    sequence: int


@pytest.mark.parametrize(
    ("a1", "a2", "result"),
    [
        (None, None, None),
        (Component(1), Component(2), Component(2)),
        (Component(5), Component(2), Component(5)),
        (Component(1), None, Component(1)),
        (None, Component(4), Component(4)),
        (None, Component(-3), Component(-3)),
        (Component(-1), None, Component(-1)),
    ],
)
def test_highest_sequence(a1, a2, result):
    """Check the result"""
    assert with_highest_sequence(a1, a2) == result