1 from __future__
import absolute_import
6 from .chain
import Chain
7 from PhysicsTools.HeppyCore.utils.testtree
import create_tree
9 testfname =
'test_tree.root'
14 self.
chain = Chain(testfname,
'test_tree')
17 '''Test that the test file exists'''
18 self.assertTrue(os.path.isfile(testfname))
21 self.assertRaises(ValueError,
22 Chain,
'non_existing_file.root')
25 chain = Chain(testfname)
26 self.assertEqual(len(self.
chain), 100)
29 '''Test that the chain has the correct number of entries'''
30 self.assertEqual(len(self.
chain), 100)
33 '''Test chaining of two files.'''
34 tmpfile = testfname.replace(
'test_tree',
'test_tree_2_tmp')
35 shutil.copyfile(testfname, tmpfile)
36 chain = Chain(testfname.replace(
'.root',
'*.root'),
'test_tree')
37 self.assertEqual(len(chain), 200)
41 '''Test LFN/root-fn loading'''
42 chain = Chain([
"root://{0}".
format(os.path.abspath(testfname))],
'test_tree')
43 self.assertEqual(len(chain), 100)
52 '''Test direct event access'''
54 self.assertEqual(event.var1, 2.)
57 if __name__ ==
'__main__':