CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
config_test.py
Go to the documentation of this file.
1 import unittest
2 import os
3 import shutil
4 import copy
5 
6 from config import *
7 
8 class ConfigTestCase(unittest.TestCase):
9 
10  def test_analyzer(self):
11  class Ana1(object):
12  pass
13  ana1 = Analyzer(
14  Ana1,
15  toto = '1',
16  tata = 'a'
17  )
18  # checking that the analyzer name does not contain a slash,
19  # to make sure the output directory name does not contain a subdirectory
20  self.assertTrue( '/' not in ana1.name )
21 
22  def test_MCComponent(self):
23  DYJets = MCComponent(
24  name = 'DYJets',
25  files ='blah_mc.root',
26  xSection = 3048.,
27  nGenEvents = 34915945,
28  triggers = ['HLT_MC'],
29  vertexWeight = 1.,
30  effCorrFactor = 1 )
31  self.assertTrue(True)
32 
33  def test_config(self):
34  class Ana1(object):
35  pass
36  ana1 = Analyzer(
37  Ana1,
38  toto = '1',
39  tata = 'a'
40  )
41  comp1 = Component(
42  'comp1',
43  files='*.root',
44  triggers='HLT_stuff'
45  )
46  from PhysicsTools.HeppyCore.framework.chain import Chain as Events
47  config = Config( components = [comp1],
48  sequence = [ana1],
49  services = [],
50  events_class = Events )
51 
52  def test_copy(self):
53  class Ana1(object):
54  pass
55  ana1 = Analyzer(
56  Ana1,
57  instance_label = 'inst1',
58  toto = '1',
59  )
60  ana2 = copy.copy(ana1)
61  ana2.instance_label = 'inst2'
62  ana2.toto2 = '2'
63  self.assertEqual(ana2.name, '__main__.Ana1_inst2')
64  self.assertEqual(ana2.toto2, '2')
65 
66 if __name__ == '__main__':
67  unittest.main()
list object
Definition: dbtoconf.py:77