

def _cancelConnectFailedTimeoutTest(self, connect):
    '\n        Like L{_cancelConnectTest}, but for the case where the L{Deferred} is\n        cancelled after the connection attempt has failed but before it is fired\n        with the resulting failure.\n        '
    reactor = MemoryReactorClock()
    cc = ClientCreator(reactor, Protocol)
    (d, factory) = self(reactor, cc)
    connector = reactor.connectors.pop()
    factory.clientConnectionFailed(connector, Failure(Exception('Simulated failure')))
    self.assertEqual(len(reactor.getDelayedCalls()), 1)
    d.cancel()
    self.assertEqual(reactor.getDelayedCalls(), [])
    return self.assertFailure(d, CancelledError)

dataset/ETHPy150Open twisted/twisted/twisted/internet/test/test_protocol.py ClientCreatorTests._cancelConnectFailedTimeoutTest/VarMisuse@35/116 `connect`->`self`