mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 00:23:07 +00:00
test: add format_duration test
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from freqtrade.util import decimals_per_coin, fmt_coin, round_value
|
||||
from freqtrade.util.formatters import fmt_coin2
|
||||
from datetime import timedelta
|
||||
|
||||
from freqtrade.util import decimals_per_coin, fmt_coin, fmt_coin2, format_duration, round_value
|
||||
|
||||
|
||||
def test_decimals_per_coin():
|
||||
@@ -45,3 +46,12 @@ def test_round_value():
|
||||
assert round_value(0.1274512123, 5) == "0.12745"
|
||||
assert round_value(222.2, 3, True) == "222.200"
|
||||
assert round_value(222.2, 0, True) == "222"
|
||||
|
||||
|
||||
def test_format_duration():
|
||||
assert format_duration(timedelta(minutes=5)) == "0d 00:05"
|
||||
assert format_duration(timedelta(minutes=75)) == "0d 01:15"
|
||||
assert format_duration(timedelta(minutes=1440)) == "1d 00:00"
|
||||
assert format_duration(timedelta(minutes=1445)) == "1d 00:05"
|
||||
assert format_duration(timedelta(minutes=11445)) == "7d 22:45"
|
||||
assert format_duration(timedelta(minutes=101445)) == "70d 10:45"
|
||||
|
||||
Reference in New Issue
Block a user