def testHandledTerminalAsyncFailure(self):
        """
        Just like testHandledTerminalFailure, only with a Deferred which fires
        asynchronously with an error.
        """
        d = defer.Deferred()
        deferredGeneratorResultDeferred = self._genHandledTerminalAsyncFailure(d)
        d.errback(TerminalException("Handled Terminal Failure"))
        return deferredGeneratorResultDeferred.addCallback(
            self.assertEqual, None)

        Just like testHandledTerminalFailure, only with a Deferred which fires
        asynchronously with an error.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_defgen.py