Skip to content
Snippets Groups Projects
Commit 823f184c authored by Christoph Hasse's avatar Christoph Hasse
Browse files

Add small test for GaudiPython Bindings iDataSvc + fix thanks to @clemenci

parent 03e29230
No related branches found
No related tags found
1 merge request!1178Add small test for GaudiPython.Bindings.iDataSvc
......@@ -586,7 +586,7 @@ class iDataSvc(iService):
return self.unregisterObject(path)
def leaves(self, node=cppyy.nullptr):
if not node:
if node == cppyy.nullptr:
node = self.retrieveObject('')
ll = gbl.std.vector('IRegistry*')()
if type(node) is str:
......@@ -597,7 +597,7 @@ class iDataSvc(iService):
return ll
def dump(self, node=cppyy.nullptr):
if not node:
if node == cppyy.nullptr:
root = self.retrieveObject('')
if root:
node = root.registry()
......@@ -609,7 +609,7 @@ class iDataSvc(iService):
self.dump(l)
def getList(self, node=cppyy.nullptr, lst=[], rootFID=None):
if not node:
if node == cppyy.nullptr:
root = self.retrieveObject('')
if root:
node = root.registry()
......@@ -628,7 +628,7 @@ class iDataSvc(iService):
return lst
def getHistoNames(self, node=cppyy.nullptr, lst=[]):
if not node:
if node == cppyy.nullptr:
root = self.retrieveObject('')
if root:
node = root.registry()
......
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'>
<!--
(c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations
This software is distributed under the terms of the Apache version 2 licence,
copied verbatim in the file "LICENSE".
In applying this licence, CERN does not waive the privileges and immunities
granted to it by virtue of its status as an Intergovernmental Organization
or submit itself to any jurisdiction.
-->
<extension class="GaudiTest.GaudiExeTest" kind="test">
<argument name="program"><text>python</text></argument>
<argument name="args"><set><text>../scripts/test_iDataSvc.py</text></set></argument>
</extension>
#####################################################################################
# (c) Copyright 1998-2021 CERN for the benefit of the LHCb and ATLAS collaborations #
# #
# This software is distributed under the terms of the Apache version 2 licence, #
# copied verbatim in the file "LICENSE". #
# #
# In applying this licence, CERN does not waive the privileges and immunities #
# granted to it by virtue of its status as an Intergovernmental Organization #
# or submit itself to any jurisdiction. #
#####################################################################################
import GaudiPython as GP
import cppyy
import ROOT
DO = cppyy.gbl.DataObject
objects = [DO() for i in range(52)]
# Once the object is registered the TES will clean it up
for i in objects:
ROOT.SetOwnership(i, False)
app = GP.AppMgr()
tes = app.evtsvc()
app.start()
tes.setRoot("Event", objects[51])
tes["/Event/0"] = objects[50]
path = "/Event"
for i in range(5):
path = path + "/{}".format(i)
for j in range(1, 10):
p = path + '/' + str(j)
print("Registering Object at : " + p)
if i % 2 == 0:
tes[p] = objects[i * 10 + j]
else:
tes.registerObject(p, objects[i * 10 + j])
ret = tes[p]
print("Access of {} yields {}".format(p, ret))
if not ret:
raise Exception(
"Access of path: {}, should not result in nullptr".format(p))
tes.dump()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment