Files
slic/tests/test_utils_readable.py
T
tligui_y 5ed98a56ed
Run CI Tests / test (push) Successful in 1m41s
Update tests/test_utils_readable.py
2025-08-04 14:51:11 +02:00

44 lines
1.1 KiB
Python

import pytest
from slic.utils.readable import readable_seconds
@pytest.mark.parametrize("seconds, expected", [
(59.4, "59 seconds"),
(59.9, "60 seconds"),
(119.9, "120 seconds"),
(120.1, "2 minutes"),
(3599.9, "60 minutes"),
(3600.1, "60 minutes"),
(7199.9, "120 minutes"),
(7200.1, "2 hours"),
(90.4, "90 seconds"),
(90.6, "91 seconds"),
(121.9, "2 minutes"),
(1296000.0, "15 days"),
(2332800.0, "27 days"),
(2592000.0, "4 weeks"),
(2800000.0, "5 weeks"),
(3888000.0, "6 weeks"),
(5097600.0, "8 weeks"),
(5184000.0, "9 weeks"),
(5270400.0, "2 months"),
(23328000.0, "9 months"),
(31104000.0, "12 months"),
(33696000.0, "13 months"),
(59616000.0, "23 months"),
(62208000.0, "24 months"),
(64208000.0, "2 years"),
])
def test_readable_seconds(seconds, expected):
assert readable_seconds(seconds) == expected
def test_rounding_cases(seconds, expected):
assert readable_seconds(seconds) == expected