CMS 3D CMS Logo

Public Member Functions

Modules::TestModules Class Reference

List of all members.

Public Member Functions

def testEDAnalyzer
def testESPrefer
def testSequences
def testService

Detailed Description

Definition at line 188 of file Modules.py.


Member Function Documentation

def Modules::TestModules::testEDAnalyzer (   self)

Definition at line 189 of file Modules.py.

00190                                 :
00191             empty = EDAnalyzer("Empty")
00192             withParam = EDAnalyzer("Parameterized",foo=untracked(int32(1)), bar = untracked(string("it")))
00193             self.assertEqual(withParam.foo.value(), 1)
00194             self.assertEqual(withParam.bar.value(), "it")
00195             aCopy = withParam.copy()
00196             self.assertEqual(aCopy.foo.value(), 1)
00197             self.assertEqual(aCopy.bar.value(), "it")
00198             withType = EDAnalyzer("Test",type = int32(1))
00199             self.assertEqual(withType.type.value(),1)
00200             block = PSet(i = int32(9))
00201             m = EDProducer("DumbProducer", block, j = int32(10))
00202             self.assertEqual(9, m.i.value())
            self.assertEqual(10, m.j.value())
def Modules::TestModules::testESPrefer (   self)

Definition at line 203 of file Modules.py.

00204                               :
00205             juicer = ESPrefer("JuiceProducer")
00206             options = PrintOptions()
00207             options.isCfg = True
00208             self.assertEqual(juicer.dumpPythonAs("juicer", options), "process.prefer(\"JuiceProducer\")\n")
00209             options.isCfg = False
00210             self.assertEqual(juicer.dumpPythonAs("juicer", options), "es_prefer_JuiceProducer = cms.ESPrefer(\"JuiceProducer\")\n")
00211 
00212             juicer = ESPrefer("JuiceProducer","juicer")
00213             options = PrintOptions()
00214             options.isCfg = True
00215             self.assertEqual(juicer.dumpPythonAs("juicer", options), 'process.prefer("juicer")\n')
00216             options.isCfg = False
00217             self.assertEqual(juicer.dumpPythonAs("juicer", options), 'es_prefer_juicer = cms.ESPrefer("JuiceProducer","juicer")\n')
00218             juicer = ESPrefer("JuiceProducer",fooRcd=vstring())
00219             self.assertEqual(juicer.dumpConfig(options),
00220 """JuiceProducer { 
00221     vstring fooRcd = {
00222     }
00223 
00224 }
00225 """)
00226             options = PrintOptions()
00227             options.isCfg = True
00228             self.assertEqual(juicer.dumpPythonAs("juicer"),
00229 """process.prefer("JuiceProducer",
00230     fooRcd = cms.vstring()
00231 )
00232 """)
00233             options.isCfg = False
00234             self.assertEqual(juicer.dumpPythonAs("juicer", options),
00235 """es_prefer_JuiceProducer = cms.ESPrefer("JuiceProducer",
00236     fooRcd = cms.vstring()
00237 )
00238 """)
        
def Modules::TestModules::testSequences (   self)

Definition at line 246 of file Modules.py.

00247                                :
00248             m = EDProducer("MProducer")
00249             n = EDProducer("NProducer")
00250             m.setLabel("m")
00251             n.setLabel("n")
00252             s1 = Sequence(m*n)
00253             options = PrintOptions()
00254 
00255 
00256 
    unittest.main()
def Modules::TestModules::testService (   self)

Definition at line 239 of file Modules.py.

00240                              :
00241             empty = Service("Empty")
00242             withParam = Service("Parameterized",foo=untracked(int32(1)), bar = untracked(string("it")))
00243             self.assertEqual(withParam.foo.value(), 1)
00244             self.assertEqual(withParam.bar.value(), "it")
00245             self.assertEqual(empty.dumpPython(), "cms.Service(\"Empty\")\n")
            self.assertEqual(withParam.dumpPython(), "cms.Service(\"Parameterized\",\n    foo = cms.untracked.int32(1),\n    bar = cms.untracked.string(\'it\')\n)\n")