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

Member Function Documentation

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

Definition at line 327 of file helpers.py.

328  def setUp(self):
329  """Nothing to do """
pass
def helpers.TestModuleCommand.testCloning (   self)

Definition at line 330 of file helpers.py.

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

Definition at line 338 of file helpers.py.

References helpers.contains().

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

Definition at line 347 of file helpers.py.

References helpers.jetCollectionString().

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

Definition at line 350 of file helpers.py.

References helpers.listModules().

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

Definition at line 368 of file helpers.py.

References helpers.massSearchReplaceAnyInputTag().

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

Definition at line 357 of file helpers.py.

References helpers.massSearchReplaceParam().

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