5 from PhysicsTools.HeppyCore.framework.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)
46 '''Test direct event access'''
48 self.assertEqual(event.var1, 2.)
51 if __name__ ==
'__main__':