'If a before-phase trigger returns a L{Deferred} and later removes a
during-phase trigger before the L{Deferred} fires, the during-phase
trigger should not be run.'

def test_asynchronousBeforeRemovesDuring(self):

    events = []
    beforeResult = Deferred()
    self.event.addTrigger('before', (lambda : beforeResult))
    duringHandle = self.event.addTrigger('during', events.append, 'during')
    self.event.addTrigger('after', events.append, 'after')
    self.event.fireEvent()
    self.event.removeTrigger(duringHandle)
    beforeResult.callback(None)
    self.assertEqual(events, ['after'])
