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

Method test_readinto_head

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

Source from the content-addressed store, hash-verified

966 self.fail("Did not expect response from HEAD request")
967
968 def test_readinto_head(self):
969 # Test that the library doesn't attempt to read any data
970 # from a HEAD request. (Tickles SF bug #622042.)
971 sock = FakeSocket(
972 'HTTP/1.1 200 OK\r\n'
973 'Content-Length: 14432\r\n'
974 '\r\n',
975 NoEOFBytesIO)
976 resp = client.HTTPResponse(sock, method="HEAD")
977 resp.begin()
978 b = bytearray(5)
979 if resp.readinto(b) != 0:
980 self.fail("Did not expect response from HEAD request")
981 self.assertEqual(bytes(b), b'\x00'*5)
982
983 def test_too_many_headers(self):
984 headers = '\r\n'.join('Header%d: foo' % i

Callers

nothing calls this directly

Calls 5

beginMethod · 0.95
readintoMethod · 0.95
FakeSocketClass · 0.70
failMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected