CMS 3D CMS Logo

List of all members | Public Member Functions
EnablePSetHistory.TestModificationTracking Class Reference
Inheritance diagram for EnablePSetHistory.TestModificationTracking:

Public Member Functions

def setUp (self)
 
def testdumpHistory (self)
 
def testModifiedObjectsHistory (self)
 
def testPSet (self)
 
def testSeq (self)
 

Detailed Description

Definition at line 559 of file EnablePSetHistory.py.

Member Function Documentation

def EnablePSetHistory.TestModificationTracking.setUp (   self)

Definition at line 560 of file EnablePSetHistory.py.

def EnablePSetHistory.TestModificationTracking.testdumpHistory (   self)

Definition at line 656 of file EnablePSetHistory.py.

References PFJetToCaloProducer_cfi.Source.

656  def testdumpHistory(self):
657  process = cms.Process('unittest')
658  process.source=Source("PoolSource",fileNames = cms.untracked.string("file:file.root"))
659 
660  changeSource(process,"file:filename.root")
661  self.assertEqual(changeSource._parameters['source'].value,"file:filename.root")
662 
663  changeSource(process,"file:filename2.root")
664  self.assertEqual(changeSource._parameters['source'].value,"file:filename2.root")
665 
666  changeSource(process,"file:filename3.root")
667  self.assertEqual(changeSource._parameters['source'].value,"file:filename3.root")
668 
669  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")
670 
671  process.source.fileNames=cms.untracked.vstring("file:replacedfile.root")
672  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")
673 
674  process.disableRecording()
675  changeSource.setParameter('source',"file:filename4.root")
676  action=changeSource.__copy__()
677  process.addAction(action)
678  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")
679 
680  process.enableRecording()
681  changeSource.setParameter('source',"file:filename5.root")
682  action=changeSource.__copy__()
683  process.addAction(action)
684  process.deleteAction(3)
685  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")
686 
687  process.deleteAction(0)
688  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")
689 
def EnablePSetHistory.TestModificationTracking.testModifiedObjectsHistory (   self)

Definition at line 690 of file EnablePSetHistory.py.

References PFJetToCaloProducer_cfi.Source.

691  process = cms.Process('unittest')
692  process.source=Source("PoolSource",fileNames = cms.untracked.string("file:file.root"))
693 
694  changeSource(process,"file:filename.root")
695  self.assertEqual(len(process.history()[0][1]),1)
696 
697  process.source.fileNames=cms.untracked.vstring("file:replacedfile.root")
698  self.assertEqual(len(process.history()[0][1]),1)
699  self.assertEqual(len(process.history()[1][1]),1)
700 
701  process.source.fileNames=["test2"]
702  self.assertEqual(len(process.history()[0][1]),1)
703  self.assertEqual(len(process.history()[1][1]),1)
704 
705  changeSource(process,"file:filename2.root")
706  self.assertEqual(len(process.history()[0][1]),1)
707  self.assertEqual(len(process.history()[1][1]),1)
708  self.assertEqual(len(process.history()[2][1]),1)
709 
710  process.source.fileNames=cms.untracked.vstring("file:replacedfile2.root")
711  self.assertEqual(len(process.history()[0][1]),1)
712  self.assertEqual(len(process.history()[1][1]),1)
713  self.assertEqual(len(process.history()[2][1]),1)
714  self.assertEqual(len(process.history()[3][1]),1)
715 
716  unittest.main()
def EnablePSetHistory.TestModificationTracking.testPSet (   self)

Definition at line 562 of file EnablePSetHistory.py.

