test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
Modules.TestModules Class Reference
Inheritance diagram for Modules.TestModules:

Public Member Functions

def testEDAnalyzer
 
def testESPrefer
 
def testSequences
 
def testService
 

Detailed Description

Definition at line 200 of file Modules.py.

Member Function Documentation

def Modules.TestModules.testEDAnalyzer (   self)

Definition at line 201 of file Modules.py.

References Types.untracked.

202  def testEDAnalyzer(self):
203  empty = EDAnalyzer("Empty")
204  withParam = EDAnalyzer("Parameterized",foo=untracked(int32(1)), bar = untracked(string("it")))
205  self.assertEqual(withParam.foo.value(), 1)
206  self.assertEqual(withParam.bar.value(), "it")
207  aCopy = withParam.copy()
208  self.assertEqual(aCopy.foo.value(), 1)
209  self.assertEqual(aCopy.bar.value(), "it")
210  withType = EDAnalyzer("Test",type = int32(1))
211  self.assertEqual(withType.type.value(),1)
212  block = PSet(i = int32(9))
213  m = EDProducer("DumbProducer", block, j = int32(10))
214  self.assertEqual(9, m.i.value())
self.assertEqual(10, m.j.value())
tuple untracked
Definition: Types.py:27
def Modules.TestModules.testESPrefer (   self)

Definition at line 215 of file Modules.py.

216  def testESPrefer(self):
217  juicer = ESPrefer("JuiceProducer")
218  options = PrintOptions()
219  options.isCfg = True
220  self.assertEqual(juicer.dumpPythonAs("juicer", options), "process.prefer(\"JuiceProducer\")\n")
221  options.isCfg = False
222  self.assertEqual(juicer.dumpPythonAs("juicer", options), "es_prefer_JuiceProducer = cms.ESPrefer(\"JuiceProducer\")\n")
223 
224  juicer = ESPrefer("JuiceProducer","juicer")
225  options = PrintOptions()
226  options.isCfg = True
227  self.assertEqual(juicer.dumpPythonAs("juicer", options), 'process.prefer("juicer")\n')
228  options.isCfg = False
229  self.assertEqual(juicer.dumpPythonAs("juicer", options), 'es_prefer_juicer = cms.ESPrefer("JuiceProducer","juicer")\n')
230  juicer = ESPrefer("JuiceProducer",fooRcd=vstring())
231  self.assertEqual(juicer.dumpConfig(options),
232 """JuiceProducer {
233  vstring fooRcd = {
234  }
235 
236 }
237 """)
238  options = PrintOptions()
239  options.isCfg = True
240  self.assertEqual(juicer.dumpPythonAs("juicer"),
241 """process.prefer("JuiceProducer",
242  fooRcd = cms.vstring()
243 )
244 """)
245  options.isCfg = False
246  self.assertEqual(juicer.dumpPythonAs("juicer", options),
247 """es_prefer_JuiceProducer = cms.ESPrefer("JuiceProducer",
248  fooRcd = cms.vstring()
249 )
250 """)
def Modules.TestModules.testSequences (   self)

Definition at line 258 of file Modules.py.

259  def testSequences(self):
260  m = EDProducer("MProducer")
261  n = EDProducer("NProducer")
262  m.setLabel("m")
263  n.setLabel("n")
264  s1 = Sequence(m*n)
265  options = PrintOptions()
266 
267 
268 
unittest.main()
def Modules.TestModules.testService (   self)

Definition at line 251 of file Modules.py.

References Types.untracked.

252  def testService(self):
253  empty = Service("Empty")
254  withParam = Service("Parameterized",foo=untracked(int32(1)), bar = untracked(string("it")))
255  self.assertEqual(withParam.foo.value(), 1)
256  self.assertEqual(withParam.bar.value(), "it")
257  self.assertEqual(empty.dumpPython(), "cms.Service(\"Empty\")\n")
self.assertEqual(withParam.dumpPython(), "cms.Service(\"Parameterized\",\n bar = cms.untracked.string(\'it\'),\n foo = cms.untracked.int32(1)\n)\n")
tuple untracked
Definition: Types.py:27