Skip to content
This repository was archived by the owner on Jan 7, 2023. It is now read-only.

Commit 38cb226

Browse files
committed
test truncated expressions
1 parent 98f7369 commit 38cb226

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

root_numpy/tests/test_tree.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,8 @@ def check_truncate_impute(filename):
513513
fields_md = list(set(object_fields) - set(fields_1d))
514514
assert_true(fields_1d)
515515
assert_true(fields_md)
516+
fields_1d.sort()
517+
fields_md.sort()
516518

517519
rfile = ROOT.TFile.Open(filename)
518520
tree = rfile.Get(rnp.list_trees(filename)[0])
@@ -542,6 +544,12 @@ def check_truncate_impute(filename):
542544
# can only truncate 1d arrays
543545
assert_raises(TypeError, func, arg, branches=(fields_md[0], 0))
544546

547+
# expressions
548+
arr1 = func(arg, branches='{0}==0'.format(fields_1d[0]))
549+
assert_equal(arr1.dtype, 'O')
550+
arr2 = func(arg, branches=('{0}==0'.format(fields_1d[0]), 0))
551+
assert_equal(arr2.dtype, arr1[0].dtype)
552+
545553

546554
def test_truncate_impute():
547555
for filename in ['vector.root', 'vary1.root']:

0 commit comments

Comments
 (0)