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

Method test_mixed_reads

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

Source from the content-addressed store, hash-verified

832 self.assertTrue(resp.closed)
833
834 def test_mixed_reads(self):
835 # readline() should update the remaining length, so that read() knows
836 # how much data is left and does not raise IncompleteRead
837 body = "HTTP/1.1 200 Ok\r\nContent-Length: 13\r\n\r\nText\r\nAnother"
838 sock = FakeSocket(body)
839 resp = client.HTTPResponse(sock)
840 resp.begin()
841 self.assertEqual(resp.readline(), b'Text\r\n')
842 self.assertFalse(resp.isclosed())
843 self.assertEqual(resp.read(), b'Another')
844 self.assertTrue(resp.isclosed())
845 self.assertFalse(resp.closed)
846 resp.close()
847 self.assertTrue(resp.closed)
848
849 def test_partial_readintos(self):
850 # if we have Content-Length, HTTPResponse knows when to close itself,

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected