'The reactor is not running when C{"before"} C{"startup"} triggers are
called and is running when C{"during"} and C{"after"} C{"startup"}
triggers are called.'

def test_runningForStartupEvents(self):

    reactor = self.buildReactor()
    state = {}
    def beforeStartup():
        state['before'] = reactor.running
    def duringStartup():
        state['during'] = reactor.running
    def afterStartup():
        state['after'] = reactor.running
    reactor.addSystemEventTrigger('before', 'startup', beforeStartup)
    reactor.addSystemEventTrigger('during', 'startup', duringStartup)
    reactor.addSystemEventTrigger('after', 'startup', afterStartup)
    reactor.callWhenRunning(reactor.stop)
    self.assertEqual(state, {})
    self.runReactor(reactor)
    self.assertEqual(state, {'before': False, 'during': True, 'after': True})
