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

209  def testMassReplaceInputTag(self):
210  process1 = cms.Process("test")
211  massReplaceInputTag(process1, "a", "b", False, False, False)
212  self.assertEqual(process1.dumpPython(), cms.Process('test').dumpPython())
213  p = cms.Process("test")
214  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
215  p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
216  p.c = cms.EDProducer("ac", src=cms.InputTag("b"),
217  nested = cms.PSet(src = cms.InputTag("a"), src2 = cms.InputTag("c"), usrc = cms.untracked.InputTag("a")),
218  nestedv = cms.VPSet(cms.PSet(src = cms.InputTag("a")), cms.PSet(src = cms.InputTag("d"))),
219  unestedv = cms.untracked.VPSet(cms.untracked.PSet(src = cms.InputTag("a")), cms.untracked.PSet(src = cms.InputTag("d"))),
220  vec = cms.VInputTag(cms.InputTag("a"), cms.InputTag("b"), cms.InputTag("c"), cms.InputTag("d")),
221  uvec = cms.untracked.VInputTag(cms.untracked.InputTag("a"), cms.untracked.InputTag("b"), cms.untracked.InputTag("c"), cms.InputTag("d")),
222  )
223  p.d = cms.EDProducer("ab", src=cms.InputTag("a"))
224  p.e = cms.EDProducer("ab", src=cms.InputTag("a"))
225  p.f = cms.EDProducer("ab", src=cms.InputTag("a"))
226  p.g = cms.EDProducer("ab", src=cms.InputTag("a"))
227  p.h = cms.EDProducer("ab", src=cms.InputTag("a"))
228  p.i = cms.EDProducer("ab", src=cms.InputTag("a"))
229  p.sp = SwitchProducerTest(
230  test1 = cms.EDProducer("a", src = cms.InputTag("a"),
231  nested = cms.PSet(src = cms.InputTag("a"), src2 = cms.InputTag("c"), usrc = cms.untracked.InputTag("a"))
232  ),
233  test2 = cms.EDProducer("b", src = cms.InputTag("c"),
234  nested = cms.PSet(src = cms.InputTag("a"), src2 = cms.InputTag("c"), usrc = cms.untracked.InputTag("a"))
235  ),
236  )
237  p.s1 = cms.Sequence(p.a*p.b*p.c*p.sp)
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  massReplaceInputTag(p, "a", "b", False, False, False)
249  self.assertEqual(cms.InputTag("b"), p.b.src)
250  self.assertEqual(cms.InputTag("b"), p.c.nested.src)
251  self.assertEqual(cms.InputTag("b"), p.c.nested.usrc)
252  self.assertFalse(p.c.nested.usrc.isTracked())
253  self.assertEqual(cms.InputTag("b"), p.c.nestedv[0].src)
254  self.assertEqual(cms.InputTag("b"), p.c.unestedv[0].src)
255  self.assertEqual(cms.InputTag("b"), p.c.vec[0])
256  self.assertEqual(cms.InputTag("c"), p.c.vec[2])
257  self.assertEqual(cms.InputTag("b"), p.c.uvec[0])
258  self.assertEqual(cms.InputTag("c"), p.c.uvec[2])
259  self.assertFalse(p.c.uvec[0].isTracked())
260  self.assertFalse(p.c.uvec[1].isTracked())
261  self.assertFalse(p.c.uvec[2].isTracked())
262  self.assertEqual(cms.InputTag("a"), p.d.src)
263  self.assertEqual(cms.InputTag("b"), p.e.src)
264  self.assertEqual(cms.InputTag("b"), p.f.src)
265  self.assertEqual(cms.InputTag("b"), p.g.src)
266  self.assertEqual(cms.InputTag("b"), p.h.src)
267  self.assertEqual(cms.InputTag("b"), p.i.src)
268  self.assertEqual(cms.InputTag("b"), p.sp.test1.src)
269  self.assertEqual(cms.InputTag("b"), p.sp.test1.nested.src)
270  self.assertEqual(cms.InputTag("c"), p.sp.test1.nested.src2)
271  self.assertEqual(cms.untracked.InputTag("b"), p.sp.test1.nested.usrc)
272  self.assertEqual(cms.InputTag("c"), p.sp.test2.src)
273  self.assertEqual(cms.InputTag("b"), p.sp.test2.nested.src)
274  self.assertEqual(cms.InputTag("c"), p.sp.test2.nested.src2)
275  self.assertEqual(cms.untracked.InputTag("b"), p.sp.test2.nested.usrc)
276 

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

◆ testMassReplaceParam()

def MassReplace.TestModuleCommand.testMassReplaceParam (   self)

Definition at line 305 of file MassReplace.py.

