File: test_time.py

package info (click to toggle)
kombu 5.6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 2,968 kB
  • sloc: python: 28,815; makefile: 318
file content (23 lines) | stat: -rw-r--r-- 459 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from __future__ import annotations

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