CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
chain_test.ChainTestCase Class Reference
Inheritance diagram for chain_test.ChainTestCase:

Public Member Functions

def setUp (self)
 
def test_file (self)
 
def test_get (self)
 
def test_guess_treename (self)
 
def test_iterate (self)
 
def test_load_1 (self)
 
def test_load_2 (self)
 
def test_load_3 (self)
 
def test_wrong_filename (self)
 

Public Attributes

 chain
 

Detailed Description

Definition at line 10 of file chain_test.py.

Member Function Documentation

def chain_test.ChainTestCase.setUp (   self)

Definition at line 12 of file chain_test.py.

12  def setUp(self):
13  self.chain = Chain(testfname, 'test_tree')
14 
def chain_test.ChainTestCase.test_file (   self)
Test that the test file exists

Definition at line 15 of file chain_test.py.

15  def test_file(self):
16  '''Test that the test file exists'''
17  self.assertTrue(os.path.isfile(testfname))
18 
def chain_test.ChainTestCase.test_get (   self)
Test direct event access

Definition at line 50 of file chain_test.py.

References chain_test.ChainTestCase.chain, edm::FileLocator::Rule.chain, chain.Chain.chain, and testtree.create_tree().

50  def test_get(self):
51  '''Test direct event access'''
52  event = self.chain[2]
53  self.assertEqual(event.var1, 2.)
54 
55 
def chain_test.ChainTestCase.test_guess_treename (   self)

Definition at line 23 of file chain_test.py.

References chain_test.ChainTestCase.chain, edm::FileLocator::Rule.chain, and chain.Chain.chain.

24  chain = Chain(testfname)
25  self.assertEqual(len(self.chain), 100)
26 
def test_guess_treename(self)
Definition: chain_test.py:23
def chain_test.ChainTestCase.test_iterate (   self)
Test iteration

Definition at line 44 of file chain_test.py.

References chain_test.ChainTestCase.chain, edm::FileLocator::Rule.chain, and chain.Chain.chain.

44  def test_iterate(self):
45  '''Test iteration'''
46  for ev in self.chain:
47  pass
48  self.assertTrue(True)
49 
def chain_test.ChainTestCase.test_load_1 (   self)
Test that the chain has the correct number of entries

Definition at line 27 of file chain_test.py.

References chain_test.ChainTestCase.chain, edm::FileLocator::Rule.chain, and chain.Chain.chain.

27  def test_load_1(self):
28  '''Test that the chain has the correct number of entries'''
29  self.assertEqual(len(self.chain), 100)
30 
def chain_test.ChainTestCase.test_load_2 (   self)
Test chaining of two files.

Definition at line 31 of file chain_test.py.

31  def test_load_2(self):
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)
37  os.remove(tmpfile)
38 
def chain_test.ChainTestCase.test_load_3 (   self)
Test LFN/root-fn loading

Definition at line 39 of file chain_test.py.

39  def test_load_3(self):
40  '''Test LFN/root-fn loading'''
41  chain = Chain(["root://{0}".format(os.path.abspath(testfname))], 'test_tree')
42  self.assertEqual(len(chain), 100)
43 
def chain_test.ChainTestCase.test_wrong_filename (   self)

Definition at line 19 of file chain_test.py.

20  self.assertRaises(ValueError,
21  Chain, 'non_existing_file.root')
22 
def test_wrong_filename(self)
Definition: chain_test.py:19

Member Data Documentation

chain_test.ChainTestCase.chain