305  def testMassReplaceParam(self):
306  process1 = cms.Process("test")
307  massReplaceParameter(process1, "src", cms.InputTag("a"), "b", False)
308  self.assertEqual(process1.dumpPython(), cms.Process("test").dumpPython())
309  p = cms.Process("test")
310  p.a = cms.EDProducer("a", src=cms.InputTag("gen"))
311  p.b = cms.EDProducer("ab", src=cms.InputTag("a"))
312  p.c = cms.EDProducer("ac", src=cms.InputTag("b"),
313  nested = cms.PSet(src = cms.InputTag("a"), src2 = cms.InputTag("c")),
314  nestedv = cms.VPSet(cms.PSet(src = cms.InputTag("a")), cms.PSet(src = cms.InputTag("d"))),
315  vec = cms.VInputTag(cms.InputTag("a"), cms.InputTag("b"), cms.InputTag("c"), cms.InputTag("d"))
316  )
317  p.d = cms.EDProducer("ab", src=cms.InputTag("a"))
318  p.e = cms.EDProducer("ab", src=cms.InputTag("a"))
319  p.f = cms.EDProducer("ab", src=cms.InputTag("a"))
320  p.g = cms.EDProducer("ab", src=cms.InputTag("a"))
321  p.h = cms.EDProducer("ab", src=cms.InputTag("a"))
322  p.i = cms.EDProducer("ab", src=cms.InputTag("a"))
323  p.j = cms.EDProducer("ab", src=cms.untracked.InputTag("a"))
324  p.sp = SwitchProducerTest(
325  test1 = cms.EDProducer("a", src = cms.InputTag("a"),
326  nested = cms.PSet(src = cms.InputTag("a"))
327  ),
328  test2 = cms.EDProducer("b", src = cms.InputTag("a")),
329  )
330  p.s1 = cms.Sequence(p.a*p.b*p.c*p.sp)
331  p.path1 = cms.Path(p.s1)
332  p.s2 = cms.Sequence(p.d)
333  p.path2 = cms.Path(p.e)
334  p.s3 = cms.Sequence(p.f)
335  p.endpath1 = cms.EndPath(p.s3)
336  p.endpath2 = cms.EndPath(p.g)
337  p.t1 = cms.Task(p.h)
338  p.t2 = cms.Task(p.i, p.j)
339  p.schedule = cms.Schedule()
340  p.schedule.associate(p.t1, p.t2)
341  massReplaceParameter(p, "src",cms.InputTag("a"), "b", False)
342  self.assertEqual(cms.InputTag("gen"), p.a.src)
343  self.assertEqual(cms.InputTag("b"), p.b.src)
344  self.assertEqual(cms.InputTag("a"), p.c.vec[0])
345  self.assertEqual(cms.InputTag("c"), p.c.vec[2])
346  self.assertEqual(cms.InputTag("a"), p.d.src)
347  self.assertEqual(cms.InputTag("b"), p.e.src)
348  self.assertEqual(cms.InputTag("b"), p.f.src)
349  self.assertEqual(cms.InputTag("b"), p.g.src)
350  self.assertEqual(cms.InputTag("b"), p.h.src)
351  self.assertEqual(cms.InputTag("b"), p.i.src)
352  self.assertEqual(cms.untracked.InputTag("b"), p.j.src)
353  self.assertEqual(cms.InputTag("b"),p.sp.test1.src)
354  self.assertEqual(cms.InputTag("a"),p.sp.test1.nested.src)
355  self.assertEqual(cms.InputTag("b"),p.sp.test2.src)
356  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.s = cms.Sequence(p.a*p.b*p.c*p.sp)
176  massSearchReplaceAnyInputTag(p.s, cms.InputTag("b"), cms.InputTag("new"))
177  self.assertNotEqual(cms.InputTag("new"), p.b.src)
178  self.assertEqual(cms.InputTag("new"), p.c.src)
179  self.assertEqual(cms.InputTag("new"), p.c.usrc)
180  self.assertEqual(cms.InputTag("new"), p.c.nested.src)
181  self.assertEqual(cms.InputTag("new"), p.c.nested.usrc)
182  self.assertFalse(p.c.nested.usrc.isTracked())
183  self.assertNotEqual(cms.InputTag("new"), p.c.nested.src2)
184  self.assertEqual(cms.InputTag("new"), p.c.nestedv[0].src)
185  self.assertNotEqual(cms.InputTag("new"), p.c.nestedv[1].src)
186  self.assertEqual(cms.InputTag("new"), p.c.unestedv[0].src)
187  self.assertNotEqual(cms.InputTag("new"), p.c.unestedv[1].src)
188  self.assertNotEqual(cms.InputTag("new"), p.c.vec[0])
189  self.assertEqual(cms.InputTag("new"), p.c.vec[1])
190  self.assertNotEqual(cms.InputTag("new"), p.c.vec[2])
191  self.assertNotEqual(cms.InputTag("new"), p.c.vec[3])
192  self.assertNotEqual(cms.InputTag("new"), p.c.uvec[0])
193  self.assertEqual(cms.InputTag("new"), p.c.uvec[1])
194  self.assertNotEqual(cms.InputTag("new"), p.c.uvec[2])
195  self.assertNotEqual(cms.InputTag("new"), p.c.uvec[3])
196  self.assertFalse(p.c.uvec[0].isTracked())
197  self.assertFalse(p.c.uvec[1].isTracked())
198  self.assertFalse(p.c.uvec[2].isTracked())
199  self.assertFalse(p.c.uvec[3].isTracked())
200  self.assertEqual(cms.InputTag("new"), p.sp.test1.src)
201  self.assertEqual(cms.InputTag("new"), p.sp.test1.nested.src)
202  self.assertEqual(cms.InputTag("c"), p.sp.test1.nested.src2)
203  self.assertEqual(cms.untracked.InputTag("new"), p.sp.test1.nested.usrc)
204  self.assertEqual(cms.InputTag("c"), p.sp.test2.src)
205  self.assertEqual(cms.InputTag("new"), p.sp.test2.nested.src)
206  self.assertEqual(cms.InputTag("c"), p.sp.test2.nested.src2)
207  self.assertEqual(cms.untracked.InputTag("new"), p.sp.test2.nested.usrc)
208 

References MassReplace.massSearchReplaceAnyInputTag().

◆ testMassSearchReplaceParam()

def MassReplace.TestModuleCommand.testMassSearchReplaceParam (   self)

Definition at line 277 of file MassReplace.py.

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

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:92
MassReplace.massSearchReplaceAnyInputTag
def massSearchReplaceAnyInputTag(sequence, oldInputTag, newInputTag, verbose=False, moduleLabelOnly=False, skipLabelTest=False)
Definition: MassReplace.py:79