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

Method test_readinto_chunked_head

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

Source from the content-addressed store, hash-verified

1244 self.assertTrue(resp.closed)
1245
1246 def test_readinto_chunked_head(self):
1247 chunked_start = (
1248 'HTTP/1.1 200 OK\r\n'
1249 'Transfer-Encoding: chunked\r\n\r\n'
1250 'a\r\n'
1251 'hello world\r\n'
1252 '1\r\n'
1253 'd\r\n'
1254 )
1255 sock = FakeSocket(chunked_start + last_chunk + chunked_end)
1256 resp = client.HTTPResponse(sock, method="HEAD")
1257 resp.begin()
1258 b = bytearray(5)
1259 n = resp.readinto(b)
1260 self.assertEqual(n, 0)
1261 self.assertEqual(bytes(b), b'\x00'*5)
1262 self.assertEqual(resp.status, 200)
1263 self.assertEqual(resp.reason, 'OK')
1264 self.assertTrue(resp.isclosed())
1265 self.assertFalse(resp.closed)
1266 resp.close()
1267 self.assertTrue(resp.closed)
1268
1269 def test_negative_content_length(self):
1270 sock = FakeSocket(

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected