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

Method test_partial_reads

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

Source from the content-addressed store, hash-verified

771 self.assertEqual(repr(exc), '''BadStatusLine("''")''')
772
773 def test_partial_reads(self):
774 # if we have Content-Length, HTTPResponse knows when to close itself,
775 # the same behaviour as when we read the whole thing with read()
776 body = "HTTP/1.1 200 Ok\r\nContent-Length: 4\r\n\r\nText"
777 sock = FakeSocket(body)
778 resp = client.HTTPResponse(sock)
779 resp.begin()
780 self.assertEqual(resp.read(2), b'Te')
781 self.assertFalse(resp.isclosed())
782 self.assertEqual(resp.read(2), b'xt')
783 self.assertTrue(resp.isclosed())
784 self.assertFalse(resp.closed)
785 resp.close()
786 self.assertTrue(resp.closed)
787
788 def test_mixed_reads(self):
789 # readline() should update the remaining length, so that read() knows

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