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

Member Function Documentation

def MassReplace.TestModuleCommand.testMassReplaceInputTag (   self)

Definition at line 155 of file MassReplace.py.

References MassReplace.massReplaceInputTag().

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

Definition at line 212 of file MassReplace.py.

References MassReplace.massReplaceParameter().

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

Definition at line 132 of file MassReplace.py.

References MassReplace.massSearchReplaceAnyInputTag().

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

Definition at line 200 of file MassReplace.py.

References MassReplace.massSearchReplaceParam().

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