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

Method test_send_error

Lib/test/test_httpservers.py:326–341  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

324 self.assertEqual(int(res.getheader('Content-Length')), len(data))
325
326 def test_send_error(self):
327 allow_transfer_encoding_codes = (HTTPStatus.NOT_MODIFIED,
328 HTTPStatus.RESET_CONTENT)
329 for code in (HTTPStatus.NO_CONTENT, HTTPStatus.NOT_MODIFIED,
330 HTTPStatus.PROCESSING, HTTPStatus.RESET_CONTENT,
331 HTTPStatus.SWITCHING_PROTOCOLS):
332 self.con.request('SEND_ERROR', '/{}'.format(code))
333 res = self.con.getresponse()
334 self.assertEqual(code, res.status)
335 self.assertEqual(None, res.getheader('Content-Length'))
336 self.assertEqual(None, res.getheader('Content-Type'))
337 if code not in allow_transfer_encoding_codes:
338 self.assertEqual(None, res.getheader('Transfer-Encoding'))
339
340 data = res.read()
341 self.assertEqual(b'', data)
342
343 def test_head_via_send_error(self):
344 allow_transfer_encoding_codes = (HTTPStatus.NOT_MODIFIED,

Callers

nothing calls this directly

Calls 6

getheaderMethod · 0.80
requestMethod · 0.45
formatMethod · 0.45
getresponseMethod · 0.45
assertEqualMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected