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

Method test_partial_reads_incomplete_body

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

Source from the content-addressed store, hash-verified

929 self.assertTrue(resp.isclosed())
930
931 def test_partial_reads_incomplete_body(self):
932 # if the server shuts down the connection before the whole
933 # content-length is delivered, the socket is gracefully closed
934 body = "HTTP/1.1 200 Ok\r\nContent-Length: 10\r\n\r\nText"
935 sock = FakeSocket(body)
936 resp = client.HTTPResponse(sock)
937 resp.begin()
938 self.assertEqual(resp.read(2), b'Te')
939 self.assertFalse(resp.isclosed())
940 self.assertEqual(resp.read(2), b'xt')
941 self.assertEqual(resp.read(1), b'')
942 self.assertTrue(resp.isclosed())
943
944 def test_partial_readintos_incomplete_body(self):
945 # if the server shuts down the connection before the whole

Callers

nothing calls this directly

Calls 7

beginMethod · 0.95
readMethod · 0.95
isclosedMethod · 0.95
assertFalseMethod · 0.80
assertTrueMethod · 0.80
FakeSocketClass · 0.70
assertEqualMethod · 0.45

Tested by

no test coverage detected