chore: autoformat tests

This commit is contained in:
Matthias
2025-07-04 09:10:14 +02:00
parent 7b541ff958
commit d010a050d3
3 changed files with 6 additions and 16 deletions

View File

@@ -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

View File

@@ -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
)

View File

@@ -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