def test_fromFutureFutureCancelled(self):
        """
        L{defer.Deferred.fromFuture} makes a L{defer.Deferred} fire with
        an L{asyncio.CancelledError} when the given
        L{asyncio.Future} is cancelled.
        """
        loop = new_event_loop()
        cancelled = Future(loop=loop)
        d = defer.Deferred.fromFuture(cancelled)
        cancelled.cancel()
        callAllSoonCalls(loop)
        self.assertRaises(CancelledError, cancelled.result)
        self.failureResultOf(d).trap(CancelledError)

        L{defer.Deferred.fromFuture} makes a L{defer.Deferred} fire with
        an L{asyncio.CancelledError} when the given
        L{asyncio.Future} is cancelled.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_defer.py