5 from chain
import Chain
6 from PhysicsTools.HeppyCore.utils.testtree
import create_tree
8 testfname =
'test_tree.root'
16 '''Test that the test file exists'''
17 self.assertTrue(os.path.isfile(testfname))
20 self.assertRaises(ValueError,
21 Chain,
'non_existing_file.root')
24 chain =
Chain(testfname)
25 self.assertEqual(len(self.
chain), 100)
28 '''Test that the chain has the correct number of entries'''
29 self.assertEqual(len(self.
chain), 100)
32 '''Test chaining of two files.'''
33 tmpfile = testfname.replace(
'test_tree',
'test_tree_2_tmp')
34 shutil.copyfile(testfname, tmpfile)
35 chain =
Chain(testfname.replace(
'.root',
'*.root'),
'test_tree')
36 self.assertEqual(len(chain), 200)
40 '''Test LFN/root-fn loading'''
41 chain =
Chain([
"root://{0}".
format(os.path.abspath(testfname))],
'test_tree')
42 self.assertEqual(len(chain), 100)
51 '''Test direct event access'''
53 self.assertEqual(event.var1, 2.)
56 if __name__ ==
'__main__':