CMS 3D CMS Logo

List of all members | Public Member Functions
Modules.TestModules Class Reference
Inheritance diagram for Modules.TestModules:

Public Member Functions

def testEDAnalyzer (self)
 
def testESPrefer (self)
 
def testIsTaskComponent (self)
 
def testSequences (self)
 
def testService (self)
 

Detailed Description

Definition at line 218 of file Modules.py.

Member Function Documentation

def Modules.TestModules.testEDAnalyzer (   self)

Definition at line 219 of file Modules.py.

219  def testEDAnalyzer(self):
220  empty = EDAnalyzer("Empty")
221  withParam = EDAnalyzer("Parameterized",foo=untracked(int32(1)), bar = untracked(string("it")))
222  self.assertEqual(withParam.foo.value(), 1)
223  self.assertEqual(withParam.bar.value(), "it")
224  aCopy = withParam.copy()
225  self.assertEqual(aCopy.foo.value(), 1)
226  self.assertEqual(aCopy.bar.value(), "it")
227  withType = EDAnalyzer("Test",type = int32(1))
228  self.assertEqual(withType.type.value(),1)
229  block = PSet(i = int32(9))
230  m = EDProducer("DumbProducer", block, j = int32(10))
231  self.assertEqual(9, m.i.value())
232  self.assertEqual(10, m.j.value())
def testEDAnalyzer(self)
Definition: Modules.py:219
def Modules.TestModules.testESPrefer (   self)

Definition at line 233 of file Modules.py.

233  def testESPrefer(self):
234  juicer = ESPrefer("JuiceProducer")
235  options = PrintOptions()
236  options.isCfg = True
237  self.assertEqual(juicer.dumpPythonAs("juicer", options), "process.prefer(\"JuiceProducer\")\n")
238  options.isCfg = False
239  self.assertEqual(juicer.dumpPythonAs("juicer", options), "es_prefer_JuiceProducer = cms.ESPrefer(\"JuiceProducer\")\n")
240 
241  juicer = ESPrefer("JuiceProducer","juicer")
242  options = PrintOptions()
243  options.isCfg = True
244  self.assertEqual(juicer.dumpPythonAs("juicer", options), 'process.prefer("juicer")\n')
245  options.isCfg = False
246  self.assertEqual(juicer.dumpPythonAs("juicer", options), 'es_prefer_juicer = cms.ESPrefer("JuiceProducer","juicer")\n')
247  juicer = ESPrefer("JuiceProducer",fooRcd=vstring())
248  self.assertEqual(juicer.dumpConfig(options),
249 """JuiceProducer {
250  vstring fooRcd = {
251  }
252 
253 }
254 """)
255  options = PrintOptions()
256  options.isCfg = True
257  self.assertEqual(juicer.dumpPythonAs("juicer"),
258 """process.prefer("JuiceProducer",
259  fooRcd = cms.vstring()
260 )
261 """)
262  options.isCfg = False
263  self.assertEqual(juicer.dumpPythonAs("juicer", options),
264 """es_prefer_JuiceProducer = cms.ESPrefer("JuiceProducer",
265  fooRcd = cms.vstring()
266 )
267 """)
268 
def testESPrefer(self)
Definition: Modules.py:233
def Modules.TestModules.testIsTaskComponent (   self)

Definition at line 284 of file Modules.py.

285  m = EDProducer("x")
286  self.assertTrue(m._isTaskComponent())
287  self.assertTrue(m.isLeaf())
288  m = EDFilter("x")
289  self.assertTrue(m._isTaskComponent())
290  self.assertTrue(m.isLeaf())
291  m = OutputModule("x")
292  self.assertFalse(m._isTaskComponent())
293  self.assertTrue(m.isLeaf())
294  m = EDAnalyzer("x")
295  self.assertFalse(m._isTaskComponent())
296  self.assertTrue(m.isLeaf())
297  m = Service("x")
298  self.assertTrue(m._isTaskComponent())
299  self.assertTrue(m.isLeaf())
300  m = ESProducer("x")
301  self.assertTrue(m._isTaskComponent())
302  self.assertTrue(m.isLeaf())
303  m = ESSource("x")
304  self.assertTrue(m._isTaskComponent())
305  self.assertTrue(m.isLeaf())
306  m = Sequence()
307  self.assertFalse(m._isTaskComponent())
308  self.assertFalse(m.isLeaf())
309  m = Path()
310  self.assertFalse(m._isTaskComponent())
311  m = EndPath()
312  self.assertFalse(m._isTaskComponent())
313  m = Task()
314  self.assertTrue(m._isTaskComponent())
315  self.assertFalse(m.isLeaf())
316 
317  unittest.main()
def testIsTaskComponent(self)
Definition: Modules.py:284
def Modules.TestModules.testSequences (   self)

Definition at line 276 of file Modules.py.

276  def testSequences(self):
277  m = EDProducer("MProducer")
278  n = EDProducer("NProducer")
279  m.setLabel("m")
280  n.setLabel("n")
281  s1 = Sequence(m*n)
282  options = PrintOptions()
283 
def testSequences(self)
Definition: Modules.py:276
def Modules.TestModules.testService (   self)

Definition at line 269 of file Modules.py.

269  def testService(self):
270  empty = Service("Empty")
271  withParam = Service("Parameterized",foo=untracked(int32(1)), bar = untracked(string("it")))
272  self.assertEqual(withParam.foo.value(), 1)
273  self.assertEqual(withParam.bar.value(), "it")
274  self.assertEqual(empty.dumpPython(), "cms.Service(\"Empty\")\n")
275  self.assertEqual(withParam.dumpPython(), "cms.Service(\"Parameterized\",\n bar = cms.untracked.string(\'it\'),\n foo = cms.untracked.int32(1)\n)\n")
def testService(self)
Definition: Modules.py:269