From d010a050d384ffd95ec7fbe6c2f71f1df3c45746 Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 4 Jul 2025 09:10:14 +0200 Subject: [PATCH] chore: autoformat tests --- tests/data/test_trade_converter_kraken.py | 8 ++------ tests/exchange/test_okx.py | 6 ++---- tests/util/test_datetime_helpers.py | 8 ++------ 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/tests/data/test_trade_converter_kraken.py b/tests/data/test_trade_converter_kraken.py index bfdb2c0f3..cddcf5dc0 100644 --- a/tests/data/test_trade_converter_kraken.py +++ b/tests/data/test_trade_converter_kraken.py @@ -49,12 +49,8 @@ def test_import_kraken_trades_from_csv(testdatadir, tmp_path, caplog, default_co trades = dh.trades_load("BCH_EUR", TradingMode.SPOT) assert len(trades) == 340 - assert trades["date"].min().to_pydatetime() == datetime( - 2023, 1, 1, 0, 3, 56, tzinfo=UTC - ) - assert trades["date"].max().to_pydatetime() == datetime( - 2023, 1, 2, 23, 17, 3, tzinfo=UTC - ) + assert trades["date"].min().to_pydatetime() == datetime(2023, 1, 1, 0, 3, 56, tzinfo=UTC) + assert trades["date"].max().to_pydatetime() == datetime(2023, 1, 2, 23, 17, 3, tzinfo=UTC) # ID is not filled assert len(trades.loc[trades["id"] != ""]) == 0 diff --git a/tests/exchange/test_okx.py b/tests/exchange/test_okx.py index e2a29b1fc..bf881163e 100644 --- a/tests/exchange/test_okx.py +++ b/tests/exchange/test_okx.py @@ -29,8 +29,7 @@ def test_okx_ohlcv_candle_limit(default_conf, mocker): assert exchange.ohlcv_candle_limit(timeframe, CandleType.FUNDING_RATE, start_time) == 100 one_call = int( ( - datetime.now(UTC) - - timedelta(minutes=290 * timeframe_to_minutes(timeframe)) + datetime.now(UTC) - timedelta(minutes=290 * timeframe_to_minutes(timeframe)) ).timestamp() * 1000 ) @@ -40,8 +39,7 @@ def test_okx_ohlcv_candle_limit(default_conf, mocker): one_call = int( ( - datetime.now(UTC) - - timedelta(minutes=320 * timeframe_to_minutes(timeframe)) + datetime.now(UTC) - timedelta(minutes=320 * timeframe_to_minutes(timeframe)) ).timestamp() * 1000 ) diff --git a/tests/util/test_datetime_helpers.py b/tests/util/test_datetime_helpers.py index 0fc8cd050..82dd6dbf6 100644 --- a/tests/util/test_datetime_helpers.py +++ b/tests/util/test_datetime_helpers.py @@ -50,18 +50,14 @@ def test_dt_ts_none(): def test_dt_utc(): assert dt_utc(2023, 5, 5) == datetime(2023, 5, 5, tzinfo=UTC) - assert dt_utc(2023, 5, 5, 0, 0, 0, 555500) == datetime( - 2023, 5, 5, 0, 0, 0, 555500, tzinfo=UTC - ) + assert dt_utc(2023, 5, 5, 0, 0, 0, 555500) == datetime(2023, 5, 5, 0, 0, 0, 555500, tzinfo=UTC) @pytest.mark.parametrize("as_ms", [True, False]) def test_dt_from_ts(as_ms): multi = 1000 if as_ms else 1 assert dt_from_ts(1683244800.0 * multi) == datetime(2023, 5, 5, tzinfo=UTC) - assert dt_from_ts(1683244800.5555 * multi) == datetime( - 2023, 5, 5, 0, 0, 0, 555500, tzinfo=UTC - ) + assert dt_from_ts(1683244800.5555 * multi) == datetime(2023, 5, 5, 0, 0, 0, 555500, tzinfo=UTC) # As int assert dt_from_ts(1683244800 * multi) == datetime(2023, 5, 5, tzinfo=UTC) # As milliseconds