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

Method test_readinto_head

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

Source from the content-addressed store, hash-verified

1012 self.fail("Did not expect response from HEAD request")
1013
1014 def test_readinto_head(self):
1015 # Test that the library doesn't attempt to read any data
1016 # from a HEAD request. (Tickles SF bug #622042.)
1017 sock = FakeSocket(
1018 'HTTP/1.1 200 OK\r\n'
1019 'Content-Length: 14432\r\n'
1020 '\r\n',
1021 NoEOFBytesIO)
1022 resp = client.HTTPResponse(sock, method="HEAD")
1023 resp.begin()
1024 b = bytearray(5)
1025 if resp.readinto(b) != 0:
1026 self.fail("Did not expect response from HEAD request")
1027 self.assertEqual(bytes(b), b'\x00'*5)
1028
1029 def test_too_many_headers(self):
1030 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