def test_chunkedResponseBodyUnfinishedWhenConnectionLost(self):
        requestDeferred = self.protocol.request(Request('GET', '/', _boringHeaders, None))
        self.protocol.dataReceived(
            "HTTP/1.1 200 OK\r\n"
            "Transfer-Encoding: chunked\r\n"
            "\r\n")

        result = []
        requestDeferred.addCallback(result.append)
        response = result[0]

        protocol = AccumulatingProtocol()
        response.deliverBody(protocol)

        self.protocol.dataReceived("3\r\nfoo\r\n")
        self.protocol.dataReceived("3\r\nbar\r\n")

        self.assertEqual(protocol.data, "foobar")

        self.protocol.connectionLost(Failure(ArbitraryException()))

        return assertResponseFailed(
            self, fail(protocol.closedReason), [ArbitraryException, _DataLoss])
If the final chunk has not been received when the connection is lost
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/web/test/test_newclient.py/HTTP11ClientProtocolTests.test_chunkedResponseBodyUnfinishedWhenConnectionLost