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

Method test_early_eof

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

Source from the content-addressed store, hash-verified

1347 self.assertRaises(client.LineTooLong, resp.read)
1348
1349 def test_early_eof(self):
1350 # Test httpresponse with no \r\n termination,
1351 body = "HTTP/1.1 200 Ok"
1352 sock = FakeSocket(body)
1353 resp = client.HTTPResponse(sock)
1354 resp.begin()
1355 self.assertEqual(resp.read(), b'')
1356 self.assertTrue(resp.isclosed())
1357 self.assertFalse(resp.closed)
1358 resp.close()
1359 self.assertTrue(resp.closed)
1360
1361 def test_error_leak(self):
1362 # Test that the socket is not leaked if getresponse() fails

Callers

nothing calls this directly

Calls 8

beginMethod · 0.95
readMethod · 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