@@ -115,30 +115,34 @@ def test_keep_tree(tmp_path):
115
115
"z1" : np .array ([3 , 77 , 3 , 4 , 5 ]),
116
116
"p1" : np .array ([44 , 55 , 66 , 7 , 8 ]),
117
117
}
118
- with uproot .open (Path (tmp_path ) / "two_trees.root" ) as file :
119
- hepconvert .copy_root (
120
- Path (tmp_path ) / "copied.root" ,
121
- Path (tmp_path ) / "two_trees.root" ,
122
- keep_trees = "tree" ,
123
- force = True ,
124
- )
125
- with uproot .open (Path (tmp_path ) / "copied.root" ) as copy :
126
- assert copy .keys (cycle = False ) == ["tree" ]
127
- for tree in copy .keys (cycle = False ):
128
- for key in copy [tree ].keys ():
129
- assert ak .all (copy [tree ][key ].array () == file [tree ][key ].array ())
130
118
131
- hepconvert .copy_root (
132
- Path (tmp_path ) / "copied.root" ,
133
- Path (tmp_path ) / "two_trees.root" ,
134
- keep_trees = ["tree" , "tree2" , "tree3" ],
135
- force = True ,
136
- )
137
- with uproot .open (Path (tmp_path ) / "copied.root" ) as copy :
138
- assert copy .keys (cycle = False ) == ["tree" , "tree2" , "tree3" ]
139
- for tree in copy .keys (cycle = False ):
140
- for key in copy [tree ].keys ():
141
- assert ak .all (copy [tree ][key ].array () == file [tree ][key ].array ())
119
+ hepconvert .copy_root (
120
+ Path (tmp_path ) / "copied.root" ,
121
+ Path (tmp_path ) / "two_trees.root" ,
122
+ keep_trees = "tree" ,
123
+ force = True ,
124
+ )
125
+ with uproot .open (Path (tmp_path ) / "copied.root" ) as copy , uproot .open (
126
+ Path (tmp_path ) / "two_trees.root"
127
+ ) as file :
128
+ assert copy .keys (cycle = False ) == ["tree" ]
129
+ for tree in copy .keys (cycle = False ):
130
+ for key in copy [tree ].keys ():
131
+ assert ak .all (copy [tree ][key ].array () == file [tree ][key ].array ())
132
+
133
+ hepconvert .copy_root (
134
+ Path (tmp_path ) / "copied.root" ,
135
+ Path (tmp_path ) / "two_trees.root" ,
136
+ keep_trees = ["tree" , "tree2" , "tree3" ],
137
+ force = True ,
138
+ )
139
+ with uproot .open (Path (tmp_path ) / "copied.root" ) as copy , uproot .open (
140
+ Path (tmp_path ) / "two_trees.root"
141
+ ) as file :
142
+ assert copy .keys (cycle = False ) == ["tree" , "tree2" , "tree3" ]
143
+ for tree in copy .keys (cycle = False ):
144
+ for key in copy [tree ].keys ():
145
+ assert ak .all (copy [tree ][key ].array () == file [tree ][key ].array ())
142
146
143
147
with pytest .raises (
144
148
ValueError ,
0 commit comments