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
|