Create a number with bounds (0,1] and verify that Number respects the bounds:
>>> import param
>>> class Q(param.Parameterized):
... n = param.Number(default=0.5, bounds=(0,1), inclusive_bounds=(False,True))
...
>>> q = Q()
>>> q.n=0
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "param\__init__.py", line 563, in __set__
if not callable(val): self._check_value(val)
File "param\__init__.py", line 671, in _check_value
self._checkBounds(val)
File "param\__init__.py", line 643, in _checkBounds
raise ValueError("Parameter '%s' must be greater than %s"%(self._attrib_name,vmin))
ValueError: Parameter 'n' must be greater than 0
>>> q.n=1
But Number's crop_to_bounds (and hence set_in_bounds) does not respect exclusive bounds:
>>> q.params()['n'].crop_to_bounds(0)
0
>>> q.params()['n'].crop_to_bounds(1)
1
Create a number with bounds (0,1] and verify that Number respects the bounds:
But Number's
crop_to_bounds(and henceset_in_bounds) does not respect exclusive bounds: