From aabda8d4f17255a48dd9478874cdf430d96a22e7 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 5 Mar 2026 06:40:04 +0100 Subject: [PATCH] test: simplify test --- tests/plugins/test_pairlist.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/tests/plugins/test_pairlist.py b/tests/plugins/test_pairlist.py index c36a0435a..5d43e912f 100644 --- a/tests/plugins/test_pairlist.py +++ b/tests/plugins/test_pairlist.py @@ -2736,14 +2736,13 @@ def test_CrossMarketPairList_breaks_prefix_loop_on_match(mocker, default_conf_us mocker.patch.object(pl, "get_base_list", return_value=["1000PEPE"]) mocker.patch.object(pl._exchange, "get_pair_base_currency", return_value="PEPE") - class PrefixesWithGuard: - def __iter__(self): - yield "1000" # first prefix => match via "1000PEPE" - raise AssertionError("Prefix loop did not break after match") + def prefix_generator(): + yield "1000" # first prefix => match via "1000PEPE" + raise AssertionError("Prefix loop did not break after match") mocker.patch( "freqtrade.plugins.pairlist.CrossMarketPairList.PairPrefixes", - new=PrefixesWithGuard(), + new=prefix_generator(), ) result = pl.filter_pairlist(["PEPE/USDT"], {}) @@ -2772,15 +2771,14 @@ def test_CrossMarketPairList_breaks_prefix_loop_on_delayed_match( mocker.patch.object(pl, "get_base_list", return_value=["PEPE"]) mocker.patch.object(pl._exchange, "get_pair_base_currency", return_value="1000PEPE") - class PrefixesWithGuard: - def __iter__(self): - yield "X" # no match, loop should continue - yield "1000" # second path should match via removeprefix -> PEPE and break - raise AssertionError("Prefix loop did not break after delayed match") + def prefix_generator(): + yield "X" # no match, loop should continue + yield "1000" # second path should match via removeprefix -> PEPE and break + raise AssertionError("Prefix loop did not break after delayed match") mocker.patch( "freqtrade.plugins.pairlist.CrossMarketPairList.PairPrefixes", - new=PrefixesWithGuard(), + new=prefix_generator(), ) result = pl.filter_pairlist(["1000PEPE/USDT"], {})