refactor: tests - update timezone.utc to UTC
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from copy import deepcopy
|
||||
from datetime import datetime, timezone
|
||||
from datetime import UTC, datetime
|
||||
from pathlib import Path
|
||||
from unittest.mock import PropertyMock
|
||||
|
||||
@@ -28,7 +28,7 @@ from tests.freqai.conftest import get_patched_freqai_strategy
|
||||
def test_freqai_backtest_start_backtest_list(freqai_conf, mocker, testdatadir, caplog):
|
||||
patch_exchange(mocker)
|
||||
|
||||
now = datetime.now(timezone.utc)
|
||||
now = datetime.now(UTC)
|
||||
mocker.patch(
|
||||
"freqtrade.plugins.pairlistmanager.PairListManager.whitelist",
|
||||
PropertyMock(return_value=["HULUMULU/USDT", "XRP/USDT"]),
|
||||
@@ -73,7 +73,7 @@ def test_freqai_backtest_load_data(
|
||||
):
|
||||
patch_exchange(mocker)
|
||||
|
||||
now = datetime.now(timezone.utc)
|
||||
now = datetime.now(UTC)
|
||||
mocker.patch(
|
||||
"freqtrade.plugins.pairlistmanager.PairListManager.whitelist",
|
||||
PropertyMock(return_value=["HULUMULU/USDT", "XRP/USDT"]),
|
||||
@@ -98,7 +98,7 @@ def test_freqai_backtest_load_data(
|
||||
def test_freqai_backtest_live_models_model_not_found(freqai_conf, mocker, testdatadir, caplog):
|
||||
patch_exchange(mocker)
|
||||
|
||||
now = datetime.now(timezone.utc)
|
||||
now = datetime.now(UTC)
|
||||
mocker.patch(
|
||||
"freqtrade.plugins.pairlistmanager.PairListManager.whitelist",
|
||||
PropertyMock(return_value=["HULUMULU/USDT", "XRP/USDT"]),
|
||||
@@ -163,6 +163,6 @@ def test_freqai_backtest_consistent_timerange(mocker, freqai_conf):
|
||||
backtesting = Backtesting(deepcopy(freqai_conf))
|
||||
backtesting.start()
|
||||
|
||||
assert gbs.call_args[1]["min_date"] == datetime(2021, 11, 20, 0, 0, tzinfo=timezone.utc)
|
||||
assert gbs.call_args[1]["max_date"] == datetime(2021, 11, 21, 0, 0, tzinfo=timezone.utc)
|
||||
assert gbs.call_args[1]["min_date"] == datetime(2021, 11, 20, 0, 0, tzinfo=UTC)
|
||||
assert gbs.call_args[1]["max_date"] == datetime(2021, 11, 21, 0, 0, tzinfo=UTC)
|
||||
Backtesting.cleanup()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import shutil
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from datetime import UTC, datetime, timedelta
|
||||
from pathlib import Path
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
@@ -67,9 +67,9 @@ def test_split_timerange(
|
||||
|
||||
def test_check_if_model_expired(mocker, freqai_conf):
|
||||
dk = get_patched_data_kitchen(mocker, freqai_conf)
|
||||
now = datetime.now(tz=timezone.utc).timestamp()
|
||||
now = datetime.now(tz=UTC).timestamp()
|
||||
assert dk.check_if_model_expired(now) is False
|
||||
now = (datetime.now(tz=timezone.utc) - timedelta(hours=2)).timestamp()
|
||||
now = (datetime.now(tz=UTC) - timedelta(hours=2)).timestamp()
|
||||
assert dk.check_if_model_expired(now) is True
|
||||
shutil.rmtree(Path(dk.full_path))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user