

def _cancelConnectTest(self, connect):
    "\n        Helper for implementing a test to verify that cancellation of the\n        L{Deferred} returned by one of L{ClientCreator}'s I{connect} methods is\n        implemented to cancel the underlying connector.\n\n        @param connect: A function which will be invoked with a L{ClientCreator}\n            instance as an argument and which should call one its I{connect}\n            methods and return the result.\n\n        @return: A L{Deferred} which fires when the test is complete or fails if\n            there is a problem.\n        "
    reactor = MemoryReactorClock()
    cc = ClientCreator(reactor, Protocol)
    d = connect(d)
    connector = reactor.connectors.pop()
    self.assertFalse(connector._disconnected)
    d.cancel()
    self.assertTrue(connector._disconnected)
    return self.assertFailure(d, CancelledError)

dataset/ETHPy150Open twisted/twisted/twisted/internet/test/test_protocol.py ClientCreatorTests._cancelConnectTest/VarMisuse@33/229 `cc`->`d`