def test1SetBuiltinTypes( self ): """Test setting of builtin types""" from AthExHelloWorld.AthExHelloWorldConf import HelloAlg HelloWorld = HelloAlg( 'HelloWorld' ) HelloWorld.MyInt = 42 HelloWorld.MyBool = True HelloWorld.MyDouble = 3.14159 HelloWorld.MyStringVec = [ "Welcome", "to", "Athena", "Framework", "Tutorial" ] HelloWorld.MyStringVec += [ "!" ] HelloWorld.MyDict = { 'Bonjour' : 'Guten Tag', 'Good Morning' : 'Bonjour' , 'one' : 'uno' } HelloWorld.MyDict[ "Goeiedag" ] = "Ni Hao" HelloWorld.MyTable = [ ( 1 , 1 ) , ( 2 , 4 ) , ( 3 , 9 ) ] HelloWorld.MyTable += [ ( 4, 16 ) ] HelloWorld.MyMatrix = [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] HelloWorld.MyMatrix += [ [ 7, 8, 9 ] ] HelloWorld.setup() self.assertEqual( HelloWorld.MyInt, 42 ) self.assert_( JobOptionsSvc.verify( 'HelloWorld', 'MyInt', '42' ) ) self.assertEqual( HelloWorld.MyBool, True ) self.assert_( JobOptionsSvc.verify( 'HelloWorld', 'MyBool', 'True' ) ) self.assertEqual( round( HelloWorld.MyDouble - 3.14159, 8 ), 0. ) self.assert_( JobOptionsSvc.verify( 'HelloWorld', 'MyDouble', '3.14159' ) ) # the following may be too sensitive to non-consequential changes in formatting self.assertEqual( HelloWorld.MyStringVec, [ "Welcome", "to", "Athena", "Framework", "Tutorial", "!" ] ) self.assert_( JobOptionsSvc.verify( 'HelloWorld', 'MyStringVec', "['Welcome', 'to', 'Athena', 'Framework', 'Tutorial', '!']" ) ) self.assertEqual( HelloWorld.MyDict, {'Bonjour': 'Guten Tag', 'one': 'uno', 'Goeiedag': 'Ni Hao', 'Good Morning': 'Bonjour'} ) self.assert_( JobOptionsSvc.verify( 'HelloWorld', 'MyDict', "{'Bonjour': 'Guten Tag', 'one': 'uno', 'Goeiedag': 'Ni Hao', 'Good Morning': 'Bonjour'}" ) ) self.assertEqual( HelloWorld.MyTable, [(1, 1), (2, 4), (3, 9), (4, 16)] ) self.assert_( JobOptionsSvc.verify( 'HelloWorld', 'MyTable', "[(1, 1), (2, 4), (3, 9), (4, 16)]" ) ) self.assertEqual( HelloWorld.MyMatrix, [[1, 2, 3], [4, 5, 6], [7, 8, 9]] ) self.assert_( JobOptionsSvc.verify( 'HelloWorld', 'MyMatrix', "[[1, 2, 3], [4, 5, 6], [7, 8, 9]]" ) )
# Make MetaDataSvc an AddressProvider svcMgr.ProxyProviderSvc.ProviderNames += ["MetaDataSvc"] # enable IOVDbSvc to read metadata #svcMgr.MetaDataSvc.MetaDataContainer = "MetaDataHdr" #svcMgr.MetaDataSvc.MetaDataTools += [ "IOVDbMetaDataTool" ] MetaDataStore = svcMgr.MetaDataStore #-------------------------------------------------------------- # Private Application Configuration options, replace with # your configuration. #-------------------------------------------------------------- from AthExHelloWorld.AthExHelloWorldConf import HelloAlg HelloWorld = HelloAlg("HelloWorld") from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() topSequence += HelloWorld #-------------------------------------------------------------- # Algorithms Private Options #-------------------------------------------------------------- # For the genuine HelloWorld algorithm HelloWorld.MyInt = 42 HelloWorld.MyBool = TRUE HelloWorld.MyDouble = 3.14159 HelloWorld.MyStringVec = ["Welcome", "to", "Athena", "Framework", "Tutorial"]