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

Member Function Documentation

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

Definition at line 320 of file helpers.py.

321  def setUp(self):
322  """Nothing to do """
pass
def helpers.TestModuleCommand.testCloning (   self)

Definition at line 323 of file helpers.py.

324  def testCloning(self):
325  p = cms.Process("test")
326  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
327  p.b = cms.EDProducer("b", src=cms.InputTag("a"))
328  p.c = cms.EDProducer("c", src=cms.InputTag("b","instance"))
329  p.s = cms.Sequence(p.a*p.b*p.c *p.a)
330  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:302
def helpers.TestModuleCommand.testContains (   self)

Definition at line 331 of file helpers.py.

References helpers.contains().

332  def testContains(self):
333  p = cms.Process("test")
334  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
335  p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
336  p.c = cms.EDProducer("ac", src=cms.InputTag("b"))
337  p.s1 = cms.Sequence(p.a*p.b*p.c)
338  p.s2 = cms.Sequence(p.b*p.c)
339  self.assert_( contains(p.s1, "a") )
self.assert_( not contains(p.s2, "a") )
def contains
Definition: helpers.py:286
def helpers.TestModuleCommand.testJetCollectionString (   self)

Definition at line 340 of file helpers.py.

References helpers.jetCollectionString().

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

Definition at line 343 of file helpers.py.

References helpers.listModules().

344  def testListModules(self):
345  p = cms.Process("test")
346  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
347  p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
348  p.c = cms.EDProducer("ac", src=cms.InputTag("b"))
349  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:248
def helpers.TestModuleCommand.testMassSearchReplaceAnyInputTag (   self)

Definition at line 361 of file helpers.py.

References helpers.massSearchReplaceAnyInputTag().

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

Definition at line 350 of file helpers.py.

References helpers.massSearchReplaceParam().

351  def testMassSearchReplaceParam(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  nested = cms.PSet(src = cms.InputTag("c"))
357  )
358  p.s = cms.Sequence(p.a*p.b*p.c)
359  massSearchReplaceParam(p.s,"src",cms.InputTag("b"),"a")
360  self.assertEqual(cms.InputTag("a"),p.c.src)
self.assertNotEqual(cms.InputTag("a"),p.c.nested.src)
def massSearchReplaceParam
Definition: helpers.py:245