def test_applicationExceptionAfterWrite(self):
        """
        If the application raises an exception after the response status has
        already been sent then the connection is closed and the exception is
        logged.
        """
        responseContent = (
            b'Some bytes, triggering the server to start sending the response')

        def application(environ, startResponse):
            startResponse('200 OK', [])
            yield responseContent
            raise RuntimeError("This application had some error.")
        return self._connectionClosedTest(application, responseContent)

        If the application raises an exception after the response status has
        already been sent then the connection is closed and the exception is
        logged.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/test/test_wsgi.py