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
helpers.TestModuleCommand Class Reference
Inheritance diagram for helpers.TestModuleCommand:

Public Member Functions

def setUp
 
def testCloning
 
def testContains
 
def testJetCollectionString
 
def testListModules
 
def testMassSearchReplaceAnyInputTag
 
def testMassSearchReplaceParam
 

Detailed Description

Definition at line 332 of file helpers.py.

Member Function Documentation

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

Definition at line 333 of file helpers.py.

334  def setUp(self):
335  """Nothing to do """
pass
def helpers.TestModuleCommand.testCloning (   self)

Definition at line 336 of file helpers.py.

337  def testCloning(self):
338  p = cms.Process("test")
339  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
340  p.b = cms.EDProducer("b", src=cms.InputTag("a"))
341  p.c = cms.EDProducer("c", src=cms.InputTag("b","instance"))
342  p.s = cms.Sequence(p.a*p.b*p.c *p.a)
343  cloneProcessingSnippet(p, p.s, "New")
self.assertEqual(p.dumpPython(),'import FWCore.ParameterSet.Config as cms\n\nprocess = cms.Process("test")\n\nprocess.a = cms.EDProducer("a",\n src = cms.InputTag("gen")\n)\n\n\nprocess.c = cms.EDProducer("c",\n src = cms.InputTag("b","instance")\n)\n\n\nprocess.cNew = cms.EDProducer("c",\n src = cms.InputTag("bNew","instance")\n)\n\n\nprocess.bNew = cms.EDProducer("b",\n src = cms.InputTag("aNew")\n)\n\n\nprocess.aNew = cms.EDProducer("a",\n src = cms.InputTag("gen")\n)\n\n\nprocess.b = cms.EDProducer("b",\n src = cms.InputTag("a")\n)\n\n\nprocess.s = cms.Sequence(process.a*process.b*process.c*process.a)\n\n\nprocess.sNew = cms.Sequence(process.aNew+process.bNew+process.cNew)\n\n\n')
def cloneProcessingSnippet
Definition: helpers.py:315
def helpers.TestModuleCommand.testContains (   self)

Definition at line 344 of file helpers.py.

References helpers.contains().

345  def testContains(self):
346  p = cms.Process("test")
347  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
348  p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
349  p.c = cms.EDProducer("ac", src=cms.InputTag("b"))
350  p.s1 = cms.Sequence(p.a*p.b*p.c)
351  p.s2 = cms.Sequence(p.b*p.c)
352  self.assert_( contains(p.s1, "a") )
self.assert_( not contains(p.s2, "a") )
def contains
Definition: helpers.py:299
def helpers.TestModuleCommand.testJetCollectionString (   self)

Definition at line 353 of file helpers.py.

References helpers.jetCollectionString().

354  def testJetCollectionString(self):
355  self.assertEqual(jetCollectionString(algo = 'Foo', type = 'Bar'), 'patFooBarJets')
self.assertEqual(jetCollectionString(prefix = 'prefix', algo = 'Foo', type = 'Bar'), 'prefixPatFooBarJets')
def jetCollectionString
Definition: helpers.py:275
def helpers.TestModuleCommand.testListModules (   self)

Definition at line 356 of file helpers.py.

References helpers.listModules().

357  def testListModules(self):
358  p = cms.Process("test")
359  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
360  p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
361  p.c = cms.EDProducer("ac", src=cms.InputTag("b"))
362  p.s = cms.Sequence(p.a*p.b*p.c)
self.assertEqual([p.a,p.b,p.c], listModules(p.s))
def listModules
Definition: helpers.py:261
def helpers.TestModuleCommand.testMassSearchReplaceAnyInputTag (   self)

Definition at line 374 of file helpers.py.

References helpers.massSearchReplaceAnyInputTag().

376  p = cms.Process("test")
377  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
378  p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
379  p.c = cms.EDProducer("ac", src=cms.InputTag("b"),
380  nested = cms.PSet(src = cms.InputTag("b"), src2 = cms.InputTag("c")),
381  nestedv = cms.VPSet(cms.PSet(src = cms.InputTag("b")), cms.PSet(src = cms.InputTag("d"))),
382  vec = cms.VInputTag(cms.InputTag("a"), cms.InputTag("b"), cms.InputTag("c"), cms.InputTag("d"))
383  )
384  p.s = cms.Sequence(p.a*p.b*p.c)
385  massSearchReplaceAnyInputTag(p.s, cms.InputTag("b"), cms.InputTag("new"))
386  self.assertNotEqual(cms.InputTag("new"), p.b.src)
387  self.assertEqual(cms.InputTag("new"), p.c.src)
388  self.assertEqual(cms.InputTag("new"), p.c.nested.src)
389  self.assertEqual(cms.InputTag("new"), p.c.nested.src)
390  self.assertNotEqual(cms.InputTag("new"), p.c.nested.src2)
391  self.assertEqual(cms.InputTag("new"), p.c.nestedv[0].src)
392  self.assertNotEqual(cms.InputTag("new"), p.c.nestedv[1].src)
393  self.assertNotEqual(cms.InputTag("new"), p.c.vec[0])
394  self.assertEqual(cms.InputTag("new"), p.c.vec[1])
395  self.assertNotEqual(cms.InputTag("new"), p.c.vec[2])
396  self.assertNotEqual(cms.InputTag("new"), p.c.vec[3])
397 
unittest.main()
def massSearchReplaceAnyInputTag
Definition: helpers.py:271
def testMassSearchReplaceAnyInputTag
Definition: helpers.py:374
def helpers.TestModuleCommand.testMassSearchReplaceParam (   self)

Definition at line 363 of file helpers.py.

References helpers.massSearchReplaceParam().

364  def testMassSearchReplaceParam(self):
365  p = cms.Process("test")
366  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
367  p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
368  p.c = cms.EDProducer("ac", src=cms.InputTag("b"),
369  nested = cms.PSet(src = cms.InputTag("c"))
370  )
371  p.s = cms.Sequence(p.a*p.b*p.c)
372  massSearchReplaceParam(p.s,"src",cms.InputTag("b"),"a")
373  self.assertEqual(cms.InputTag("a"),p.c.src)
self.assertNotEqual(cms.InputTag("a"),p.c.nested.src)
def massSearchReplaceParam
Definition: helpers.py:258