fix command inheritance

Command.ownProperties must be definead in __init__

+ add test for this

Change-Id: I283331be6439a49ec61d28f04869a5b44704236f
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/27104
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-10 17:54:31 +01:00
parent b8e8d24b50
commit 796be752b7
2 changed files with 28 additions and 1 deletions

View File

@ -103,3 +103,30 @@ def test_Export():
class Mod(HasAccessibles):
param = Parameter('description1', datatype=BoolType, default=False)
assert Mod.param.export == '_param'
def test_Command_Inheritance():
class Base(HasAccessibles):
@Command(BoolType(), visibility=2)
def cmd(self, arg):
"""first"""
class Sub(Base):
@Command(group='grp')
def cmd(self, arg):
"""second"""
class Sub2(Base):
@Command(FloatRange())
def cmd(self, arg):
"""third"""
assert Sub.accessibles['cmd'].for_export() == {
'description': 'second', 'group': 'grp', 'visibility': 2,
'datainfo': {'type': 'command', 'argument': {'type': 'bool'}}
}
assert Sub2.accessibles['cmd'].for_export() == {
'description': 'third', 'visibility': 2,
'datainfo': {'type': 'command', 'argument': {'type': 'double'}}
}