summaryrefslogtreecommitdiff
path: root/t/unit/utils/test_time.py
blob: 660ae8eceb236c296989a3a305495894f5dbefd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import pytest

from kombu.utils.time import maybe_s_to_ms


@pytest.mark.parametrize('input,expected', [
    (3, 3000),
    (3.0, 3000),
    (303, 303000),
    (303.33, 303330),
    (303.333, 303333),
    (303.3334, 303333),
    (None, None),
    (0, 0),
])
def test_maybe_s_to_ms(input, expected):
    ret = maybe_s_to_ms(input)
    if expected is None:
        assert ret is None
    else:
        assert ret == expected