Merge pull request #2066 from freqtrade/hyperopt/tests
Fix some hyperopt tests
This commit is contained in:
commit
0677472c56
@ -8,7 +8,7 @@ import pytest
|
|||||||
from arrow import Arrow
|
from arrow import Arrow
|
||||||
from filelock import Timeout
|
from filelock import Timeout
|
||||||
|
|
||||||
from freqtrade import DependencyException
|
from freqtrade import DependencyException, OperationalException
|
||||||
from freqtrade.data.converter import parse_ticker_dataframe
|
from freqtrade.data.converter import parse_ticker_dataframe
|
||||||
from freqtrade.data.history import load_tickerdata_file
|
from freqtrade.data.history import load_tickerdata_file
|
||||||
from freqtrade.optimize import setup_configuration, start_hyperopt
|
from freqtrade.optimize import setup_configuration, start_hyperopt
|
||||||
@ -186,6 +186,13 @@ def test_hyperoptresolver(mocker, default_conf, caplog) -> None:
|
|||||||
assert hasattr(x, "ticker_interval")
|
assert hasattr(x, "ticker_interval")
|
||||||
|
|
||||||
|
|
||||||
|
def test_hyperoptresolver_wrongname(mocker, default_conf, caplog) -> None:
|
||||||
|
default_conf.update({'hyperopt': "NonExistingHyperoptClass"})
|
||||||
|
|
||||||
|
with pytest.raises(OperationalException, match=r'Impossible to load Hyperopt.*'):
|
||||||
|
HyperOptResolver(default_conf, ).hyperopt
|
||||||
|
|
||||||
|
|
||||||
def test_hyperoptlossresolver(mocker, default_conf, caplog) -> None:
|
def test_hyperoptlossresolver(mocker, default_conf, caplog) -> None:
|
||||||
|
|
||||||
hl = DefaultHyperOptLoss
|
hl = DefaultHyperOptLoss
|
||||||
@ -193,9 +200,15 @@ def test_hyperoptlossresolver(mocker, default_conf, caplog) -> None:
|
|||||||
'freqtrade.resolvers.hyperopt_resolver.HyperOptLossResolver._load_hyperoptloss',
|
'freqtrade.resolvers.hyperopt_resolver.HyperOptLossResolver._load_hyperoptloss',
|
||||||
MagicMock(return_value=hl)
|
MagicMock(return_value=hl)
|
||||||
)
|
)
|
||||||
x = HyperOptResolver(default_conf, ).hyperopt
|
x = HyperOptLossResolver(default_conf, ).hyperoptloss
|
||||||
assert hasattr(x, "populate_indicators")
|
assert hasattr(x, "hyperopt_loss_function")
|
||||||
assert hasattr(x, "ticker_interval")
|
|
||||||
|
|
||||||
|
def test_hyperoptlossresolver_wrongname(mocker, default_conf, caplog) -> None:
|
||||||
|
default_conf.update({'hyperopt_loss': "NonExistingLossClass"})
|
||||||
|
|
||||||
|
with pytest.raises(OperationalException, match=r'Impossible to load HyperoptLoss.*'):
|
||||||
|
HyperOptLossResolver(default_conf, ).hyperopt
|
||||||
|
|
||||||
|
|
||||||
def test_start(mocker, default_conf, caplog) -> None:
|
def test_start(mocker, default_conf, caplog) -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user