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

Method test_partial_reads_no_content_length

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

Source from the content-addressed store, hash-verified

894 self.assertTrue(resp.closed)
895
896 def test_partial_reads_no_content_length(self):
897 # when no length is present, the socket should be gracefully closed when
898 # all data was read
899 body = "HTTP/1.1 200 Ok\r\n\r\nText"
900 sock = FakeSocket(body)
901 resp = client.HTTPResponse(sock)
902 resp.begin()
903 self.assertEqual(resp.read(2), b'Te')
904 self.assertFalse(resp.isclosed())
905 self.assertEqual(resp.read(2), b'xt')
906 self.assertEqual(resp.read(1), b'')
907 self.assertTrue(resp.isclosed())
908 self.assertFalse(resp.closed)
909 resp.close()
910 self.assertTrue(resp.closed)
911
912 def test_partial_readintos_no_content_length(self):
913 # when no length is present, the socket should be gracefully closed when

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected