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 441 of file helpers.py.

Member Function Documentation

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

Definition at line 442 of file helpers.py.

443  def setUp(self):
444  """Nothing to do """
pass
def helpers.TestModuleCommand.testCloning (   self)

Definition at line 445 of file helpers.py.

446  def testCloning(self):
447  p = cms.Process("test")
448  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
449  p.b = cms.EDProducer("b", src=cms.InputTag("a"))
450  p.c = cms.EDProducer("c", src=cms.InputTag("b","instance"))
451  p.s = cms.Sequence(p.a*p.b*p.c *p.a)
452  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 453 of file helpers.py.

References helpers.contains().

454  def testContains(self):
455  p = cms.Process("test")
456  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
457  p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
458  p.c = cms.EDProducer("ac", src=cms.InputTag("b"))
459  p.s1 = cms.Sequence(p.a*p.b*p.c)
460  p.s2 = cms.Sequence(p.b*p.c)
461  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 462 of file helpers.py.

References helpers.jetCollectionString().

463  def testJetCollectionString(self):
464  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 465 of file helpers.py.

References helpers.listModules().

466  def testListModules(self):
467  p = cms.Process("test")
468  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
469  p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
470  p.c = cms.EDProducer("ac", src=cms.InputTag("b"))
471  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 483 of file helpers.py.

References helpers.massSearchReplaceAnyInputTag().

485  p = cms.Process("test")
486  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
487  p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
488  p.c = cms.EDProducer("ac", src=cms.InputTag("b"),
489  nested = cms.PSet(src = cms.InputTag("b"), src2 = cms.InputTag("c")),
490  nestedv = cms.VPSet(cms.PSet(src = cms.InputTag("b")), cms.PSet(src = cms.InputTag("d"))),
491  vec = cms.VInputTag(cms.InputTag("a"), cms.InputTag("b"), cms.InputTag("c"), cms.InputTag("d"))
492  )
493  p.s = cms.Sequence(p.a*p.b*p.c)
494  massSearchReplaceAnyInputTag(p.s, cms.InputTag("b"), cms.InputTag("new"))
495  self.assertNotEqual(cms.InputTag("new"), p.b.src)
496  self.assertEqual(cms.InputTag("new"), p.c.src)
497  self.assertEqual(cms.InputTag("new"), p.c.nested.src)
498  self.assertEqual(cms.InputTag("new"), p.c.nested.src)
499  self.assertNotEqual(cms.InputTag("new"), p.c.nested.src2)
500  self.assertEqual(cms.InputTag("new"), p.c.nestedv[0].src)
501  self.assertNotEqual(cms.InputTag("new"), p.c.nestedv[1].src)
502  self.assertNotEqual(cms.InputTag("new"), p.c.vec[0])
503  self.assertEqual(cms.InputTag("new"), p.c.vec[1])
504  self.assertNotEqual(cms.InputTag("new"), p.c.vec[2])
505  self.assertNotEqual(cms.InputTag("new"), p.c.vec[3])
506 
unittest.main()
def massSearchReplaceAnyInputTag
Definition: helpers.py:271
def testMassSearchReplaceAnyInputTag
Definition: helpers.py:483
def helpers.TestModuleCommand.testMassSearchReplaceParam (   self)

Definition at line 472 of file helpers.py.

References helpers.massSearchReplaceParam().

473  def testMassSearchReplaceParam(self):
474  p = cms.Process("test")
475  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
476  p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
477  p.c = cms.EDProducer("ac", src=cms.InputTag("b"),
478  nested = cms.PSet(src = cms.InputTag("c"))
479  )
480  p.s = cms.Sequence(p.a*p.b*p.c)
481  massSearchReplaceParam(p.s,"src",cms.InputTag("b"),"a")
482  self.assertEqual(cms.InputTag("a"),p.c.src)
self.assertNotEqual(cms.InputTag("a"),p.c.nested.src)
def massSearchReplaceParam
Definition: helpers.py:258