@@ -0,0 +1,2466 @@
+from AlphaTwirl.HeppyResult.EventBuilder import EventBuilder%0Aimport unittest%0Aimport sys%0A%0A##____________________________________________________________________________%7C%7C%0Aclass MockAnalyzer(object):%0A    def __init__(self):%0A        self.path = '/heppyresult/dir/TTJets/treeProducerSusyAlphaT'%0A%0A##____________________________________________________________________________%7C%7C%0Aclass MockComponent(object):%0A    def __init__(self):%0A        self.treeProducerSusyAlphaT = MockAnalyzer()%0A%0A##____________________________________________________________________________%7C%7C%0Aclass MockTObject(object):%0A    def __init__(self, name): self.name = name%0A%0A##____________________________________________________________________________%7C%7C%0Aclass MockTFile(object):%0A    def Open(self, path):%0A        self.path = path%0A        return self%0A    def Get(self, name):%0A        return MockTObject(name)%0A%0A##____________________________________________________________________________%7C%7C%0Aclass MockROOT(object):%0A    def __init__(self): self.TFile = MockTFile()%0A%0A##____________________________________________________________________________%7C%7C%0Aclass MockEvents(object):%0A    def __init__(self, tree, maxEvents):%0A        self.tree = tree%0A        self.maxEvents = maxEvents%0A%0A##____________________________________________________________________________%7C%7C%0Aclass TestEventBuilder(unittest.TestCase):%0A%0A    def setUp(self):%0A        self.moduleEventBuilder = sys.modules%5B'AlphaTwirl.HeppyResult.EventBuilder'%5D%0A        self.orgROOT = self.moduleEventBuilder.ROOT%0A        self.moduleEventBuilder.ROOT = MockROOT()%0A%0A        self.orgEvents = self.moduleEventBuilder.Events%0A        self.moduleEventBuilder.Events = MockEvents%0A%0A    def tearDown(self):%0A        self.moduleEventBuilder.ROOT = self.orgROOT%0A        self.moduleEventBuilder.Events = self.orgEvents%0A%0A    def test_build(self):%0A        eventBuilder = EventBuilder(%0A            analyzerName = 'treeProducerSusyAlphaT',%0A            fileName = 'tree.root',%0A            treeName = 'tree',%0A            maxEvents = 100)%0A%0A        component = MockComponent()%0A        events = eventBuilder.build(component)%0A%0A        self.assertEqual('/heppyresult/dir/TTJets/treeProducerSusyAlphaT/tree.root', self.moduleEventBuilder.ROOT.TFile.path)%0A        self.assertIsInstance(events, MockEvents)%0A        self.assertEqual('tree', events.tree.name)%0A        self.assertEqual(100, events.maxEvents)%0A%0A##____________________________________________________________________________%7C%7C%0A

add TestEventBuilder