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

Member Function Documentation

def MassReplace.TestModuleCommand.testMassReplaceInputTag (   self)

Definition at line 156 of file MassReplace.py.

References MassReplace.massReplaceInputTag().

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

Definition at line 213 of file MassReplace.py.

References MassReplace.massReplaceParameter().

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

Definition at line 133 of file MassReplace.py.

References MassReplace.massSearchReplaceAnyInputTag().

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

Definition at line 201 of file MassReplace.py.

References MassReplace.massSearchReplaceParam().

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