MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_chunked_sync

Method test_chunked_sync

Lib/test/test_httplib.py:1361–1371  ·  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

1359 resp.close()
1360
1361 def test_chunked_sync(self):
1362 """Check that we don't read past the end of the chunked-encoding stream"""
1363 expected = chunked_expected
1364 extradata = "extradata"
1365 sock = FakeSocket(chunked_start + last_chunk + trailers + chunked_end + extradata)
1366 resp = client.HTTPResponse(sock, method="GET")
1367 resp.begin()
1368 self.assertEqual(resp.read(), expected)
1369 # the file should now have our extradata ready to be read
1370 self.assertEqual(sock.file.read(), extradata.encode("ascii")) #we read to the end
1371 resp.close()
1372
1373 def test_content_length_sync(self):
1374 """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