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

Method test_issue16464

Lib/test/test_urllib2_localnet.py:650–667  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

648 self.assertEqual(index + 1, len(lines))
649
650 def test_issue16464(self):
651 # See https://bugs.python.org/issue16464
652 # and https://bugs.python.org/issue46648
653 handler = self.start_server([
654 (200, [], b'any'),
655 (200, [], b'any'),
656 ])
657 opener = urllib.request.build_opener()
658 request = urllib.request.Request("http://localhost:%s" % handler.port)
659 self.assertEqual(None, request.data)
660
661 opener.open(request, "1".encode("us-ascii"))
662 self.assertEqual(b"1", request.data)
663 self.assertEqual("1", request.get_header("Content-length"))
664
665 opener.open(request, "1234567890".encode("us-ascii"))
666 self.assertEqual(b"1234567890", request.data)
667 self.assertEqual("10", request.get_header("Content-length"))
668
669def setUpModule():
670 thread_info = threading_helper.threading_setup()

Callers

nothing calls this directly

Calls 5

start_serverMethod · 0.95
get_headerMethod · 0.95
assertEqualMethod · 0.45
openMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected