Fix some faulty assertions

This commit is contained in:
Matthias 2024-04-20 09:39:11 +02:00
parent 53c548f7b6
commit df712c0168
4 changed files with 6 additions and 6 deletions

View File

@ -5133,7 +5133,7 @@ def test_get_maintenance_ratio_and_amt(
mocker.patch(f'{EXMS}.exchange_has', return_value=True) mocker.patch(f'{EXMS}.exchange_has', return_value=True)
exchange = get_patched_exchange(mocker, default_conf, api_mock) exchange = get_patched_exchange(mocker, default_conf, api_mock)
exchange._leverage_tiers = leverage_tiers exchange._leverage_tiers = leverage_tiers
exchange.get_maintenance_ratio_and_amt(pair, value) == (mmr, maintAmt) assert exchange.get_maintenance_ratio_and_amt(pair, value) == (mmr, maintAmt)
def test_get_max_leverage_futures(default_conf, mocker, leverage_tiers): def test_get_max_leverage_futures(default_conf, mocker, leverage_tiers):

View File

@ -472,7 +472,7 @@ def test_load_leverage_tiers_okx(default_conf, mocker, markets, tmp_path, caplog
exchange.load_leverage_tiers() exchange.load_leverage_tiers()
assert not log_has(logmsg, caplog) assert not log_has(logmsg, caplog)
api_mock.fetch_market_leverage_tiers.call_count == 0 assert api_mock.fetch_market_leverage_tiers.call_count == 0
# 2 day passes ... # 2 day passes ...
time_machine.move_to(datetime.now() + timedelta(weeks=5)) time_machine.move_to(datetime.now() + timedelta(weeks=5))
exchange.load_leverage_tiers() exchange.load_leverage_tiers()
@ -500,7 +500,7 @@ def test__set_leverage_okx(mocker, default_conf):
'posSide': 'net'} 'posSide': 'net'}
api_mock.set_leverage = MagicMock(side_effect=ccxt.NetworkError()) api_mock.set_leverage = MagicMock(side_effect=ccxt.NetworkError())
exchange._lev_prep('BTC/USDT:USDT', 3.2, 'buy') exchange._lev_prep('BTC/USDT:USDT', 3.2, 'buy')
api_mock.fetch_leverage.call_count == 1 assert api_mock.fetch_leverage.call_count == 1
api_mock.fetch_leverage = MagicMock(side_effect=ccxt.NetworkError()) api_mock.fetch_leverage = MagicMock(side_effect=ccxt.NetworkError())
ccxt_exceptionhandlers( ccxt_exceptionhandlers(

View File

@ -3122,7 +3122,7 @@ def test_exit_profit_only(
if profit_only: if profit_only:
assert freqtrade.handle_trade(trade) is False assert freqtrade.handle_trade(trade) is False
# Custom-exit is called # Custom-exit is called
freqtrade.strategy.custom_exit.call_count == 1 assert freqtrade.strategy.custom_exit.call_count == 1
patch_get_signal(freqtrade, enter_long=False, exit_short=is_short, exit_long=not is_short) patch_get_signal(freqtrade, enter_long=False, exit_short=is_short, exit_long=not is_short)
assert freqtrade.handle_trade(trade) is handle_first assert freqtrade.handle_trade(trade) is handle_first

View File

@ -436,8 +436,8 @@ def test_migrate_pairlocks(mocker, default_conf, fee, caplog):
assert len(PairLock.session.scalars(select(PairLock).filter(PairLock.pair == '*')).all()) == 1 assert len(PairLock.session.scalars(select(PairLock).filter(PairLock.pair == '*')).all()) == 1
pairlocks = PairLock.session.scalars(select(PairLock).filter(PairLock.pair == 'ETH/BTC')).all() pairlocks = PairLock.session.scalars(select(PairLock).filter(PairLock.pair == 'ETH/BTC')).all()
assert len(pairlocks) == 1 assert len(pairlocks) == 1
pairlocks[0].pair == 'ETH/BTC' assert pairlocks[0].pair == 'ETH/BTC'
pairlocks[0].side == '*' assert pairlocks[0].side == '*'
@pytest.mark.parametrize('dialect', [ @pytest.mark.parametrize('dialect', [