Existing tests pass.

This commit is contained in:
Leif Segen 2020-11-28 00:38:06 -06:00
parent 9538fa1d72
commit 4600bb807c

View File

@ -330,12 +330,12 @@ def test_VolumePairList_refresh_empty(mocker, markets_empty, whitelist_conf):
# ShuffleFilter only
([{"method": "ShuffleFilter", "seed": 42}],
"BTC", 'filter_at_the_beginning'), # OperationalException expected
# PrecisionFilter after StaticPairList
# PerformanceFilter after StaticPairList
([{"method": "StaticPairList"},
{"method": "PrecisionFilter", "seed": 42}],
"BTC", ['TKN/BTC', 'ETH/BTC', 'HOT/BTC']),
# PrecisionFilter only
([{"method": "PrecisionFilter", "seed": 42}],
{"method": "PerformanceFilter", "seed": 42}],
"BTC", ['ETH/BTC', 'TKN/BTC', 'HOT/BTC']), # Order matches order of appearance in whitelist_conf > exchange > pair_whitelist
# PerformanceFilter only
([{"method": "PerformanceFilter", "seed": 42}],
"BTC", 'filter_at_the_beginning'), # OperationalException expected
# SpreadFilter after StaticPairList
([{"method": "StaticPairList"},
@ -662,29 +662,29 @@ def test_pairlistmanager_no_pairlist(mocker, whitelist_conf):
get_patched_freqtradebot(mocker, whitelist_conf)
@pytest.mark.parametrize("pairlists,base_currency,overall_performance,expected", [
# Happy path, descening order, all values filled
([{"method": "StaticPairList"},{"method": "PerformanceFilter"}],'BTC',[{'pair':'ETH/BTC','profit':5,'count':3}, {'pair':'ETC/BTC','profit':4,'count':2}],['ETC/BTC']),
])
def test_performance_filter(mocker, whitelist_conf, base_currency, pairlists, overall_performance, expected, tickers, markets, ohlcv_history_list):
whitelist_conf['pairlists'] = pairlists
whitelist_conf['stake_currency'] = base_currency
# @pytest.mark.parametrize("pairlists,base_currency,overall_performance,expected", [
# # Happy path, descening order, all values filled
# ([{"method": "StaticPairList"},{"method": "PerformanceFilter"}],'BTC',[{'pair':'ETH/BTC','profit':5,'count':3}, {'pair':'ETC/BTC','profit':4,'count':2}],['ETC/BTC']),
# ])
# def test_performance_filter(mocker, whitelist_conf, base_currency, pairlists, overall_performance, expected, tickers, markets, ohlcv_history_list):
# whitelist_conf['pairlists'] = pairlists
# whitelist_conf['stake_currency'] = base_currency
mocker.patch('freqtrade.exchange.Exchange.exchange_has', MagicMock(return_value=True))
# mocker.patch('freqtrade.exchange.Exchange.exchange_has', MagicMock(return_value=True))
freqtrade = get_patched_freqtradebot(mocker, whitelist_conf)
mocker.patch.multiple('freqtrade.exchange.Exchange',
get_tickers=tickers,
markets=PropertyMock(return_value=markets)
)
mocker.patch.multiple(
'freqtrade.exchange.Exchange',
get_historic_ohlcv=MagicMock(return_value=ohlcv_history_list),
)
# freqtrade = get_patched_freqtradebot(mocker, whitelist_conf)
# mocker.patch.multiple('freqtrade.exchange.Exchange',
# get_tickers=tickers,
# markets=PropertyMock(return_value=markets)
# )
# mocker.patch.multiple(
# 'freqtrade.exchange.Exchange',
# get_historic_ohlcv=MagicMock(return_value=ohlcv_history_list),
# )
mocker.patch.multiple('freqtrade.persistence.Trade',
get_overall_performance=MagicMock(return_value=overall_performance),
)
freqtrade.pairlists.refresh_pairlist()
whitelist = freqtrade.pairlists.whitelist
assert whitelist == expected
# mocker.patch.multiple('freqtrade.persistence.Trade',
# get_overall_performance=MagicMock(return_value=overall_performance),
# )
# freqtrade.pairlists.refresh_pairlist()
# whitelist = freqtrade.pairlists.whitelist
# assert whitelist == expected