def test_connectionCancellation(self):
        """
        Cancellation propagates upward to C{connect}'s L{Deferred}.
        """
        d = self.wrapper.connect(self.factory)
        self.assertNoResult(d)
        d.cancel()
        self.failureResultOf(d, ConnectingCancelledError)

        Cancellation propagates upward to C{connect}'s L{Deferred}.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/test/test_endpoints.py