Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:32:31

0001 from __future__ import absolute_import
0002 import unittest
0003 import os
0004 import shutil
0005 import copy
0006 
0007 from .config import *
0008 
0009 class ConfigTestCase(unittest.TestCase):
0010 
0011     def test_analyzer(self):
0012         class Ana1(object):
0013             pass
0014         ana1 = Analyzer(
0015             Ana1,
0016             toto = '1',
0017             tata = 'a'
0018             )
0019         # checking that the analyzer name does not contain a slash, 
0020         # to make sure the output directory name does not contain a subdirectory
0021         self.assertTrue( '/' not in ana1.name )
0022 
0023     def test_MCComponent(self):
0024         DYJets = MCComponent(
0025             name = 'DYJets',
0026             files ='blah_mc.root',
0027             xSection = 3048.,
0028             nGenEvents = 34915945,
0029             triggers = ['HLT_MC'],
0030             vertexWeight = 1.,
0031             effCorrFactor = 1 )
0032         self.assertTrue(True)
0033 
0034     def test_config(self):
0035         class Ana1(object):
0036             pass
0037         ana1 = Analyzer(
0038             Ana1,
0039             toto = '1',
0040             tata = 'a'
0041             )
0042         comp1 = Component( 
0043             'comp1',
0044             files='*.root',
0045             triggers='HLT_stuff'
0046             )
0047         from PhysicsTools.HeppyCore.framework.chain import Chain as Events
0048         config = Config( components = [comp1],
0049                          sequence = [ana1], 
0050                          services = [],
0051                          events_class = Events )
0052 
0053     def test_copy(self):
0054         class Ana1(object):
0055             pass
0056         ana1 = Analyzer(
0057             Ana1,
0058             instance_label = 'inst1',
0059             toto = '1',
0060             )        
0061         ana2 = copy.copy(ana1)
0062         ana2.instance_label = 'inst2'
0063         ana2.toto2 = '2'
0064         self.assertEqual(ana2.name, '__main__.Ana1_inst2')
0065         self.assertEqual(ana2.toto2, '2')
0066 
0067 if __name__ == '__main__':
0068     unittest.main()