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

Method test_readinto_chunked_head

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

Source from the content-addressed store, hash-verified

1198 self.assertTrue(resp.closed)
1199
1200 def test_readinto_chunked_head(self):
1201 chunked_start = (
1202 'HTTP/1.1 200 OK\r\n'
1203 'Transfer-Encoding: chunked\r\n\r\n'
1204 'a\r\n'
1205 'hello world\r\n'
1206 '1\r\n'
1207 'd\r\n'
1208 )
1209 sock = FakeSocket(chunked_start + last_chunk + chunked_end)
1210 resp = client.HTTPResponse(sock, method="HEAD")
1211 resp.begin()
1212 b = bytearray(5)
1213 n = resp.readinto(b)
1214 self.assertEqual(n, 0)
1215 self.assertEqual(bytes(b), b'\x00'*5)
1216 self.assertEqual(resp.status, 200)
1217 self.assertEqual(resp.reason, 'OK')
1218 self.assertTrue(resp.isclosed())
1219 self.assertFalse(resp.closed)
1220 resp.close()
1221 self.assertTrue(resp.closed)
1222
1223 def test_negative_content_length(self):
1224 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