Files
hatchet/sdks/python/tests/test_durations.py
Matt Kaye 8de5cea480 Fix: Duration conversion to Go duration strings (#1578)
* fix: bug in timeouts

* chore: ver

* fix: `total_seconds`

* fix: linter
2025-04-18 14:18:56 -04:00

13 lines
523 B
Python

from datetime import timedelta
from hatchet_sdk.utils.timedelta_to_expression import timedelta_to_expr
def test_timedelta_to_expr() -> None:
assert timedelta_to_expr(timedelta(seconds=3600)) == "1h"
assert timedelta_to_expr(timedelta(seconds=60)) == "1m"
assert timedelta_to_expr(timedelta(seconds=1)) == "1s"
assert timedelta_to_expr(timedelta(seconds=3661)) == "3661s"
assert timedelta_to_expr(timedelta(hours=96)) == "96h"
assert timedelta_to_expr(timedelta(hours=96, seconds=1)) == "345601s"