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

Method test_mixed_reads

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

Source from the content-addressed store, hash-verified

786 self.assertTrue(resp.closed)
787
788 def test_mixed_reads(self):
789 # readline() should update the remaining length, so that read() knows
790 # how much data is left and does not raise IncompleteRead
791 body = "HTTP/1.1 200 Ok\r\nContent-Length: 13\r\n\r\nText\r\nAnother"
792 sock = FakeSocket(body)
793 resp = client.HTTPResponse(sock)
794 resp.begin()
795 self.assertEqual(resp.readline(), b'Text\r\n')
796 self.assertFalse(resp.isclosed())
797 self.assertEqual(resp.read(), b'Another')
798 self.assertTrue(resp.isclosed())
799 self.assertFalse(resp.closed)
800 resp.close()
801 self.assertTrue(resp.closed)
802
803 def test_partial_readintos(self):
804 # 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