'L{defer.Deferred.asFuture} returns a L{asyncio.Future} which, when
cancelled, will cancel the original L{defer.Deferred}.'

def test_asFutureCancelFuture(self):

    def canceler(dprime):
        canceler.called = True
    canceler.called = False
    d = defer.Deferred(canceler)
    loop = new_event_loop()
    aFuture = d.asFuture(loop)
    aFuture.cancel()
    callAllSoonCalls(loop)
    self.assertEqual(canceler.called, True)
    self.assertEqual(self.successResultOf(d), None)
    self.assertRaises(CancelledError, aFuture.result)
