def test_ttree_uproot(tmp_path): filename = join(str(tmp_path), "example.root") tree = newtree() with uproot.recreate(filename, compression=None) as f: f["t"] = tree f = uproot.open(filename) assert f["t"]._classname == b"TTree"
def test_ttree(tmp_path): filename = join(str(tmp_path), "example.root") tree = newtree() with uproot.recreate(filename, compression=None) as f: f["t"] = tree f = ROOT.TFile.Open(filename) assert f.GetKey("t").GetClassName() == "TTree"
def test_ttree_empty_tbranch_title(tmp_path): filename = join(str(tmp_path), "example.root") b = newbranch("int32", title="hi") branchdict = {"intBranch": b} tree = newtree(branchdict) with uproot.recreate(filename, compression=None) as f: f["t"] = tree f = ROOT.TFile.Open(filename) assert f.Get("t").GetBranch("intBranch").GetTitle() == "hi"
def test_ttree_empty_tbranch_uproot(tmp_path): filename = join(str(tmp_path), "example.root") b = newbranch("int32") branchdict = {"intBranch": b} tree = newtree(branchdict) with uproot.recreate(filename, compression=None) as f: f["t"] = tree f = uproot.open(filename) assert f["t"]["intBranch"]._classname == b"TBranch"
def test_ttree_multiple_uproot(tmp_path): filename = join(str(tmp_path), "example.root") tree = newtree() with uproot.recreate(filename, compression=None) as f: for i in range(100): f["t" * (i + 1)] = tree f = uproot.open(filename) for i in range(100): assert f["t" * (i + 1)]._classname == b"TTree"
def test_ttree_multiple(tmp_path): filename = join(str(tmp_path), "example.root") tree = newtree() with uproot.recreate(filename, compression=None) as f: for i in range(100): f["t" * (i + 1)] = tree f = ROOT.TFile.Open(filename) for i in range(100): assert f.GetKey("t" * (i + 1)).GetClassName() == "TTree"
def test_ttree_empty_tbranch_multitree(tmp_path): filename = join(str(tmp_path), "example.root") b = newbranch("int32") branchdict = {"intBranch": b} tree = newtree(branchdict) with uproot.recreate(filename, compression=None) as f: for i in range(100): f["t" * (i + 1)] = tree f = ROOT.TFile.Open(filename) for i in range(100): assert f.Get("t" * (i + 1)).GetBranch("intBranch").GetName() == "intBranch"
def test_empty_ttree_rewrite_root(tmp_path): filename = join(str(tmp_path), "example.root") b = newbranch("int32") branchdict = {"intBranch": b} tree = newtree(branchdict) with uproot.recreate(filename, compression=None) as f: f["t"] = tree f = ROOT.TFile.Open(filename, "UPDATE") t = ROOT.TObjString("Hello World") t.Write() f.Close() f = ROOT.TFile.Open(filename) assert f.Get("Hello World") == "Hello World"