Skip to content

Commit 947cbdd

Browse files
committed
test: add format_duration test
1 parent 882ca44 commit 947cbdd

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

tests/util/test_formatters.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
from freqtrade.util import decimals_per_coin, fmt_coin, round_value
2-
from freqtrade.util.formatters import fmt_coin2
1+
from datetime import timedelta
2+
3+
from freqtrade.util import decimals_per_coin, fmt_coin, fmt_coin2, format_duration, round_value
34

45

56
def test_decimals_per_coin():
@@ -45,3 +46,12 @@ def test_round_value():
4546
assert round_value(0.1274512123, 5) == "0.12745"
4647
assert round_value(222.2, 3, True) == "222.200"
4748
assert round_value(222.2, 0, True) == "222"
49+
50+
51+
def test_format_duration():
52+
assert format_duration(timedelta(minutes=5)) == "0d 00:05"
53+
assert format_duration(timedelta(minutes=75)) == "0d 01:15"
54+
assert format_duration(timedelta(minutes=1440)) == "1d 00:00"
55+
assert format_duration(timedelta(minutes=1445)) == "1d 00:05"
56+
assert format_duration(timedelta(minutes=11445)) == "7d 22:45"
57+
assert format_duration(timedelta(minutes=101445)) == "70d 10:45"

0 commit comments

Comments
 (0)