

def _cancelConnectTimeoutTest(self, connect):
    '\n        Like L{_cancelConnectTest}, but for the case where the L{Deferred} is\n        cancelled after the connection is set up but before it is fired with the\n        resulting protocol instance.\n        '
    reactor = MemoryReactorClock()
    cc = ClientCreator(reactor, Protocol)
    d = connect(reactor, cc)
    connector = reactor.connectors.pop()
    self.assertEqual(len(reactor.getDelayedCalls()), 1)
    d.cancel()
    self.assertEqual(reactor.getDelayedCalls(), [])
    self.assertTrue(connector._disconnected)
    return self.assertFailure(d, CancelledError)

dataset/ETHPy150Open twisted/twisted/twisted/internet/test/test_protocol.py ClientCreatorTests._cancelConnectTimeoutTest/original