-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: models should not be wrapped in a ListOffsetForm (#841)
* fix:models should not be wrapped in a ListOffsetForm * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Changed test file name to match PR nr. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
d7036b4
commit 8f7bf18
Showing
2 changed files
with
31 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot4/blob/main/LICENSE | ||
import os | ||
import numpy | ||
import pytest | ||
import uproot | ||
|
||
pytest.importorskip("ROOT") | ||
|
||
|
||
def test_1(tmp_path): | ||
filename = os.path.join(tmp_path, "tfile_with_tvector3_1.root") | ||
tfile = ROOT.TFile(filename, "RECREATE") | ||
tree = ROOT.TTree("tree", "tree") | ||
tvector3 = ROOT.TVector3() | ||
tree.Branch("tvector3", tvector3) | ||
for x in range(10): | ||
tvector3.SetX(x) | ||
tree.Fill() | ||
tree.AutoSave() | ||
tfile.Close() | ||
uproot.open("tfile_with_tvector3_1.root:tree").arrays() | ||
|
||
tfile = ROOT.TFile(filename, "READ") | ||
tree = tfile.Get("tree") | ||
rdf = ROOT.RDataFrame(tree) | ||
branchlist = ROOT.std.vector(ROOT.std.string)() | ||
branchlist.push_back("tvector3") | ||
rdf.Snapshot("tree", "tfile_with_tvector3_2.root", branchlist) | ||
uproot.open("tfile_with_tvector3_2.root:tree").arrays() |