Daniel Diniz <[email protected]> added the comment:
Here's a test (in test_urllib2_localnet) that fails before the patch and
passes after, mostly lifted from test_httplib:
def test_chunked(self):
expected_response = b"hello world"
chunked_start = (
b'a\r\n'
b'hello worl\r\n'
b'1\r\n'
b'd\r\n'
)
response = [(200, [("Transfer-Encoding", "chunked")],
chunked_start)]
handler = self.start_server(response)
data = self.urlopen("http://localhost:%s/" % handler.port)
self.assertEquals(data, expected_response)
Output:
test test_urllib2_localnet failed -- Traceback (most recent call last):
File "~/py3k/Lib/test/test_urllib2_localnet.py", line 390, in test_chunked
self.assertEquals(data, expected_response)
AssertionError: b'a\r\nhello worl\r\n1\r\nd\r\n' != b'hello world'
To allow this test to work, the attached patch also touches
FakeHTTPRequestHandler and TestUrlopen.urlopen.
Added file: http://bugs.python.org/file12975/test_urllib_chunked.diff
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue4631>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com