CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
 
def test_file
 
def test_get
 
def test_guess_treename
 
def test_iterate
 
def test_load_1
 
def test_load_2
 
def test_load_3
 
def test_wrong_filename
 

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 
13  def setUp(self):
14  self.chain = Chain(testfname, 'test_tree')
def chain_test.ChainTestCase.test_file (   self)
Test that the test file exists

Definition at line 15 of file chain_test.py.

15 
16  def test_file(self):
17  '''Test that the test file exists'''
18  self.assertTrue(os.path.isfile(testfname))
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 
51  def test_get(self):
52  '''Test direct event access'''
53  event = self.chain[2]
54  self.assertEqual(event.var1, 2.)
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.

23 
24  def test_guess_treename(self):
25  chain = Chain(testfname)
26  self.assertEqual(len(self.chain), 100)
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 
45  def test_iterate(self):
46  '''Test iteration'''
47  for ev in self.chain:
48  pass
49  self.assertTrue(True)
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 
28  def test_load_1(self):
29  '''Test that the chain has the correct number of entries'''
30  self.assertEqual(len(self.chain), 100)
def chain_test.ChainTestCase.test_load_2 (   self)
Test chaining of two files.

Definition at line 31 of file chain_test.py.

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

Definition at line 39 of file chain_test.py.

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

Definition at line 19 of file chain_test.py.

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

Member Data Documentation

chain_test.ChainTestCase.chain

Definition at line 13 of file chain_test.py.

Referenced by chain_test.ChainTestCase.test_get(), chain_test.ChainTestCase.test_guess_treename(), chain_test.ChainTestCase.test_iterate(), and chain_test.ChainTestCase.test_load_1().