Commit 2915c617 authored by Alex Pearce's avatar Alex Pearce
Browse files

Extend GaudiConfig2 configurable to match Configurables API.

parent 46f979b2
Pipeline #2760217 passed with stages
in 25 minutes and 39 seconds
......@@ -237,8 +237,13 @@ class Configurable(ConfigMetaHelper):
def is_property_set(self, propname):
return self._descriptors[propname].__is_set__(self, type(self))
def getGaudiType(self):
return self.__component_type__
def getGaudiType(cls):
return cls.__component_type__
def getType(cls):
return cls.__cpp_type__
def getName(self):
......@@ -249,6 +254,14 @@ class Configurable(ConfigMetaHelper):
def toStringProperty(self):
return "{}/{}".format(self.__cpp_type__,
def getDefaultProperties(cls):
return {k: v.default for k, v in cls._descriptors.items()}
def getDefaultProperty(cls, name):
return cls._descriptors[name].default
def merge(self, other):
Merge the properties of the other instance into the current one.
......@@ -75,6 +75,14 @@ def test_configurable():
assert a.toStringProperty() == MyAlg.__cpp_type__ + '/abc'
assert MyAlg.getGaudiType() == 'Algorithm'
assert MyAlg.getType() == 'TestConf::MyAlg'
assert MyAlg.getDefaultProperty("AStringProp") == 'text'
assert MyAlg.getDefaultProperties()['ABoolProp'] == False
def test_properties():
p = MyAlg()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment