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 154 of file MassReplace.py.

Member Function Documentation

◆ testMassReplaceInputTag()

def MassReplace.TestModuleCommand.testMassReplaceInputTag (   self)

Definition at line 214 of file MassReplace.py.

214  def testMassReplaceInputTag(self):
215  process1 = cms.Process("test")
216  massReplaceInputTag(process1, "a", "b", False, False, False)
217  self.assertEqual(process1.dumpPython(), cms.Process('test').dumpPython())
218  p = cms.Process("test")
219  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
220  p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
221  p.c = cms.EDProducer("ac", src=cms.InputTag("b"),
222  nested = cms.PSet(src = cms.InputTag("a"), src2 = cms.InputTag("c"), usrc = cms.untracked.InputTag("a")),
223  nestedv = cms.VPSet(cms.PSet(src = cms.InputTag("a")), cms.PSet(src = cms.InputTag("d"))),
224  unestedv = cms.untracked.VPSet(cms.untracked.PSet(src = cms.InputTag("a")), cms.untracked.PSet(src = cms.InputTag("d"))),
225  vec = cms.VInputTag(cms.InputTag("a"), cms.InputTag("b"), cms.InputTag("c"), cms.InputTag("d")),
226  uvec = cms.untracked.VInputTag(cms.untracked.InputTag("a"), cms.untracked.InputTag("b"), cms.untracked.InputTag("c"), cms.InputTag("d")),
227  )
228  p.d = cms.EDProducer("ab", src=cms.InputTag("a"))
229  p.e = cms.EDProducer("ab", src=cms.InputTag("a"))
230  p.f = cms.EDProducer("ab", src=cms.InputTag("a"))
231  p.g = cms.EDProducer("ab", src=cms.InputTag("a"))
232  p.h = cms.EDProducer("ab", src=cms.InputTag("a"))
233  p.i = cms.EDProducer("ab", src=cms.InputTag("a"))
234  p.sp = SwitchProducerTest(
235  test1 = cms.EDProducer("a", src = cms.InputTag("a"),
236  nested = cms.PSet(src = cms.InputTag("a"), src2 = cms.InputTag("c"), usrc = cms.untracked.InputTag("a"))
237  ),
238  test2 = cms.EDProducer("b", src = cms.InputTag("c"),
239  nested = cms.PSet(src = cms.InputTag("a"), src2 = cms.InputTag("c"), usrc = cms.untracked.InputTag("a"))
240  ),
241  )
242  p.s1 = cms.Sequence(p.a*p.b*p.c*p.sp)
243  p.path1 = cms.Path(p.s1)
244  p.s2 = cms.Sequence(p.d)
245  p.path2 = cms.Path(p.e)
246  p.s3 = cms.Sequence(p.f)
247  p.endpath1 = cms.EndPath(p.s3)
248  p.endpath2 = cms.EndPath(p.g)
249  p.t1 = cms.Task(p.h)
250  p.t2 = cms.Task(p.i)
251  p.schedule = cms.Schedule()
252  p.schedule.associate(p.t1, p.t2)
253  massReplaceInputTag(p, "a", "b", False, False, False)
254  self.assertEqual(cms.InputTag("b"), p.b.src)
255  self.assertEqual(cms.InputTag("b"), p.c.nested.src)
256  self.assertEqual(cms.InputTag("b"), p.c.nested.usrc)
257  self.assertFalse(p.c.nested.usrc.isTracked())
258  self.assertEqual(cms.InputTag("b"), p.c.nestedv[0].src)
259  self.assertEqual(cms.InputTag("b"), p.c.unestedv[0].src)
260  self.assertEqual(cms.InputTag("b"), p.c.vec[0])
261  self.assertEqual(cms.InputTag("c"), p.c.vec[2])
262  self.assertEqual(cms.InputTag("b"), p.c.uvec[0])
263  self.assertEqual(cms.InputTag("c"), p.c.uvec[2])
264  self.assertFalse(p.c.uvec[0].isTracked())
265  self.assertFalse(p.c.uvec[1].isTracked())
266  self.assertFalse(p.c.uvec[2].isTracked())
267  self.assertEqual(cms.InputTag("a"), p.d.src)
268  self.assertEqual(cms.InputTag("b"), p.e.src)
269  self.assertEqual(cms.InputTag("b"), p.f.src)
270  self.assertEqual(cms.InputTag("b"), p.g.src)
271  self.assertEqual(cms.InputTag("b"), p.h.src)
272  self.assertEqual(cms.InputTag("b"), p.i.src)
273  self.assertEqual(cms.InputTag("b"), p.sp.test1.src)
274  self.assertEqual(cms.InputTag("b"), p.sp.test1.nested.src)
275  self.assertEqual(cms.InputTag("c"), p.sp.test1.nested.src2)
276  self.assertEqual(cms.untracked.InputTag("b"), p.sp.test1.nested.usrc)
277  self.assertEqual(cms.InputTag("c"), p.sp.test2.src)
278  self.assertEqual(cms.InputTag("b"), p.sp.test2.nested.src)
279  self.assertEqual(cms.InputTag("c"), p.sp.test2.nested.src2)
280  self.assertEqual(cms.untracked.InputTag("b"), p.sp.test2.nested.usrc)
281 

References ConfigBuilder.dumpPython(), and MassReplace.massReplaceInputTag().

◆ testMassReplaceParam()

def MassReplace.TestModuleCommand.testMassReplaceParam (   self)

Definition at line 310 of file MassReplace.py.

310  def testMassReplaceParam(self):
311  process1 = cms.Process("test")
312  massReplaceParameter(process1, "src", cms.InputTag("a"), "b", False)
313  self.assertEqual(process1.dumpPython(), cms.Process("test").dumpPython())
314  p = cms.Process("test")
315  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
316  p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
317  p.c = cms.EDProducer("ac", src=cms.InputTag("b"),
318  nested = cms.PSet(src = cms.InputTag("a"), src2 = cms.InputTag("c")),
319  nestedv = cms.VPSet(cms.PSet(src = cms.InputTag("a")), cms.PSet(src = cms.InputTag("d"))),
320  vec = cms.VInputTag(cms.InputTag("a"), cms.InputTag("b"), cms.InputTag("c"), cms.InputTag("d"))
321  )
322  p.d = cms.EDProducer("ab", src=cms.InputTag("a"))
323  p.e = cms.EDProducer("ab", src=cms.InputTag("a"))
324  p.f = cms.EDProducer("ab", src=cms.InputTag("a"))
325  p.g = cms.EDProducer("ab", src=cms.InputTag("a"))
326  p.h = cms.EDProducer("ab", src=cms.InputTag("a"))
327  p.i = cms.EDProducer("ab", src=cms.InputTag("a"))
328  p.j = cms.EDProducer("ab", src=cms.untracked.InputTag("a"))
329  p.sp = SwitchProducerTest(
330  test1 = cms.EDProducer("a", src = cms.InputTag("a"),
331  nested = cms.PSet(src = cms.InputTag("a"))
332  ),
333  test2 = cms.EDProducer("b", src = cms.InputTag("a")),
334  )
335  p.s1 = cms.Sequence(p.a*p.b*p.c*p.sp)
336  p.path1 = cms.Path(p.s1)
337  p.s2 = cms.Sequence(p.d)
338  p.path2 = cms.Path(p.e)
339  p.s3 = cms.Sequence(p.f)
340  p.endpath1 = cms.EndPath(p.s3)
341  p.endpath2 = cms.EndPath(p.g)
342  p.t1 = cms.Task(p.h)
343  p.t2 = cms.Task(p.i, p.j)
344  p.schedule = cms.Schedule()
345  p.schedule.associate(p.t1, p.t2)
346  massReplaceParameter(p, "src",cms.InputTag("a"), "b", False)
347  self.assertEqual(cms.InputTag("gen"), p.a.src)
348  self.assertEqual(cms.InputTag("b"), p.b.src)
349  self.assertEqual(cms.InputTag("a"), p.c.vec[0])
350  self.assertEqual(cms.InputTag("c"), p.c.vec[2])
351  self.assertEqual(cms.InputTag("a"), p.d.src)
352  self.assertEqual(cms.InputTag("b"), p.e.src)
353  self.assertEqual(cms.InputTag("b"), p.f.src)
354  self.assertEqual(cms.InputTag("b"), p.g.src)
355  self.assertEqual(cms.InputTag("b"), p.h.src)
356  self.assertEqual(cms.InputTag("b"), p.i.src)
357  self.assertEqual(cms.untracked.InputTag("b"), p.j.src)
358  self.assertEqual(cms.InputTag("b"),p.sp.test1.src)
359  self.assertEqual(cms.InputTag("a"),p.sp.test1.nested.src)
360  self.assertEqual(cms.InputTag("b"),p.sp.test2.src)
361  unittest.main()

