Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-25 02:29:50

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