Update test for fixed pandas behavior
This commit is contained in:
@@ -1022,22 +1022,22 @@ def test_auto_hyperopt_interface_loadparams(default_conf, mocker, caplog):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('function,raises', [
|
@pytest.mark.parametrize('function,raises', [
|
||||||
('populate_entry_trend', True),
|
('populate_entry_trend', False),
|
||||||
('advise_entry', False),
|
('advise_entry', False),
|
||||||
('populate_exit_trend', True),
|
('populate_exit_trend', False),
|
||||||
('advise_exit', False),
|
('advise_exit', False),
|
||||||
])
|
])
|
||||||
def test_pandas_warning_direct(ohlcv_history, function, raises):
|
def test_pandas_warning_direct(ohlcv_history, function, raises, recwarn):
|
||||||
|
|
||||||
df = _STRATEGY.populate_indicators(ohlcv_history, {'pair': 'ETH/BTC'})
|
df = _STRATEGY.populate_indicators(ohlcv_history, {'pair': 'ETH/BTC'})
|
||||||
if raises:
|
if raises:
|
||||||
with pytest.warns(FutureWarning):
|
assert len(recwarn) == 1
|
||||||
# Test for Future warning
|
# https://github.com/pandas-dev/pandas/issues/56503
|
||||||
# FutureWarning: Setting an item of incompatible dtype is
|
# Fixed in 2.2.x
|
||||||
# deprecated and will raise in a future error of pandas
|
getattr(_STRATEGY, function)(df, {'pair': 'ETH/BTC'})
|
||||||
# https://github.com/pandas-dev/pandas/issues/56503
|
|
||||||
getattr(_STRATEGY, function)(df, {'pair': 'ETH/BTC'})
|
|
||||||
else:
|
else:
|
||||||
|
assert len(recwarn) == 0
|
||||||
|
|
||||||
getattr(_STRATEGY, function)(df, {'pair': 'ETH/BTC'})
|
getattr(_STRATEGY, function)(df, {'pair': 'ETH/BTC'})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user