add tests for IntParameter.range

This commit is contained in:
Matthias
2021-04-24 07:18:35 +02:00
parent 90476c4287
commit 5c7f278c8a
3 changed files with 19 additions and 0 deletions

View File

@@ -588,6 +588,14 @@ def test_hyperopt_parameters():
intpar = IntParameter(low=0, high=5, default=1, space='buy')
assert intpar.value == 1
assert isinstance(intpar.get_space(''), Integer)
assert isinstance(intpar.range, range)
assert len(list(intpar.range)) == 1
# Range contains ONLY the default / value.
assert list(intpar.range) == [intpar.value]
intpar.hyperopt = True
assert len(list(intpar.range)) == 6
assert list(intpar.range) == [0, 1, 2, 3, 4, 5]
fltpar = RealParameter(low=0.0, high=5.5, default=1.0, space='buy')
assert isinstance(fltpar.get_space(''), Real)