References ConfigBuilder.dumpPython(), and MassReplace.massReplaceParameter().

◆ testMassSearchReplaceAnyInputTag()

def MassReplace.TestModuleCommand.testMassSearchReplaceAnyInputTag (   self)

Definition at line 156 of file MassReplace.py.

156  def testMassSearchReplaceAnyInputTag(self):
157  p = cms.Process("test")
158  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
159  p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
160  p.c = cms.EDProducer("ac", src=cms.InputTag("b"), usrc=cms.untracked.InputTag("b"),
161  nested = cms.PSet(src = cms.InputTag("b"), src2 = cms.InputTag("c"), usrc = cms.untracked.InputTag("b")),
162  nestedv = cms.VPSet(cms.PSet(src = cms.InputTag("b")), cms.PSet(src = cms.InputTag("d"))),
163  unestedv = cms.untracked.VPSet(cms.untracked.PSet(src = cms.InputTag("b")), cms.untracked.PSet(src = cms.InputTag("d"))),
164  vec = cms.VInputTag(cms.InputTag("a"), cms.InputTag("b"), cms.InputTag("c"), cms.InputTag("d")),
165  uvec = cms.untracked.VInputTag(cms.untracked.InputTag("a"), cms.untracked.InputTag("b"), cms.untracked.InputTag("c"), cms.untracked.InputTag("d")),
166  )
167  p.sp = SwitchProducerTest(
168  test1 = cms.EDProducer("a", src = cms.InputTag("b"),
169  nested = cms.PSet(src = cms.InputTag("b"), src2 = cms.InputTag("c"), usrc = cms.untracked.InputTag("b"))
170  ),
171  test2 = cms.EDProducer("b", src = cms.InputTag("c"),
172  nested = cms.PSet(src = cms.InputTag("b"), src2 = cms.InputTag("c"), usrc = cms.untracked.InputTag("b"))
173  ),
174  )
175  p.op = cms.EDProducer("op", src = cms.optional.InputTag, unset = cms.optional.InputTag, vsrc = cms.optional.VInputTag, vunset = cms.optional.VInputTag)
176  p.op.src="b"
177  p.op.vsrc=cms.VInputTag("b")
178  p.s = cms.Sequence(p.a*p.b*p.c*p.sp*p.op)
179  massSearchReplaceAnyInputTag(p.s, cms.InputTag("b"), cms.InputTag("new"))
180  self.assertNotEqual(cms.InputTag("new"), p.b.src)
181  self.assertEqual(cms.InputTag("new"), p.c.src)
182  self.assertEqual(cms.InputTag("new"), p.c.usrc)
183  self.assertEqual(cms.InputTag("new"), p.c.nested.src)
184  self.assertEqual(cms.InputTag("new"), p.c.nested.usrc)
185  self.assertFalse(p.c.nested.usrc.isTracked())
186  self.assertNotEqual(cms.InputTag("new"), p.c.nested.src2)
187  self.assertEqual(cms.InputTag("new"), p.c.nestedv[0].src)
188  self.assertNotEqual(cms.InputTag("new"), p.c.nestedv[1].src)
189  self.assertEqual(cms.InputTag("new"), p.c.unestedv[0].src)
190  self.assertNotEqual(cms.InputTag("new"), p.c.unestedv[1].src)
191  self.assertNotEqual(cms.InputTag("new"), p.c.vec[0])
192  self.assertEqual(cms.InputTag("new"), p.c.vec[1])
193  self.assertNotEqual(cms.InputTag("new"), p.c.vec[2])
194  self.assertNotEqual(cms.InputTag("new"), p.c.vec[3])
195  self.assertNotEqual(cms.InputTag("new"), p.c.uvec[0])
196  self.assertEqual(cms.InputTag("new"), p.c.uvec[1])
197  self.assertNotEqual(cms.InputTag("new"), p.c.uvec[2])
198  self.assertNotEqual(cms.InputTag("new"), p.c.uvec[3])
199  self.assertFalse(p.c.uvec[0].isTracked())
200  self.assertFalse(p.c.uvec[1].isTracked())
201  self.assertFalse(p.c.uvec[2].isTracked())
202  self.assertFalse(p.c.uvec[3].isTracked())
203  self.assertEqual(cms.InputTag("new"), p.sp.test1.src)
204  self.assertEqual(cms.InputTag("new"), p.sp.test1.nested.src)
205  self.assertEqual(cms.InputTag("c"), p.sp.test1.nested.src2)
206  self.assertEqual(cms.untracked.InputTag("new"), p.sp.test1.nested.usrc)
207  self.assertEqual(cms.InputTag("c"), p.sp.test2.src)
208  self.assertEqual(cms.InputTag("new"), p.sp.test2.nested.src)
209  self.assertEqual(cms.InputTag("c"), p.sp.test2.nested.src2)
210  self.assertEqual(cms.untracked.InputTag("new"), p.sp.test2.nested.usrc)
211  self.assertEqual(cms.InputTag("new"), p.op.src)
212  self.assertEqual(cms.InputTag("new"), p.op.vsrc[0])
213 

