CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 11 of file chain_test.py.

Member Function Documentation

def chain_test.ChainTestCase.setUp (   self)

Definition at line 13 of file chain_test.py.

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

Definition at line 16 of file chain_test.py.

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

Definition at line 51 of file chain_test.py.

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

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

Definition at line 24 of file chain_test.py.

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

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

Definition at line 45 of file chain_test.py.

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

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

Definition at line 28 of file chain_test.py.

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

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

Definition at line 32 of file chain_test.py.

32 
33  def test_load_2(self):
34  '''Test chaining of two files.'''
35  tmpfile = testfname.replace('test_tree', 'test_tree_2_tmp')
36  shutil.copyfile(testfname, tmpfile)
37  chain = Chain(testfname.replace('.root', '*.root'), 'test_tree')
38  self.assertEqual(len(chain), 200)
39  os.remove(tmpfile)
def chain_test.ChainTestCase.test_load_3 (   self)
Test LFN/root-fn loading

Definition at line 40 of file chain_test.py.

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

Definition at line 20 of file chain_test.py.

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

Member Data Documentation

chain_test.ChainTestCase.chain

Definition at line 14 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().