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

Method test_send_error

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

Source from the content-addressed store, hash-verified

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