562  def testPSet(self):
563  ex = cms.EDAnalyzer("Example",
564  one = cms.double(0),
565  two = cms.bool(True),
566  ps = cms.PSet(
567  three = cms.int32(10),
568  four = cms.string('abc')
569  ),
570  vps = cms.VPSet(
571  cms.PSet(
572  five = cms.InputTag('alpha')
573  ),
574  cms.PSet(
575  six = cms.vint32(1,2,3)
576  )
577  ),
578  seven = cms.vstring('alpha','bravo','charlie'),
579  eight = cms.vuint32(list(range(10))),
580  nine = cms.int32(0)
581  )
582  ex.zero = cms.string('hello')
583  self.assertEqual(ex._modifications[-1]['name'],'zero')
584  ex.one = cms.double(1)
585  ex.one = cms.double(2)
586  ex.one = cms.double(3)
587  self.assertEqual(ex._modifications[-1]['name'],'one')
588  self.assertEqual(ex._modifications[-2]['name'],'one')
589  self.assertEqual(ex._modifications[-3]['name'],'one')
590  ex.two = False
591  self.assertEqual(ex._modifications[-1]['name'],'two')
592  ex.ps.three.setValue(100) # MISSED
593  #self.assertEqual(ex.ps._modifications.pop()['name'],'three')
594  ex.ps.four = 'def'
595  self.assertEqual(ex.ps._modifications[-1]['name'],'four')
596  ex.vps[0].five = cms.string('beta')
597  self.assertEqual(ex.vps[0]._modifications[-1]['name'],'five')
598  ex.vps[1].__dict__['six'] = cms.vint32(1,4,9) # MISSED
599  #self.assertEqual(ex.vps[1]._modifications[-1]['name'],'six')
600  ex.seven[0] = 'delta' # MISSED
601  #self.assertEqual(ex._modifications[-1]['name'],'seven')
602  ex.eight.pop() # MISSED
603  #self.assertEqual(ex._modifications[-1]['name'],'eight')
604  del ex.nine
605  #self.assertEqual(ex._modifications[-1]['name'],'nine')
606  ex.newvpset = cms.VPSet()
607  self.assertEqual(ex._modifications[-1]['name'],'newvpset')
608 
609  process = cms.Process('unittest')
610  process.ex = ex
611  mods = process.dumpModifications()
612  self.assert_('process.ex.zero' in mods)
613  self.assert_('process.ex.one' in mods)
614  self.assert_('process.ex.two' in mods)
615  #self.assert_('process.ex.three' in mods)
616  self.assert_('process.ex.ps.four' in mods)
617  self.assert_('process.ex.vps[0].five' in mods)
618  #self.assert_('process.ex.vps[1].six' in mods)
619  #self.assert_('process.ex.seven[0]' in mods)
620  #self.assert_('process.ex.eight' in mods)
621  self.assert_('process.ex.nine' in mods)
622  self.assert_('process.ex.newvpset' in mods)
623 
624 
625 
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
def EnablePSetHistory.TestModificationTracking.testSeq (   self)

Definition at line 626 of file EnablePSetHistory.py.

626  def testSeq(self):
627  process = cms.Process('unittest')
628  for i in range(10):
629  setattr(process,'f%s'%i,cms.EDFilter('f%s'%i))
630  process.seq1 = cms.Sequence(process.f1*process.f2*process.f3)
631  self.assertEqual(process.seq1._modifications,[])
632  process.seq2 = cms.Sequence(process.f4+process.f5+process.f6)
633  self.assertEqual(process.seq2._modifications,[])
634 
635  process.seq1.replace(process.f1,process.f0*process.f1)
636  self.assertEqual(process.seq1._modifications[-1]['action'],'replace')
637 
638  process.seq2.remove(process.f5)
639  self.assertEqual(process.seq2._modifications[-1]['action'],'remove')
640 
641  process.path = cms.Path(process.seq1*process.f7)
642  self.assertEqual(process.path._modifications,[])
643 
644  process.path *= process.seq2
645  self.assertEqual(process.path._modifications[-1]['action'],'append')
646  process.path.remove(process.f6)
647  self.assertEqual(process.path._modifications[-1]['action'],'remove')
648  process.path.replace(process.f2,~process.f2)
649  self.assertEqual(process.path._modifications[-1]['action'],'replace')
650 
651  mods = process.dumpModifications()
652  self.assert_('process.seq1' in mods)
653  self.assert_('process.seq2' in mods)
654  self.assert_('process.path' in mods)
655