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

Method test_http_body_array

Lib/test/test_urllib2.py:1082–1093  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1080 self.assertFalse(req.has_header("Content-length"))
1081
1082 def test_http_body_array(self):
1083 # array.array Iterable - Content Length is calculated
1084
1085 h = urllib.request.AbstractHTTPHandler()
1086 o = h.parent = MockOpener()
1087
1088 iterable_array = array.array("I",[1,2,3,4])
1089
1090 for headers in {}, {"Content-Length": 16}:
1091 req = Request("http://example.com/", iterable_array, headers)
1092 newreq = h.do_request_(req)
1093 self.assertEqual(int(newreq.get_header('Content-length')),16)
1094
1095 def test_http_handler_global_debuglevel(self):
1096 with mock.patch.object(http.client.HTTPConnection, 'debuglevel', 6):

Callers

nothing calls this directly

Calls 5

do_request_Method · 0.95
RequestClass · 0.90
MockOpenerClass · 0.85
assertEqualMethod · 0.45
get_headerMethod · 0.45

Tested by

no test coverage detected