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

Method test_line_iteration

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

Source from the content-addressed store, hash-verified

636 self.assertEqual(line, expected_response)
637
638 def test_line_iteration(self):
639 lines = [b"We\n", b"got\n", b"here\n", b"verylong " * 8192 + b"\n"]
640 expected_response = b"".join(lines)
641 handler = self.start_server([(200, [], expected_response)])
642 data = urllib.request.urlopen("http://localhost:%s" % handler.port)
643 for index, line in enumerate(data):
644 self.assertEqual(line, lines[index],
645 "Fetched line number %s doesn't match expected:\n"
646 " Expected length was %s, got %s" %
647 (index, len(lines[index]), len(line)))
648 self.assertEqual(index + 1, len(lines))
649
650 def test_issue16464(self):
651 # See https://bugs.python.org/issue16464

Callers

nothing calls this directly

Calls 5

start_serverMethod · 0.95
enumerateFunction · 0.85
joinMethod · 0.45
urlopenMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected