Skip to content

Commit 9f021cb

Browse files
committed
test: remove combined test
1 parent bf615e4 commit 9f021cb

File tree

1 file changed

+1
-93
lines changed

1 file changed

+1
-93
lines changed

tests/strategy/test_strategy_parameters.py

Lines changed: 1 addition & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -15,97 +15,6 @@
1515
)
1616

1717

18-
def test_hyperopt_parameters():
19-
HyperoptStateContainer.set_state(HyperoptState.INDICATORS)
20-
from optuna.distributions import CategoricalDistribution, FloatDistribution, IntDistribution
21-
22-
from freqtrade.optimize.space import SKDecimal
23-
24-
with pytest.raises(OperationalException, match=r"Name is determined.*"):
25-
IntParameter(low=0, high=5, default=1, name="hello")
26-
27-
with pytest.raises(OperationalException, match=r"IntParameter space must be.*"):
28-
IntParameter(low=0, default=5, space="buy")
29-
30-
with pytest.raises(OperationalException, match=r"RealParameter space must be.*"):
31-
RealParameter(low=0, default=5, space="buy")
32-
33-
with pytest.raises(OperationalException, match=r"DecimalParameter space must be.*"):
34-
DecimalParameter(low=0, default=5, space="buy")
35-
36-
with pytest.raises(OperationalException, match=r"IntParameter space invalid\."):
37-
IntParameter([0, 10], high=7, default=5, space="buy")
38-
39-
with pytest.raises(OperationalException, match=r"RealParameter space invalid\."):
40-
RealParameter([0, 10], high=7, default=5, space="buy")
41-
42-
with pytest.raises(OperationalException, match=r"DecimalParameter space invalid\."):
43-
DecimalParameter([0, 10], high=7, default=5, space="buy")
44-
45-
with pytest.raises(OperationalException, match=r"CategoricalParameter space must.*"):
46-
CategoricalParameter(["aa"], default="aa", space="buy")
47-
48-
with pytest.raises(TypeError):
49-
BaseParameter(opt_range=[0, 1], default=1, space="buy")
50-
51-
intpar = IntParameter(low=0, high=5, default=1, space="buy")
52-
assert intpar.value == 1
53-
assert isinstance(intpar.get_space(""), IntDistribution)
54-
assert isinstance(intpar.range, range)
55-
assert len(list(intpar.range)) == 1
56-
# Range contains ONLY the default / value.
57-
assert list(intpar.range) == [intpar.value]
58-
intpar.in_space = True
59-
60-
assert len(list(intpar.range)) == 6
61-
assert list(intpar.range) == [0, 1, 2, 3, 4, 5]
62-
63-
fltpar = RealParameter(low=0.0, high=5.5, default=1.0, space="buy")
64-
assert fltpar.value == 1
65-
assert isinstance(fltpar.get_space(""), FloatDistribution)
66-
67-
fltpar = DecimalParameter(low=0.0, high=0.5, default=0.14, decimals=1, space="buy")
68-
assert fltpar.value == 0.1
69-
assert isinstance(fltpar.get_space(""), SKDecimal)
70-
assert isinstance(fltpar.range, list)
71-
assert len(list(fltpar.range)) == 1
72-
# Range contains ONLY the default / value.
73-
assert list(fltpar.range) == [fltpar.value]
74-
fltpar.in_space = True
75-
assert len(list(fltpar.range)) == 6
76-
assert list(fltpar.range) == [0.0, 0.1, 0.2, 0.3, 0.4, 0.5]
77-
78-
catpar = CategoricalParameter(
79-
["buy_rsi", "buy_macd", "buy_none"], default="buy_macd", space="buy"
80-
)
81-
assert catpar.value == "buy_macd"
82-
assert isinstance(catpar.get_space(""), CategoricalDistribution)
83-
assert isinstance(catpar.range, list)
84-
assert len(list(catpar.range)) == 1
85-
# Range contains ONLY the default / value.
86-
assert list(catpar.range) == [catpar.value]
87-
catpar.in_space = True
88-
assert len(list(catpar.range)) == 3
89-
assert list(catpar.range) == ["buy_rsi", "buy_macd", "buy_none"]
90-
91-
boolpar = BooleanParameter(default=True, space="buy")
92-
assert boolpar.value is True
93-
assert isinstance(boolpar.get_space(""), CategoricalDistribution)
94-
assert isinstance(boolpar.range, list)
95-
assert len(list(boolpar.range)) == 1
96-
97-
boolpar.in_space = True
98-
assert len(list(boolpar.range)) == 2
99-
100-
assert list(boolpar.range) == [True, False]
101-
102-
HyperoptStateContainer.set_state(HyperoptState.OPTIMIZE)
103-
assert len(list(intpar.range)) == 1
104-
assert len(list(fltpar.range)) == 1
105-
assert len(list(catpar.range)) == 1
106-
assert len(list(boolpar.range)) == 1
107-
108-
10918
def test_hyperopt_int_parameter():
11019
from optuna.distributions import IntDistribution
11120

@@ -150,8 +59,7 @@ def test_hyperopt_real_parameter():
15059
assert fltpar.value == 1.0
15160
assert isinstance(fltpar.get_space(""), FloatDistribution)
15261

153-
HyperoptStateContainer.set_state(HyperoptState.OPTIMIZE)
154-
# assert len(list(fltpar.range)) == 1
62+
assert not hasattr(fltpar, "range")
15563

15664

15765
def test_hyperopt_decimal_parameter():

0 commit comments

Comments
 (0)