References MassReplace.massSearchReplaceAnyInputTag().

◆ testMassSearchReplaceParam()

def MassReplace.TestModuleCommand.testMassSearchReplaceParam (   self)

Definition at line 282 of file MassReplace.py.

282  def testMassSearchReplaceParam(self):
283  p = cms.Process("test")
284  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
285  p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
286  p.c = cms.EDProducer("ac", src=cms.InputTag("b"),
287  nested = cms.PSet(src = cms.InputTag("c"), src2 = cms.InputTag("b"))
288  )
289  p.d = cms.EDProducer("ac", src=cms.untracked.InputTag("b"),
290  nested = cms.PSet(src = cms.InputTag("c"), src2 = cms.InputTag("b"))
291  )
292  p.sp = SwitchProducerTest(
293  test1 = cms.EDProducer("a", src = cms.InputTag("b"),
294  nested = cms.PSet(src = cms.InputTag("b"))
295  ),
296  test2 = cms.EDProducer("b", src = cms.InputTag("b")),
297  )
298  p.s = cms.Sequence(p.a*p.b*p.c*p.d*p.sp)
299  massSearchReplaceParam(p.s,"src",cms.InputTag("b"),"a")
300  self.assertEqual(cms.InputTag("a"),p.c.src)
301  self.assertEqual(cms.InputTag("c"),p.c.nested.src)
302  self.assertEqual(cms.InputTag("b"),p.c.nested.src2)
303  self.assertEqual(cms.untracked.InputTag("a"),p.d.src)
304  self.assertEqual(cms.InputTag("c"),p.d.nested.src)
305  self.assertEqual(cms.InputTag("b"),p.d.nested.src2)
306  self.assertEqual(cms.InputTag("a"),p.sp.test1.src)
307  self.assertEqual(cms.InputTag("b"),p.sp.test1.nested.src)
308  self.assertEqual(cms.InputTag("a"),p.sp.test2.src)
309 

References MassReplace.massSearchReplaceParam().

MassReplace.massSearchReplaceParam
def massSearchReplaceParam(sequence, paramName, paramOldValue, paramValue, verbose=False)
Definition: MassReplace.py:129
MassReplace.massReplaceInputTag
def massReplaceInputTag(process, old="rawDataCollector", new="rawDataRepacker", verbose=False, moduleLabelOnly=False, skipLabelTest=False)
Definition: MassReplace.py:83
MassReplace.massReplaceParameter
def massReplaceParameter(process, name="label", old="rawDataCollector", new="rawDataRepacker", verbose=False)
Definition: MassReplace.py:132
ConfigBuilder.dumpPython
def dumpPython(process, name)
Definition: ConfigBuilder.py:94
MassReplace.massSearchReplaceAnyInputTag
def massSearchReplaceAnyInputTag(sequence, oldInputTag, newInputTag, verbose=False, moduleLabelOnly=False, skipLabelTest=False)
Definition: MassReplace.py:79