def test_chunkedResponseBody(self):
        finished = []
        protocol = HTTPClientParser(
            Request('GET', '/', _boringHeaders, None),
            finished.append)
        protocol.makeConnection(StringTransport())
        protocol.dataReceived('HTTP/1.1 200 OK\r\n')

        body = []
        protocol.response._bodyDataReceived = body.append

        protocol.dataReceived('Transfer-Encoding: chunked\r\n')
        protocol.dataReceived('\r\n')

        # No data delivered yet
        self.assertEqual(body, [])

        # Cannot predict the length of a chunked encoded response body.
        self.assertIdentical(protocol.response.length, UNKNOWN_LENGTH)

        # Deliver some chunks and make sure the data arrives
        protocol.dataReceived('3\r\na')
        self.assertEqual(body, ['a'])
        protocol.dataReceived('bc\r\n')
        self.assertEqual(body, ['a', 'bc'])

        # The response's _bodyDataFinished method should be called when the last
        # chunk is received.  Extra data should be passed to the finished
        # callback.
        protocol.dataReceived('0\r\n\r\nextra')
        self.assertEqual(finished, ['extra'])
If the response headers indicate the response body is encoded with the
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/web/test/test_newclient.py/HTTPClientParserTests.test_chunkedResponseBody