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 217 of file Modules.py.

Member Function Documentation

def Modules.TestModules.testEDAnalyzer (   self)

Definition at line 218 of file Modules.py.

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

Definition at line 232 of file Modules.py.

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

Definition at line 283 of file Modules.py.

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

Definition at line 275 of file Modules.py.

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

Definition at line 268 of file Modules.py.

268  def testService(self):
269  empty = Service("Empty")
270  withParam = Service("Parameterized",foo=untracked(int32(1)), bar = untracked(string("it")))
271  self.assertEqual(withParam.foo.value(), 1)
272  self.assertEqual(withParam.bar.value(), "it")
273  self.assertEqual(empty.dumpPython(), "cms.Service(\"Empty\")\n")
274  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:268