CMS 3D CMS Logo

List of all members | Public Member Functions
MassReplace.TestModuleCommand Class Reference
Inheritance diagram for MassReplace.TestModuleCommand:

Public Member Functions

def testMassReplaceInputTag (self)
 
def testMassReplaceParam (self)
 
def testMassSearchReplaceAnyInputTag (self)
 
def testMassSearchReplaceParam (self)
 

Detailed Description

Definition at line 132 of file MassReplace.py.

Member Function Documentation

def MassReplace.TestModuleCommand.testMassReplaceInputTag (   self)

Definition at line 157 of file MassReplace.py.

References MassReplace.massReplaceInputTag().

158  process1 = cms.Process("test")
159  massReplaceInputTag(process1, "a", "b", False, False, False)
160  self.assertEqual(process1.dumpPython(),
161 """import FWCore.ParameterSet.Config as cms
162 
163 process = cms.Process("test")
164 
165 """)
166  p = cms.Process("test")
167  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
168  p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
169  p.c = cms.EDProducer("ac", src=cms.InputTag("b"),
170  nested = cms.PSet(src = cms.InputTag("a"), src2 = cms.InputTag("c")),
171  nestedv = cms.VPSet(cms.PSet(src = cms.InputTag("a")), cms.PSet(src = cms.InputTag("d"))),
172  vec = cms.VInputTag(cms.InputTag("a"), cms.InputTag("b"), cms.InputTag("c"), cms.InputTag("d"))
173  )
174  p.d = cms.EDProducer("ab", src=cms.InputTag("a"))
175  p.e = cms.EDProducer("ab", src=cms.InputTag("a"))
176  p.f = cms.EDProducer("ab", src=cms.InputTag("a"))
177  p.g = cms.EDProducer("ab", src=cms.InputTag("a"))
178  p.h = cms.EDProducer("ab", src=cms.InputTag("a"))
179  p.i = cms.EDProducer("ab", src=cms.InputTag("a"))
180  p.s1 = cms.Sequence(p.a*p.b*p.c)
181  p.path1 = cms.Path(p.s1)
182  p.s2 = cms.Sequence(p.d)
183  p.path2 = cms.Path(p.e)
184  p.s3 = cms.Sequence(p.f)
185  p.endpath1 = cms.EndPath(p.s3)
186  p.endpath2 = cms.EndPath(p.g)
187  p.t1 = cms.Task(p.h)
188  p.t2 = cms.Task(p.i)
189  p.schedule = cms.Schedule()
190  p.schedule.associate(p.t1, p.t2)
191  massReplaceInputTag(p, "a", "b", False, False, False)
192  self.assertEqual(cms.InputTag("b"), p.b.src)
193  self.assertEqual(cms.InputTag("b"), p.c.vec[0])
194  self.assertEqual(cms.InputTag("c"), p.c.vec[2])
195  self.assertEqual(cms.InputTag("a"), p.d.src)
196  self.assertEqual(cms.InputTag("b"), p.e.src)
197  self.assertEqual(cms.InputTag("b"), p.f.src)
198  self.assertEqual(cms.InputTag("b"), p.g.src)
199  self.assertEqual(cms.InputTag("b"), p.h.src)
200  self.assertEqual(cms.InputTag("b"), p.i.src)
201 
def massReplaceInputTag(process, old="rawDataCollector", new="rawDataRepacker", verbose=False, moduleLabelOnly=False, skipLabelTest=False)
Definition: MassReplace.py:77
def MassReplace.TestModuleCommand.testMassReplaceParam (   self)

Definition at line 214 of file MassReplace.py.

References MassReplace.massReplaceParameter().

