Ejemplo n.º 1
0
        def testModifiedObjectsHistory(self):
            process = cms.Process('unittest')
            process.source=Source("PoolSource",fileNames = cms.untracked.string("file:file.root"))
            
            changeSource(process,"file:filename.root")
            self.assertEqual(len(process.history()[0][1]),1)
            
            process.source.fileNames=cms.untracked.vstring("file:replacedfile.root") 
            self.assertEqual(len(process.history()[0][1]),1)
            self.assertEqual(len(process.history()[1][1]),1)

            process.source.fileNames=["test2"]
            self.assertEqual(len(process.history()[0][1]),1)
            self.assertEqual(len(process.history()[1][1]),1)

            changeSource(process,"file:filename2.root")
            self.assertEqual(len(process.history()[0][1]),1)
            self.assertEqual(len(process.history()[1][1]),1)
            self.assertEqual(len(process.history()[2][1]),1)
            
            process.source.fileNames=cms.untracked.vstring("file:replacedfile2.root") 
            self.assertEqual(len(process.history()[0][1]),1)
            self.assertEqual(len(process.history()[1][1]),1)
            self.assertEqual(len(process.history()[2][1]),1)
            self.assertEqual(len(process.history()[3][1]),1)
Ejemplo n.º 2
0
        def testdumpHistory(self):
            process = cms.Process('unittest')
            process.source=Source("PoolSource",fileNames = cms.untracked.string("file:file.root"))
            
            changeSource(process,"file:filename.root")
            self.assertEqual(changeSource._parameters['source'].value,"file:filename.root")
            
            changeSource(process,"file:filename2.root")
            self.assertEqual(changeSource._parameters['source'].value,"file:filename2.root")
            
            changeSource(process,"file:filename3.root")
            self.assertEqual(changeSource._parameters['source'].value,"file:filename3.root")
    
            self.assertEqual(process.dumpHistory(),"\nfrom FWCore.GuiBrowsers.editorTools import *\n\nchangeSource(process , 'file:filename.root')\n\n\nchangeSource(process , 'file:filename2.root')\n\n\nchangeSource(process , 'file:filename3.root')\n\n")
            
            process.source.fileNames=cms.untracked.vstring("file:replacedfile.root") 
            self.assertEqual(process.dumpHistory(),"\nfrom FWCore.GuiBrowsers.editorTools import *\n\nchangeSource(process , 'file:filename.root')\n\n\nchangeSource(process , 'file:filename2.root')\n\n\nchangeSource(process , 'file:filename3.root')\n\nprocess.source.fileNames = cms.untracked.vstring('file:replacedfile.root')\n")
            
            process.disableRecording()
            changeSource.setParameter('source',"file:filename4.root")
            action=changeSource.__copy__()
            process.addAction(action)
            self.assertEqual(process.dumpHistory(),"\nfrom FWCore.GuiBrowsers.editorTools import *\n\nchangeSource(process , 'file:filename.root')\n\n\nchangeSource(process , 'file:filename2.root')\n\n\nchangeSource(process , 'file:filename3.root')\n\nprocess.source.fileNames = cms.untracked.vstring('file:replacedfile.root')\n")
            
            process.enableRecording()
            changeSource.setParameter('source',"file:filename5.root")
            action=changeSource.__copy__()
            process.addAction(action)
            process.deleteAction(3)
            self.assertEqual(process.dumpHistory(),"\nfrom FWCore.GuiBrowsers.editorTools import *\n\nchangeSource(process , 'file:filename.root')\n\n\nchangeSource(process , 'file:filename2.root')\n\n\nchangeSource(process , 'file:filename3.root')\n\n\nchangeSource(process , 'file:filename5.root')\n\n")

            process.deleteAction(0)
            self.assertEqual(process.dumpHistory(),"\nfrom FWCore.GuiBrowsers.editorTools import *\n\nchangeSource(process , 'file:filename2.root')\n\n\nchangeSource(process , 'file:filename3.root')\n\n\nchangeSource(process , 'file:filename5.root')\n\n")