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

Method test_incomplete_read

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

Source from the content-addressed store, hash-verified

1275 self.assertTrue(resp.isclosed())
1276
1277 def test_incomplete_read(self):
1278 sock = FakeSocket('HTTP/1.1 200 OK\r\nContent-Length: 10\r\n\r\nHello\r\n')
1279 resp = client.HTTPResponse(sock, method="GET")
1280 resp.begin()
1281 try:
1282 resp.read()
1283 except client.IncompleteRead as i:
1284 self.assertEqual(i.partial, b'Hello\r\n')
1285 self.assertEqual(repr(i),
1286 "IncompleteRead(7 bytes read, 3 more expected)")
1287 self.assertEqual(str(i),
1288 "IncompleteRead(7 bytes read, 3 more expected)")
1289 self.assertTrue(resp.isclosed())
1290 else:
1291 self.fail('IncompleteRead expected')
1292
1293 def test_epipe(self):
1294 sock = EPipeSocket(

Callers

nothing calls this directly

Calls 8

beginMethod · 0.95
readMethod · 0.95
isclosedMethod · 0.95
strFunction · 0.85
assertTrueMethod · 0.80
FakeSocketClass · 0.70
assertEqualMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected