Apply ruff formatting to ws branch

This commit is contained in:
Matthias
2024-05-14 06:35:49 +02:00
parent cabd36253e
commit f33c4db572
4 changed files with 28 additions and 31 deletions

View File

@@ -20,15 +20,14 @@ from tests.exchange_online.conftest import EXCHANGE_WS_FIXTURE_TYPE
@pytest.mark.longrun
class TestCCXTExchangeWs:
def test_ccxt_ohlcv(self, exchange_ws: EXCHANGE_WS_FIXTURE_TYPE, caplog, mocker):
exch, exchangename, pair = exchange_ws
assert exch._ws_async is not None
timeframe = '1m'
timeframe = "1m"
pair_tf = (pair, timeframe, CandleType.SPOT)
m_hist = mocker.spy(exch, '_async_get_historic_ohlcv')
m_cand = mocker.spy(exch, '_async_get_candle_history')
m_hist = mocker.spy(exch, "_async_get_historic_ohlcv")
m_cand = mocker.spy(exch, "_async_get_candle_history")
res = exch.refresh_latest_ohlcv([pair_tf])
assert m_cand.call_count == 1
@@ -45,7 +44,7 @@ class TestCCXTExchangeWs:
df1 = res[pair_tf]
caplog.set_level(logging.DEBUG)
set_loggers(1)
assert df1.iloc[-1]['date'] == curr_candle
assert df1.iloc[-1]["date"] == curr_candle
# Wait until the next candle (might be up to 1 minute).
while True:
@@ -53,9 +52,9 @@ class TestCCXTExchangeWs:
res = exch.refresh_latest_ohlcv([pair_tf])
df2 = res[pair_tf]
assert df2 is not None
if df2.iloc[-1]['date'] == next_candle:
if df2.iloc[-1]["date"] == next_candle:
break
assert df2.iloc[-1]['date'] == curr_candle
assert df2.iloc[-1]["date"] == curr_candle
sleep(1)
assert m_hist.call_count == 0