215  process1 = cms.Process("test")
216  massReplaceParameter(process1, "src", cms.InputTag("a"), "b", False)
217  self.assertEqual(process1.dumpPython(),
218 """import FWCore.ParameterSet.Config as cms
219 
220 process = cms.Process("test")
221 
222 """)
223  p = cms.Process("test")
224  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
225  p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
226  p.c = cms.EDProducer("ac", src=cms.InputTag("b"),
227  nested = cms.PSet(src = cms.InputTag("a"), src2 = cms.InputTag("c")),
228  nestedv = cms.VPSet(cms.PSet(src = cms.InputTag("a")), cms.PSet(src = cms.InputTag("d"))),
229  vec = cms.VInputTag(cms.InputTag("a"), cms.InputTag("b"), cms.InputTag("c"), cms.InputTag("d"))
230  )
231  p.d = cms.EDProducer("ab", src=cms.InputTag("a"))
232  p.e = cms.EDProducer("ab", src=cms.InputTag("a"))
233  p.f = cms.EDProducer("ab", src=cms.InputTag("a"))
234  p.g = cms.EDProducer("ab", src=cms.InputTag("a"))
235  p.h = cms.EDProducer("ab", src=cms.InputTag("a"))
236  p.i = cms.EDProducer("ab", src=cms.InputTag("a"))
237  p.s1 = cms.Sequence(p.a*p.b*p.c)
238  p.path1 = cms.Path(p.s1)
239  p.s2 = cms.Sequence(p.d)
240  p.path2 = cms.Path(p.e)
241  p.s3 = cms.Sequence(p.f)
242  p.endpath1 = cms.EndPath(p.s3)
243  p.endpath2 = cms.EndPath(p.g)
244  p.t1 = cms.Task(p.h)
245  p.t2 = cms.Task(p.i)
246  p.schedule = cms.Schedule()
247  p.schedule.associate(p.t1, p.t2)
248  massReplaceParameter(p, "src",cms.InputTag("a"), "b", False)
249  self.assertEqual(cms.InputTag("gen"), p.a.src)
250  self.assertEqual(cms.InputTag("b"), p.b.src)
251  self.assertEqual(cms.InputTag("a"), p.c.vec[0])
252  self.assertEqual(cms.InputTag("c"), p.c.vec[2])
253  self.assertEqual(cms.InputTag("a"), p.d.src)
254  self.assertEqual(cms.InputTag("b"), p.e.src)
255  self.assertEqual(cms.InputTag("b"), p.f.src)
256  self.assertEqual(cms.InputTag("b"), p.g.src)
257  self.assertEqual(cms.InputTag("b"), p.h.src)
258  self.assertEqual(cms.InputTag("b"), p.i.src)
259  unittest.main()
def massReplaceParameter(process, name="label", old="rawDataCollector", new="rawDataRepacker", verbose=False)
Definition: MassReplace.py:120
def MassReplace.TestModuleCommand.testMassSearchReplaceAnyInputTag (   self)

Definition at line 134 of file MassReplace.py.

References MassReplace.massSearchReplaceAnyInputTag().

135  p = cms.Process("test")
136  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
137  p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
138  p.c = cms.EDProducer("ac", src=cms.InputTag("b"),
139  nested = cms.PSet(src = cms.InputTag("b"), src2 = cms.InputTag("c")),
140  nestedv = cms.VPSet(cms.PSet(src = cms.InputTag("b")), cms.PSet(src = cms.InputTag("d"))),
141  vec = cms.VInputTag(cms.InputTag("a"), cms.InputTag("b"), cms.InputTag("c"), cms.InputTag("d"))
142  )
143  p.s = cms.Sequence(p.a*p.b*p.c)
144  massSearchReplaceAnyInputTag(p.s, cms.InputTag("b"), cms.InputTag("new"))
145  self.assertNotEqual(cms.InputTag("new"), p.b.src)
146  self.assertEqual(cms.InputTag("new"), p.c.src)
147  self.assertEqual(cms.InputTag("new"), p.c.nested.src)
148  self.assertEqual(cms.InputTag("new"), p.c.nested.src)
149  self.assertNotEqual(cms.InputTag("new"), p.c.nested.src2)
150  self.assertEqual(cms.InputTag("new"), p.c.nestedv[0].src)
151  self.assertNotEqual(cms.InputTag("new"), p.c.nestedv[1].src)
152  self.assertNotEqual(cms.InputTag("new"), p.c.vec[0])
153  self.assertEqual(cms.InputTag("new"), p.c.vec[1])
154  self.assertNotEqual(cms.InputTag("new"), p.c.vec[2])
155  self.assertNotEqual(cms.InputTag("new"), p.c.vec[3])
156 
def massSearchReplaceAnyInputTag(sequence, oldInputTag, newInputTag, verbose=False, moduleLabelOnly=False, skipLabelTest=False)
Definition: MassReplace.py:73
def testMassSearchReplaceAnyInputTag(self)
Definition: MassReplace.py:134
def MassReplace.TestModuleCommand.testMassSearchReplaceParam (   self)

Definition at line 202 of file MassReplace.py.

References MassReplace.massSearchReplaceParam().

203  p = cms.Process("test")
204  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
205  p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
206  p.c = cms.EDProducer("ac", src=cms.InputTag("b"),
207  nested = cms.PSet(src = cms.InputTag("c"))
208  )
209  p.s = cms.Sequence(p.a*p.b*p.c)
210  massSearchReplaceParam(p.s,"src",cms.InputTag("b"),"a")
211  self.assertEqual(cms.InputTag("a"),p.c.src)
212  self.assertNotEqual(cms.InputTag("a"),p.c.nested.src)
213 
def massSearchReplaceParam(sequence, paramName, paramOldValue, paramValue, verbose=False)
Definition: MassReplace.py:117