def test_getThreadPool(self):
        """
        C{reactor.getThreadPool()} returns an instance of L{ThreadPool} which
        starts when C{reactor.run()} is called and stops before it returns.
        """
        state = []
        reactor = self.buildReactor()

        pool = reactor.getThreadPool()
        self.assertIsInstance(pool, ThreadPool)
        self.assertFalse(
            pool.started, "Pool should not start before reactor.run")

        def f():
            # Record the state for later assertions
            state.append(pool.started)
            state.append(pool.joined)
            reactor.stop()

        reactor.callWhenRunning(f)
        self.runReactor(reactor, 2)

        self.assertTrue(
            state[0], "Pool should start after reactor.run")
        self.assertFalse(
            state[1], "Pool should not be joined before reactor.stop")
        self.assertTrue(
            pool.joined,
            "Pool should be stopped after reactor.run returns")

        C{reactor.getThreadPool()} returns an instance of L{ThreadPool} which
        starts when C{reactor.run()} is called and stops before it returns.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/test/test_threads.py