def test_event(self):
        self.asm.run()
        self.assertEqual(self.asm.comp1.exec_count, 3)
        self.assertEqual(self.asm.comp1.doit_count, 0)
        self.assertEqual(self.asm.comp1.doit2_count, 0)
        
        self.asm.comp1.exec_count = 0
        
        self.asm.driver.add_event('comp1.doit')
        self.asm.run()
        self.assertEqual(self.asm.comp1.exec_count, 3)
        self.assertEqual(self.asm.comp1.doit_count, 3)
        self.assertEqual(self.asm.comp1.doit2_count, 0)
        
        self.asm.driver.set_events()
        self.assertEqual(self.asm.comp1.doit_count, 4)
        self.assertEqual(self.asm.comp1.doit2_count, 0)
        
        self.asm.driver.add_event('comp1.doit2')
        self.asm.driver.set_events()
        self.assertEqual(self.asm.comp1.doit_count, 5)
        self.assertEqual(self.asm.comp1.doit2_count, 1)
        
        try:
            self.asm.driver.add_event('comp1.bogus')
        except AttributeError as err:
            self.assertEqual(str(err), "driver: Can't add event 'comp1.bogus' because it doesn't exist")
        else:
            self.fail('Exception expected')
            
        try:
            self.asm.driver.add_event('comp1.some_int')
        except TypeError as err:
            self.assertEqual(str(err), "driver: 'comp1.some_int' is not an event")
        else:
            self.fail('TypeError expected')
            
        try:
            self.asm.driver.remove_event('comp1.bogus')
        except __HOLE__ as err:
            self.assertEqual(str(err), "driver: Trying to remove event 'comp1.bogus' that is not in the driver.")
        else:
            self.fail('AttributeError expected')
            
        events = self.asm.driver.get_events()
        self.assertEqual(events, ['comp1.doit', 'comp1.doit2'])
        
        self.asm.driver.remove_event('comp1.doit')
        events = self.asm.driver.get_events()
        self.assertEqual(events, ['comp1.doit2'])

        self.asm.driver.set_events()
        self.assertEqual(self.asm.comp1.doit_count, 5)
        self.assertEqual(self.asm.comp1.doit2_count, 2)
        
        self.asm.driver.clear_events()
        events = self.asm.driver.get_events()
        self.assertEqual(events, [])
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/test/test_hasevents.py/HasEventsTestCase.test_event