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

Method test_read1_bound_content_length

Lib/test/test_httplib.py:1465–1475  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1463 resp.close()
1464
1465 def test_read1_bound_content_length(self):
1466 extradata = b"extradata"
1467 expected = b"Hello123\r\n"
1468 sock = FakeSocket(b'HTTP/1.1 200 OK\r\nContent-Length: 30\r\n\r\n' + expected*3 + extradata)
1469 resp = client.HTTPResponse(sock, method="GET")
1470 resp.begin()
1471 self.assertEqual(resp.read1(20), expected*2)
1472 self.assertEqual(resp.read(), expected)
1473 # the file should now have our extradata ready to be read
1474 self.assertEqual(sock.file.read(), extradata) #we read to the end
1475 resp.close()
1476
1477 def test_response_fileno(self):
1478 # Make sure fd returned by fileno is valid.

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected