MCPcopy Index your code
hub / github.com/python/cpython / test_chunked_sync

Method test_chunked_sync

Lib/test/test_httplib.py:1407–1417  ·  view source on GitHub ↗

Check that we don't read past the end of the chunked-encoding stream

(self)

Source from the content-addressed store, hash-verified

1405 resp.close()
1406
1407 def test_chunked_sync(self):
1408 """Check that we don't read past the end of the chunked-encoding stream"""
1409 expected = chunked_expected
1410 extradata = "extradata"
1411 sock = FakeSocket(chunked_start + last_chunk + trailers + chunked_end + extradata)
1412 resp = client.HTTPResponse(sock, method="GET")
1413 resp.begin()
1414 self.assertEqual(resp.read(), expected)
1415 # the file should now have our extradata ready to be read
1416 self.assertEqual(sock.file.read(), extradata.encode("ascii")) #we read to the end
1417 resp.close()
1418
1419 def test_content_length_sync(self):
1420 """Check that we don't read past the end of the Content-Length stream"""

Callers

nothing calls this directly

Calls 7

beginMethod · 0.95
readMethod · 0.95
closeMethod · 0.95
FakeSocketClass · 0.70
assertEqualMethod · 0.45
readMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected