fix some remaining py3 incompatibilites
- None <= 0 is invalid in py3 - restrict BLOBType to bytes (may be changed after migration to py3) - remove long - use list(<dict>.items()) when dict is changed within loop - allow initialization of properties in HasProperties without supercall to base class - <dict>.values() can not be indexed - adapted/removed various tests. additional tests might be added after definitive migration to py3 after this change, all the tests run with py3, also secop-server and secop-gui were tested with an example, but other code might still contain py3 incompatibilities Change-Id: I881c6972aeabb8494a21a6cbc7ffeddfd4f5d4f8 Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/21306 Tested-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de> Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de> Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch> Reviewed-by: Bjoern Pedersen <bjoern.pedersen@frm2.tum.de>
This commit is contained in:
@ -47,16 +47,15 @@ V_test_Property = [
|
||||
[(IntRange(), 0, '', False, False),
|
||||
dict(default=0, extname='', export=False, mandatory=False)],
|
||||
[(IntRange(), None, '', False, False),
|
||||
dict(default=None, extname='', export=False, mandatory=True)], # 'normal types + no default -> mandatory
|
||||
dict(default=0, extname='', export=False, mandatory=True)], # 'normal types + no default -> mandatory
|
||||
[(ValueType(), None, '', False, False),
|
||||
dict(default=None, extname='', export=False, mandatory=False)], # 'special type + no default -> NOT mandatory
|
||||
]
|
||||
def test_Property():
|
||||
for entry in V_test_Property:
|
||||
args, check = entry
|
||||
p = Property('', *args)
|
||||
for k,v in check.items():
|
||||
assert getattr(p, k) == v
|
||||
@pytest.mark.parametrize('args, check', V_test_Property)
|
||||
def test_Property(args, check):
|
||||
p = Property('', *args)
|
||||
for k,v in check.items():
|
||||
assert getattr(p, k) == v
|
||||
|
||||
def test_Property_basic():
|
||||
with pytest.raises(TypeError):
|
||||
|
Reference in New Issue
Block a user