Skip to content
Snippets Groups Projects
Commit 099cad68 authored by Marco Clemencic's avatar Marco Clemencic
Browse files

consistent repr for Python Configurables

fixes GAUDI-1290

See merge request !285
parents 09859bd6 1dd79b2d
No related branches found
No related tags found
1 merge request!285consistent repr for Python Configurables
Pipeline #
......@@ -193,3 +193,7 @@ gaudi_add_test(WriteAndReadHandleError
gaudi_add_test(WriteAndReadHandleWhiteBoard
FRAMEWORK options/ROOT_IO/WriteAndReadHandleWhiteBoard.py)
gaudi_add_test(nose
COMMAND nosetests -v
${CMAKE_CURRENT_SOURCE_DIR}/tests/nose)
def test_repr():
import Configurables
assert repr(Configurables.TupleAlg('A')) == "TupleAlg('A')"
assert repr(Configurables.ToolSvc('B')) == "ToolSvc('B')"
assert repr(Configurables.TestTool('C')) == "TestTool('ToolSvc.C')"
assert repr(Configurables.Gaudi__Examples__EvtColAlg()) == "Gaudi__Examples__EvtColAlg('Gaudi::Examples::EvtColAlg')"
assert repr(Configurables.Gaudi_Test_MySuperAlg()) == "Gaudi_Test_MySuperAlg('Gaudi_Test_MySuperAlg')"
......@@ -842,6 +842,9 @@ class Configurable( object ):
postLen = max(preLen,postLen)
return indentStr + '\\%s (End of %s) %s' % (preLen*'-',title,postLen*'-')
def __repr__(self):
return '{0}({1!r})'.format(self.__class__.__name__, self.name())
def __str__( self, indent = 0, headerLastIndentUnit=indentUnit ):
global log # to print some info depending on output level
indentStr = indent*Configurable.indentUnit
......@@ -1001,9 +1004,6 @@ class ConfigurableAlgorithm( Configurable ):
def getJobOptName( self ):
return self._jobOptName
def __repr__(self):
return '{0}({1!r})'.format(self.getType(), self.name())
# mimick the ControlFlowLeaf interface
def __and__(self, rhs):
if rhs is CFTrue:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment