def test_runAfterStop(self):
        """
        C{reactor.run()} raises L{ReactorNotRestartable} when called when
        the reactor is being run after getting stopped priorly.
        """
        events = []
        def restart():
            self.assertRaises(ReactorNotRestartable, reactor.run)
            events.append('tested')
        reactor = self.buildReactor()
        reactor.callWhenRunning(reactor.stop)
        reactor.addSystemEventTrigger('after', 'shutdown', restart)
        self.runReactor(reactor)
        self.assertEqual(events, ['tested'])

        C{reactor.run()} raises L{ReactorNotRestartable} when called when
        the reactor is being run after getting stopped priorly.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/test/test_core.py