Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_human_readable_timedelta_only_days():
assert human_readable_timedelta(timedelta(days=3)) == "3d"
def test_human_readable_timedelta_one_second():
assert human_readable_timedelta(timedelta(seconds=1)) == "1s"
def test_human_readable_timedelta_0_hours_0_minutes():
assert human_readable_timedelta(timedelta(days=3, seconds=3)) == "3d3s"
def test_human_readable_timedelta_more_than_1day_worth_seconds():
assert human_readable_timedelta(timedelta(seconds=3600 * 24 + 2)) == "1d2s"
def test_human_readable_timedelta_only_minutes():
assert human_readable_timedelta(timedelta(seconds=60 * 3)) == "3m"
def test_human_readable_timedelta_more_than_60_seconds():
assert human_readable_timedelta(timedelta(seconds=75)) == "1m15s"
def test_human_readable_timedelta_more_than_3600_seconds():
assert human_readable_timedelta(timedelta(seconds=3601)) == "1h1s"
def test_human_readable_timedelta_one_day_plus_more_than_1day_worth_seconds():
assert human_readable_timedelta(timedelta(days=1, seconds=3600 * 24 + 2)) == "2d2s"
def test_human_readable_timedelta_force_print_0_seconds():
assert human_readable_timedelta(timedelta(seconds=0)) == "0s"
def test_human_readable_timedelta_only_hours():
assert human_readable_timedelta(timedelta(seconds=3600 * 3)) == "3h"