make datatypes immutable
in order to prevent modifying parameters without automatically trigger updates, all datatypes must be immutable. TupleOf and ArrayOf: change from list to tuple StructOf: use ImmutableDict most existing code should work properly, the only thing to consider are equality comparisons with lists, which will result to False all the time the changes in secop_psi/ppms.py (using tuples instead of lists for status values) are not really necessary, but lead to less confusing code Change-Id: I181f412b5cd55af296b2e5120af82449beb03f54 Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/22972 Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de> Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de> Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
@ -156,7 +156,7 @@ def test_ModuleMeta():
|
||||
|
||||
# check for inital updates working properly
|
||||
o1 = Newclass1('o1', logger, {'.description':''}, srv)
|
||||
expectedBeforeStart = {'target': 0.0, 'status': [Drivable.Status.IDLE, ''],
|
||||
expectedBeforeStart = {'target': 0.0, 'status': (Drivable.Status.IDLE, ''),
|
||||
'param1': False, 'param2': 1.0, 'a1': 0.0, 'a2': True, 'pollinterval': 5.0,
|
||||
'value': 'first'}
|
||||
assert updates.pop('o1') == expectedBeforeStart
|
||||
@ -165,7 +165,7 @@ def test_ModuleMeta():
|
||||
o1.startModule(event.set)
|
||||
event.wait()
|
||||
# should contain polled values
|
||||
expectedAfterStart = {'status': [Drivable.Status.IDLE, ''],
|
||||
expectedAfterStart = {'status': (Drivable.Status.IDLE, ''),
|
||||
'value': 'second'}
|
||||
assert updates.pop('o1') == expectedAfterStart
|
||||
|
||||
|
Reference in New Issue
Block a user