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 11 of file chain_test.py.

Member Function Documentation

◆ setUp()

def chain_test.ChainTestCase.setUp (   self)

Definition at line 13 of file chain_test.py.

13  def setUp(self):
14  self.chain = Chain(testfname, 'test_tree')
15 

◆ test_file()

def chain_test.ChainTestCase.test_file (   self)
Test that the test file exists

Definition at line 16 of file chain_test.py.

16  def test_file(self):
17  '''Test that the test file exists'''
18  self.assertTrue(os.path.isfile(testfname))
19 

◆ test_get()

def chain_test.ChainTestCase.test_get (   self)
Test direct event access

Definition at line 51 of file chain_test.py.

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

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

◆ test_guess_treename()

def chain_test.ChainTestCase.test_guess_treename (   self)

Definition at line 24 of file chain_test.py.

24  def test_guess_treename(self):
25  chain = Chain(testfname)
26  self.assertEqual(len(self.chain), 100)
27 

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

◆ test_iterate()

def chain_test.ChainTestCase.test_iterate (   self)
Test iteration

Definition at line 45 of file chain_test.py.

45  def test_iterate(self):
46  '''Test iteration'''
47  for ev in self.chain:
48  pass
49  self.assertTrue(True)
50 

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

◆ test_load_1()

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.

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

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

◆ test_load_2()

def chain_test.ChainTestCase.test_load_2 (   self)
Test chaining of two files.

Definition at line 32 of file chain_test.py.

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)
39 

◆ test_load_3()

def chain_test.ChainTestCase.test_load_3 (   self)
Test LFN/root-fn loading

Definition at line 40 of file chain_test.py.

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)
44 

◆ test_wrong_filename()

def chain_test.ChainTestCase.test_wrong_filename (   self)

Definition at line 20 of file chain_test.py.

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

Member Data Documentation

◆ chain

chain_test.ChainTestCase.chain
format