Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions bindings/pyroot/pythonizations/test/ttree_iterable.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,45 +64,45 @@ def get_ntuples(self):

# Tests
def test_basic_type_branch(self):
f,t,c = self.get_tree_and_chain()
_,t,c = self.get_tree_and_chain()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is correct here. Don't we need to keep the file around explicitly because it's the owner of t and c?


for ds in t,c:
n = array('f', [ 0. ])
ds.SetBranchAddress('floatb', n)

i = 0
for entry in ds:
for _ in ds:
self.assertEqual(n[0], i+self.more)
i = (i + 1) % self.nentries

def test_array_branch(self):
f,t,c = self.get_tree_and_chain()
_,t,c = self.get_tree_and_chain()

for ds in t,c:
a = array('d', self.arraysize*[ 0. ])
ds.SetBranchAddress('arrayb', a)

i = 0
for entry in ds:
for _ in ds:
for j in range(self.arraysize):
self.assertEqual(a[j], i+j)
i = (i + 1) % self.nentries

def test_struct_branch(self):
f,t,c = self.get_tree_and_chain()
_,t,c = self.get_tree_and_chain()

for ds in t,c:
ms = ROOT.MyStruct()
ds.SetBranchAddress('structleaflistb', ms)

i = 0
for entry in ds:
for _ in ds:
self.assertEqual(ms.myint1, i+self.more)
self.assertEqual(ms.myint2, i*self.more)
i = (i + 1) % self.nentries

def test_ntuples(self):
f,nt,ntd = self.get_ntuples()
_,nt,ntd = self.get_ntuples()

colnames = ['x','y','z']
cols = [ array('f', [ 0. ]) for _ in colnames ]
Expand All @@ -115,7 +115,7 @@ def test_ntuples(self):

numentry = 0

for entry in ds:
for _ in ds:
for i in range(ncols):
self.assertEqual(cs[i][0], numentry + i*self.more)
numentry += 1
Expand Down
Loading