diff options
Diffstat (limited to 'src/pybind/mgr/tests/test_mgr_util.py')
-rw-r--r-- | src/pybind/mgr/tests/test_mgr_util.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/pybind/mgr/tests/test_mgr_util.py b/src/pybind/mgr/tests/test_mgr_util.py new file mode 100644 index 000000000..fb7732d5c --- /dev/null +++ b/src/pybind/mgr/tests/test_mgr_util.py @@ -0,0 +1,19 @@ +import datetime +import mgr_util + +import pytest + + +@pytest.mark.parametrize( + "delta, out", + [ + (datetime.timedelta(minutes=90), '90m'), + (datetime.timedelta(minutes=190), '3h'), + (datetime.timedelta(days=3), '3d'), + (datetime.timedelta(hours=3), '3h'), + (datetime.timedelta(days=365 * 3.1), '3y'), + (datetime.timedelta(minutes=90), '90m'), + ] +) +def test_pretty_timedelta(delta: datetime.timedelta, out: str): + assert mgr_util.to_pretty_timedelta(delta) == out |