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:
2021-11-09 15:21:31 +01:00
parent 3b7cc33f64
commit 3d0d779d81
2 changed files with 43 additions and 22 deletions

View File

@ -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}