CMS 3D CMS Logo

Public Member Functions

helpers::TestModuleCommand Class Reference

List of all members.

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.

00281                       :
00282            """Nothing to do """
           pass
def helpers::TestModuleCommand::testCloning (   self)

Definition at line 283 of file helpers.py.

00284                             :
00285            p = cms.Process("test")
00286            p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
00287            p.b = cms.EDProducer("b", src=cms.InputTag("a"))
00288            p.c = cms.EDProducer("c", src=cms.InputTag("b","instance"))
00289            p.s = cms.Sequence(p.a*p.b*p.c *p.a)
00290            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 helpers::TestModuleCommand::testContains (   self)

Definition at line 291 of file helpers.py.

00292                              :
00293            p = cms.Process("test")
00294            p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
00295            p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
00296            p.c = cms.EDProducer("ac", src=cms.InputTag("b"))
00297            p.s1 = cms.Sequence(p.a*p.b*p.c)
00298            p.s2 = cms.Sequence(p.b*p.c)
00299            self.assert_( contains(p.s1, "a") )
           self.assert_( not contains(p.s2, "a") )
def helpers::TestModuleCommand::testJetCollectionString (   self)

Definition at line 300 of file helpers.py.

00301                                         :
00302            self.assertEqual(jetCollectionString(algo = 'Foo', type = 'Bar'), 'patFooBarJets')
           self.assertEqual(jetCollectionString(prefix = 'prefix', algo = 'Foo', type = 'Bar'), 'prefixPatFooBarJets')
def helpers::TestModuleCommand::testListModules (   self)

Definition at line 303 of file helpers.py.

00304                                 :
00305            p = cms.Process("test")
00306            p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
00307            p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
00308            p.c = cms.EDProducer("ac", src=cms.InputTag("b"))
00309            p.s = cms.Sequence(p.a*p.b*p.c)
           self.assertEqual([p.a,p.b,p.c], listModules(p.s))
def helpers::TestModuleCommand::testMassSearchReplaceAnyInputTag (   self)

Definition at line 321 of file helpers.py.

00322                                                  :
00323            p = cms.Process("test")
00324            p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
00325            p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
00326            p.c = cms.EDProducer("ac", src=cms.InputTag("b"),
00327                                 nested = cms.PSet(src = cms.InputTag("b"), src2 = cms.InputTag("c")),
00328                                 nestedv = cms.VPSet(cms.PSet(src = cms.InputTag("b")), cms.PSet(src = cms.InputTag("d"))),
00329                                 vec = cms.VInputTag(cms.InputTag("a"), cms.InputTag("b"), cms.InputTag("c"), cms.InputTag("d"))
00330                                )
00331            p.s = cms.Sequence(p.a*p.b*p.c)
00332            massSearchReplaceAnyInputTag(p.s, cms.InputTag("b"), cms.InputTag("new"))
00333            self.assertNotEqual(cms.InputTag("new"), p.b.src)
00334            self.assertEqual(cms.InputTag("new"), p.c.src)
00335            self.assertEqual(cms.InputTag("new"), p.c.nested.src)
00336            self.assertEqual(cms.InputTag("new"), p.c.nested.src)
00337            self.assertNotEqual(cms.InputTag("new"), p.c.nested.src2)
00338            self.assertEqual(cms.InputTag("new"), p.c.nestedv[0].src)
00339            self.assertNotEqual(cms.InputTag("new"), p.c.nestedv[1].src)
00340            self.assertNotEqual(cms.InputTag("new"), p.c.vec[0])
00341            self.assertEqual(cms.InputTag("new"), p.c.vec[1])
00342            self.assertNotEqual(cms.InputTag("new"), p.c.vec[2])
00343            self.assertNotEqual(cms.InputTag("new"), p.c.vec[3])
00344 
00345 
   unittest.main()
def helpers::TestModuleCommand::testMassSearchReplaceParam (   self)

Definition at line 310 of file helpers.py.

00311                                            :
00312            p = cms.Process("test")
00313            p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
00314            p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
00315            p.c = cms.EDProducer("ac", src=cms.InputTag("b"),
00316                                 nested = cms.PSet(src = cms.InputTag("c"))
00317                                )
00318            p.s = cms.Sequence(p.a*p.b*p.c)
00319            massSearchReplaceParam(p.s,"src",cms.InputTag("b"),"a")
00320            self.assertEqual(cms.InputTag("a"),p.c.src)
           self.assertNotEqual(cms.InputTag("a"),p.c.nested.src)