CMS 3D CMS Logo

List of all members | Public Member Functions
helpers.TestModuleCommand Class Reference
Inheritance diagram for helpers.TestModuleCommand:

Public Member Functions

def setUp (self)
 
def testCloning (self)
 
def testContains (self)
 
def testJetCollectionString (self)
 
def testListModules (self)
 

Detailed Description

Definition at line 366 of file helpers.py.

Member Function Documentation

def helpers.TestModuleCommand.setUp (   self)
Nothing to do 

Definition at line 367 of file helpers.py.

367  def setUp(self):
368  """Nothing to do """
369  pass
def helpers.TestModuleCommand.testCloning (   self)

Definition at line 370 of file helpers.py.

370  def testCloning(self):
371  p = cms.Process("test")
372  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
373  p.b = cms.EDProducer("b", src=cms.InputTag("a"))
374  p.c = cms.EDProducer("c", src=cms.InputTag("b","instance"))
375  p.s = cms.Sequence(p.a*p.b*p.c *p.a)
376  cloneProcessingSnippet(p, p.s, "New", addToTask = True)
377  self.assertEqual(p.dumpPython(),
378 """import FWCore.ParameterSet.Config as cms
379 
380 process = cms.Process("test")
381 
382 process.a = cms.EDProducer("a",
383  src = cms.InputTag("gen")
384 )
385 
386 
387 process.aNew = cms.EDProducer("a",
388  src = cms.InputTag("gen")
389 )
390 
391 
392 process.b = cms.EDProducer("b",
393  src = cms.InputTag("a")
394 )
395 
396 
397 process.bNew = cms.EDProducer("b",
398  src = cms.InputTag("aNew")
399 )
400 
401 
402 process.c = cms.EDProducer("c",
403  src = cms.InputTag("b","instance")
404 )
405 
406 
407 process.cNew = cms.EDProducer("c",
408  src = cms.InputTag("bNew","instance")
409 )
410 
411 
412 process.patAlgosToolsTask = cms.Task(process.aNew, process.bNew, process.cNew)
413 
414 
415 process.s = cms.Sequence(process.a+process.b+process.c+process.a)
416 
417 
418 process.sNew = cms.Sequence(process.aNew+process.bNew+process.cNew+process.aNew)
419 
420 
421 """)
def cloneProcessingSnippet(process, sequence, postfix, removePostfix="", noClones=[], addToTask=False)
Definition: helpers.py:256
def helpers.TestModuleCommand.testContains (   self)

Definition at line 422 of file helpers.py.

References helpers.contains().

422  def testContains(self):
423  p = cms.Process("test")
424  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
425  p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
426  p.c = cms.EDProducer("ac", src=cms.InputTag("b"))
427  p.s1 = cms.Sequence(p.a*p.b*p.c)
428  p.s2 = cms.Sequence(p.b*p.c)
429  self.assert_( contains(p.s1, "a") )
430  self.assert_( not contains(p.s2, "a") )
def contains(sequence, moduleName)
Definition: helpers.py:240
def helpers.TestModuleCommand.testJetCollectionString (   self)

Definition at line 431 of file helpers.py.

References helpers.jetCollectionString().

432  self.assertEqual(jetCollectionString(algo = 'Foo', type = 'Bar'), 'patJetsFooBar')
433  self.assertEqual(jetCollectionString(prefix = 'prefix', algo = 'Foo', type = 'Bar'), 'prefixPatJetsFooBar')
def jetCollectionString(prefix='', algo='', type='')
Definition: helpers.py:216
def testJetCollectionString(self)
Definition: helpers.py:431
def helpers.TestModuleCommand.testListModules (   self)

Definition at line 434 of file helpers.py.

References helpers.listModules().

434  def testListModules(self):
435  p = cms.Process("test")
436  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
437  p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
438  p.c = cms.EDProducer("ac", src=cms.InputTag("b"))
439  p.s = cms.Sequence(p.a*p.b*p.c)
440  self.assertEqual([p.a,p.b,p.c], listModules(p.s))
441 
442  unittest.main()
def listModules(sequence)
Definition: helpers.py:206
def testListModules(self)
Definition: helpers.py:434