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

Member Function Documentation

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

Definition at line 280 of file helpers.py.

281  def setUp(self):
282  """Nothing to do """
pass
def helpers.TestModuleCommand.testCloning (   self)

Definition at line 283 of file helpers.py.

284  def testCloning(self):
285  p = cms.Process("test")
286  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
287  p.b = cms.EDProducer("b", src=cms.InputTag("a"))
288  p.c = cms.EDProducer("c", src=cms.InputTag("b","instance"))
289  p.s = cms.Sequence(p.a*p.b*p.c *p.a)
290  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:262
def helpers.TestModuleCommand.testContains (   self)

Definition at line 291 of file helpers.py.

References helpers.contains().

292  def testContains(self):
293  p = cms.Process("test")
294  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
295  p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
296  p.c = cms.EDProducer("ac", src=cms.InputTag("b"))
297  p.s1 = cms.Sequence(p.a*p.b*p.c)
298  p.s2 = cms.Sequence(p.b*p.c)
299  self.assert_( contains(p.s1, "a") )
self.assert_( not contains(p.s2, "a") )
def contains
Definition: helpers.py:246
def helpers.TestModuleCommand.testJetCollectionString (   self)

Definition at line 300 of file helpers.py.

References helpers.jetCollectionString().

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

Definition at line 303 of file helpers.py.

References helpers.listModules().

304  def testListModules(self):
305  p = cms.Process("test")
306  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
307  p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
308  p.c = cms.EDProducer("ac", src=cms.InputTag("b"))
309  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:208
def helpers.TestModuleCommand.testMassSearchReplaceAnyInputTag (   self)

Definition at line 321 of file helpers.py.

References helpers.massSearchReplaceAnyInputTag().

323  p = cms.Process("test")
324  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
325  p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
326  p.c = cms.EDProducer("ac", src=cms.InputTag("b"),
327  nested = cms.PSet(src = cms.InputTag("b"), src2 = cms.InputTag("c")),
328  nestedv = cms.VPSet(cms.PSet(src = cms.InputTag("b")), cms.PSet(src = cms.InputTag("d"))),
329  vec = cms.VInputTag(cms.InputTag("a"), cms.InputTag("b"), cms.InputTag("c"), cms.InputTag("d"))
330  )
331  p.s = cms.Sequence(p.a*p.b*p.c)
332  massSearchReplaceAnyInputTag(p.s, cms.InputTag("b"), cms.InputTag("new"))
333  self.assertNotEqual(cms.InputTag("new"), p.b.src)
334  self.assertEqual(cms.InputTag("new"), p.c.src)
335  self.assertEqual(cms.InputTag("new"), p.c.nested.src)
336  self.assertEqual(cms.InputTag("new"), p.c.nested.src)
337  self.assertNotEqual(cms.InputTag("new"), p.c.nested.src2)
338  self.assertEqual(cms.InputTag("new"), p.c.nestedv[0].src)
339  self.assertNotEqual(cms.InputTag("new"), p.c.nestedv[1].src)
340  self.assertNotEqual(cms.InputTag("new"), p.c.vec[0])
341  self.assertEqual(cms.InputTag("new"), p.c.vec[1])
342  self.assertNotEqual(cms.InputTag("new"), p.c.vec[2])
343  self.assertNotEqual(cms.InputTag("new"), p.c.vec[3])
344 
345 
unittest.main()
def massSearchReplaceAnyInputTag
Definition: helpers.py:218
def testMassSearchReplaceAnyInputTag
Definition: helpers.py:321
def helpers.TestModuleCommand.testMassSearchReplaceParam (   self)

Definition at line 310 of file helpers.py.

References helpers.massSearchReplaceParam().

311  def testMassSearchReplaceParam(self):
312  p = cms.Process("test")
313  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
314  p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
315  p.c = cms.EDProducer("ac", src=cms.InputTag("b"),
316  nested = cms.PSet(src = cms.InputTag("c"))
317  )
318  p.s = cms.Sequence(p.a*p.b*p.c)
319  massSearchReplaceParam(p.s,"src",cms.InputTag("b"),"a")
320  self.assertEqual(cms.InputTag("a"),p.c.src)
self.assertNotEqual(cms.InputTag("a"),p.c.nested.src)
def massSearchReplaceParam
Definition: helpers.py:205