change FloatRange arguments minval/maxval to min/max
in the previous version FloatRange(max=100) was neither working properly nor complaining, because the maxval=None default was overriding the value for max. possible fixes: - raise an error when min/max used as argument (confusing for the programmer, as it is a property) - allow both versions minval/maxval and min/max (more code) - use min/max and a pylint directive here (the only thing to take care is not to use the min/max builtin in __init__) this change uses the last option for the fix Change-Id: Iff0e0c4d0d7b165003bdeffa67a93a1cd7f29eea Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/31982 Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de> Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
@ -160,9 +160,9 @@ def test_ScaledInteger():
|
||||
with pytest.raises(ProgrammingError):
|
||||
ScaledInteger('xc', 'Yx')
|
||||
with pytest.raises(ProgrammingError):
|
||||
ScaledInteger(scale=0, minval=1, maxval=2)
|
||||
ScaledInteger(scale=0, min=1, max=2)
|
||||
with pytest.raises(ProgrammingError):
|
||||
ScaledInteger(scale=-10, minval=1, maxval=2)
|
||||
ScaledInteger(scale=-10, min=1, max=2)
|
||||
# check that unit can be changed
|
||||
dt.setProperty('unit', 'A')
|
||||
assert dt.export_datatype() == {'type': 'scaled', 'scale':0.01, 'min':-300, 'max':300,
|
||||
@ -563,7 +563,7 @@ def test_get_datatype():
|
||||
assert isinstance(get_datatype(
|
||||
{'type': 'scaled', 'scale':0.03, 'min':-99, 'max':111}), ScaledInteger)
|
||||
|
||||
dt = ScaledInteger(scale=0.03, minval=0, maxval=9.9)
|
||||
dt = ScaledInteger(scale=0.03, min=0, max=9.9)
|
||||
assert dt.export_datatype() == {'type': 'scaled', 'max':330, 'min':0, 'scale':0.03}
|
||||
assert get_datatype(dt.export_datatype()).export_datatype() == dt.export_datatype()
|
||||
|
||||
|
Reference in New Issue
Block a user