From df712c01689e39965e8fef899078e0ea6b012850 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 20 Apr 2024 09:39:11 +0200 Subject: [PATCH] Fix some faulty assertions --- tests/exchange/test_exchange.py | 2 +- tests/exchange/test_okx.py | 4 ++-- tests/freqtradebot/test_freqtradebot.py | 2 +- tests/persistence/test_migrations.py | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/exchange/test_exchange.py b/tests/exchange/test_exchange.py index cb23a8742..c8293965a 100644 --- a/tests/exchange/test_exchange.py +++ b/tests/exchange/test_exchange.py @@ -5133,7 +5133,7 @@ def test_get_maintenance_ratio_and_amt( mocker.patch(f'{EXMS}.exchange_has', return_value=True) exchange = get_patched_exchange(mocker, default_conf, api_mock) 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): diff --git a/tests/exchange/test_okx.py b/tests/exchange/test_okx.py index 73f87774e..69e7e498b 100644 --- a/tests/exchange/test_okx.py +++ b/tests/exchange/test_okx.py @@ -472,7 +472,7 @@ def test_load_leverage_tiers_okx(default_conf, mocker, markets, tmp_path, caplog exchange.load_leverage_tiers() 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 ... time_machine.move_to(datetime.now() + timedelta(weeks=5)) exchange.load_leverage_tiers() @@ -500,7 +500,7 @@ def test__set_leverage_okx(mocker, default_conf): 'posSide': 'net'} api_mock.set_leverage = MagicMock(side_effect=ccxt.NetworkError()) 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()) ccxt_exceptionhandlers( diff --git a/tests/freqtradebot/test_freqtradebot.py b/tests/freqtradebot/test_freqtradebot.py index a6682fedf..e46caa8b2 100644 --- a/tests/freqtradebot/test_freqtradebot.py +++ b/tests/freqtradebot/test_freqtradebot.py @@ -3122,7 +3122,7 @@ def test_exit_profit_only( if profit_only: assert freqtrade.handle_trade(trade) is False # 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) assert freqtrade.handle_trade(trade) is handle_first diff --git a/tests/persistence/test_migrations.py b/tests/persistence/test_migrations.py index a6a107a5e..d354e8f22 100644 --- a/tests/persistence/test_migrations.py +++ b/tests/persistence/test_migrations.py @@ -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 pairlocks = PairLock.session.scalars(select(PairLock).filter(PairLock.pair == 'ETH/BTC')).all() assert len(pairlocks) == 1 - pairlocks[0].pair == 'ETH/BTC' - pairlocks[0].side == '*' + assert pairlocks[0].pair == 'ETH/BTC' + assert pairlocks[0].side == '*' @pytest.mark.parametrize('dialect', [