fix property inheritance
+ remove obsolete filterDescriptor method + copying properties should support extensions (e.g. Attached) Change-Id: I301947a4ae28fcad98250b277c6b0e7e0100eaf9 Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/27084 Tested-by: Jenkins Automated Tests <pedersen+jenkins@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:
@ -159,3 +159,26 @@ def test_Property_override():
|
||||
a = 's'
|
||||
|
||||
assert 'can not set' in str(e.value)
|
||||
|
||||
|
||||
def test_Properties_mro():
|
||||
class Base(HasProperties):
|
||||
prop = Property('base', StringType(), 'base', export='always')
|
||||
|
||||
class SubA(Base):
|
||||
pass
|
||||
|
||||
class SubB(Base):
|
||||
prop = Property('sub', FloatRange(), extname='prop')
|
||||
|
||||
class FinalBA(SubB, SubA):
|
||||
prop = 1
|
||||
|
||||
class FinalAB(SubA, SubB):
|
||||
prop = 2
|
||||
|
||||
assert SubA().exportProperties() == {'_prop': 'base'}
|
||||
assert FinalBA().exportProperties() == {'prop': 1.0}
|
||||
# in an older implementation the following would fail, as SubA.p is constructed first
|
||||
# and then SubA.p overrides SubB.p
|
||||
assert FinalAB().exportProperties() == {'prop': 2.0}
|
||||
|
Reference in New Issue
Block a user