def setUp(self): self.fname = create_tree() self.fname2 = self.fname.replace(".root", "_2.root") shutil.copy(self.fname, self.fname2) rootfile = TFile(self.fname) self.nevents = rootfile.Get("test_tree").GetEntries() self.outdir = tempfile.mkdtemp() logging.disable(logging.CRITICAL)
def setUp(self): self.fname = create_tree() self.fname2 = self.fname.replace('.root', '_2.root') shutil.copy(self.fname, self.fname2) rootfile = TFile(self.fname) self.nevents = rootfile.Get('test_tree').GetEntries() self.outdir = tempfile.mkdtemp() logging.disable(logging.CRITICAL)
def setUp(self): self.fname = create_tree() rootfile = TFile(self.fname) self.nevents = rootfile.Get('test_tree').GetEntries() self.outdir = tempfile.mkdtemp() logging.disable(logging.CRITICAL)
from heppy.utils.testtree import create_tree create_tree()
def setUp(self): self.fname = create_tree() rootfile = TFile(self.fname) self.nevents = rootfile.Get('test_tree').GetEntries() self.chain = Chain(testfname, 'test_tree')
from heppy.utils.testtree import create_tree if __name__ == "__main__": import sys import pdb pdb.set_trace() if len(sys.argv) == 2: nentries = sys.argv[1] create_tree(nentries=nentries) else: create_tree()
chain = Chain(testfname) self.assertEqual(len(self.chain), 100) def test_load_1(self): '''Test that the chain has the correct number of entries''' self.assertEqual(len(self.chain), 100) def test_load_2(self): '''Test chaining of two files.''' tmpfile = testfname.replace('test_tree', 'test_tree_2_tmp') shutil.copyfile(testfname, tmpfile) chain = Chain(testfname.replace('.root', '*.root'), 'test_tree') self.assertEqual(len(chain), 200) os.remove(tmpfile) def test_iterate(self): '''Test iteration''' for ev in self.chain: pass self.assertTrue(True) def test_get(self): '''Test direct event access''' event = self.chain[2] self.assertEqual(event.var1, 2.) if __name__ == '__main__': create_tree(testfname) unittest.main()
from heppy.utils.testtree import create_tree if __name__ == "__main__": import sys if len(sys.argv) == 2: nentries = sys.argv[1] create_tree(nentries=nentries) else: create_tree()
def setUp(self): self.fname = create_tree() rootfile = TFile(self.fname) self.events = Events(testfname, 'test_tree')
def setUp(self): self.fname = create_tree() rootfile = TFile(self.fname) self.nevents = rootfile.Get('test_tree').GetEntries() self.outdir = 'Out_test'