fix parameter inheritance using MRO
+ no update on unhchanged values within 1 sec Change-Id: I3e3d50bb5541e8d4da2badc3133d243dd0a3b892
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 A(HasProperties):
|
||||
p = Property('base', StringType(), 'base', export='always')
|
||||
|
||||
class B(A):
|
||||
pass
|
||||
|
||||
class C(A):
|
||||
p = Property('sub', FloatRange(), extname='p')
|
||||
|
||||
class D(C, B):
|
||||
p = 1
|
||||
|
||||
class E(B, C):
|
||||
p = 2
|
||||
|
||||
assert B().exportProperties() == {'_p': 'base'}
|
||||
assert D().exportProperties() == {'p': 1.0}
|
||||
# in an older implementation the following would fail, as B.p is constructed first
|
||||
# and then B.p overrides C.p
|
||||
assert E().exportProperties() == {'p': 2.0}
|
||||
|
Reference in New Issue
Block a user