mirror of
https://github.com/freqtrade/freqtrade.git
synced 2026-02-19 10:50:50 +00:00
Update to dt_humanize_delta for all usages
This commit is contained in:
@@ -1821,8 +1821,8 @@ async def test_edge_enabled(edge_conf, update, mocker) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize('is_short,regex_pattern',
|
||||
[(True, r"just now[ ]*XRP\/BTC \(#3\) -1.00% \("),
|
||||
(False, r"just now[ ]*XRP\/BTC \(#3\) 1.00% \(")])
|
||||
[(True, r"now[ ]*XRP\/BTC \(#3\) -1.00% \("),
|
||||
(False, r"now[ ]*XRP\/BTC \(#3\) 1.00% \(")])
|
||||
async def test_telegram_trades(mocker, update, default_conf, fee, is_short, regex_pattern):
|
||||
|
||||
telegram, _, msg_mock = get_telegram_testobject(mocker, default_conf)
|
||||
|
||||
@@ -3,8 +3,9 @@ from datetime import datetime, timedelta, timezone
|
||||
import pytest
|
||||
import time_machine
|
||||
|
||||
from freqtrade.util import (dt_floor_day, dt_from_ts, dt_humanize, dt_now, dt_ts, dt_ts_def,
|
||||
dt_ts_none, dt_utc, format_date, format_ms_time, shorten_date)
|
||||
from freqtrade.util import (dt_floor_day, dt_from_ts, dt_now, dt_ts, dt_ts_def, dt_ts_none, dt_utc,
|
||||
format_date, format_ms_time, shorten_date)
|
||||
from freqtrade.util.datetime_helpers import dt_humanize_delta
|
||||
|
||||
|
||||
def test_dt_now():
|
||||
@@ -68,9 +69,12 @@ def test_shorten_date() -> None:
|
||||
|
||||
|
||||
def test_dt_humanize() -> None:
|
||||
assert dt_humanize(dt_now()) == 'just now'
|
||||
assert dt_humanize(dt_now(), only_distance=True) == 'instantly'
|
||||
assert dt_humanize(dt_now() - timedelta(hours=16), only_distance=True) == '16 hours'
|
||||
assert dt_humanize_delta(dt_now()) == 'now'
|
||||
assert dt_humanize_delta(dt_now() - timedelta(minutes=50)) == '50 minutes ago'
|
||||
assert dt_humanize_delta(dt_now() - timedelta(hours=16)) == '16 hours ago'
|
||||
assert dt_humanize_delta(dt_now() - timedelta(hours=16, minutes=30)) == '16 hours ago'
|
||||
assert dt_humanize_delta(dt_now() - timedelta(days=16, hours=10, minutes=25)) == '16 days ago'
|
||||
assert dt_humanize_delta(dt_now() - timedelta(minutes=50)) == '50 minutes ago'
|
||||
|
||||
|
||||
def test_format_ms_time() -> None:
|
||||
|
||||
Reference in New Issue
Block a user