From d0d40f4fce96cd330a923bd837739975df7a2f13 Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 9 May 2025 06:34:33 +0200 Subject: [PATCH] test: Improve skdecimal test --- tests/optimize/test_hyperopt.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/optimize/test_hyperopt.py b/tests/optimize/test_hyperopt.py index 5226c1128..0e3d24511 100644 --- a/tests/optimize/test_hyperopt.py +++ b/tests/optimize/test_hyperopt.py @@ -1194,6 +1194,14 @@ def test_SKDecimal(): assert not space._contains(1.511) assert not space._contains(1.111222) + with pytest.raises(ValueError): + SKDecimal(1, 2, step=5, decimals=0.2) + + s = SKDecimal(1, 2, step=0.1, decimals=None) + assert s.step == 0.1 + assert s._contains(1.1) + assert not s._contains(1.11) + def test_stake_amount_unlimited_max_open_trades(mocker, hyperopt_conf, tmp_path, fee) -> None: # This test is to ensure that unlimited max_open_trades are ignored for the backtesting