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

Member Function Documentation

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

Definition at line 324 of file helpers.py.

325  def setUp(self):
326  """Nothing to do """
pass
def helpers.TestModuleCommand.testCloning (   self)

Definition at line 327 of file helpers.py.

328  def testCloning(self):
329  p = cms.Process("test")
330  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
331  p.b = cms.EDProducer("b", src=cms.InputTag("a"))
332  p.c = cms.EDProducer("c", src=cms.InputTag("b","instance"))
333  p.s = cms.Sequence(p.a*p.b*p.c *p.a)
334  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:306
def helpers.TestModuleCommand.testContains (   self)

Definition at line 335 of file helpers.py.

References helpers.contains().

336  def testContains(self):
337  p = cms.Process("test")
338  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
339  p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
340  p.c = cms.EDProducer("ac", src=cms.InputTag("b"))
341  p.s1 = cms.Sequence(p.a*p.b*p.c)
342  p.s2 = cms.Sequence(p.b*p.c)
343  self.assert_( contains(p.s1, "a") )
self.assert_( not contains(p.s2, "a") )
def contains
Definition: helpers.py:290
def helpers.TestModuleCommand.testJetCollectionString (   self)

Definition at line 344 of file helpers.py.

References helpers.jetCollectionString().

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

Definition at line 347 of file helpers.py.

References helpers.listModules().

348  def testListModules(self):
349  p = cms.Process("test")
350  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
351  p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
352  p.c = cms.EDProducer("ac", src=cms.InputTag("b"))
353  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:252
def helpers.TestModuleCommand.testMassSearchReplaceAnyInputTag (   self)

Definition at line 365 of file helpers.py.

References helpers.massSearchReplaceAnyInputTag().

367  p = cms.Process("test")
368  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
369  p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
370  p.c = cms.EDProducer("ac", src=cms.InputTag("b"),
371  nested = cms.PSet(src = cms.InputTag("b"), src2 = cms.InputTag("c")),
372  nestedv = cms.VPSet(cms.PSet(src = cms.InputTag("b")), cms.PSet(src = cms.InputTag("d"))),
373  vec = cms.VInputTag(cms.InputTag("a"), cms.InputTag("b"), cms.InputTag("c"), cms.InputTag("d"))
374  )
375  p.s = cms.Sequence(p.a*p.b*p.c)
376  massSearchReplaceAnyInputTag(p.s, cms.InputTag("b"), cms.InputTag("new"))
377  self.assertNotEqual(cms.InputTag("new"), p.b.src)
378  self.assertEqual(cms.InputTag("new"), p.c.src)
379  self.assertEqual(cms.InputTag("new"), p.c.nested.src)
380  self.assertEqual(cms.InputTag("new"), p.c.nested.src)
381  self.assertNotEqual(cms.InputTag("new"), p.c.nested.src2)
382  self.assertEqual(cms.InputTag("new"), p.c.nestedv[0].src)
383  self.assertNotEqual(cms.InputTag("new"), p.c.nestedv[1].src)
384  self.assertNotEqual(cms.InputTag("new"), p.c.vec[0])
385  self.assertEqual(cms.InputTag("new"), p.c.vec[1])
386  self.assertNotEqual(cms.InputTag("new"), p.c.vec[2])
387  self.assertNotEqual(cms.InputTag("new"), p.c.vec[3])
388 
unittest.main()
def massSearchReplaceAnyInputTag
Definition: helpers.py:262
def testMassSearchReplaceAnyInputTag
Definition: helpers.py:365
def helpers.TestModuleCommand.testMassSearchReplaceParam (   self)

Definition at line 354 of file helpers.py.

References helpers.massSearchReplaceParam().

355  def testMassSearchReplaceParam(self):
356  p = cms.Process("test")
357  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
358  p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
359  p.c = cms.EDProducer("ac", src=cms.InputTag("b"),
360  nested = cms.PSet(src = cms.InputTag("c"))
361  )
362  p.s = cms.Sequence(p.a*p.b*p.c)
363  massSearchReplaceParam(p.s,"src",cms.InputTag("b"),"a")
364  self.assertEqual(cms.InputTag("a"),p.c.src)
self.assertNotEqual(cms.InputTag("a"),p.c.nested.src)
def massSearchReplaceParam
Definition: helpers.py:249