Bug #735248: Fix urllib2.parse_http_list.

This commit is contained in:
Georg Brandl 2005-08-24 22:20:32 +00:00
parent 256372c88c
commit e1b13d2019
2 changed files with 43 additions and 38 deletions

View file

@ -45,6 +45,14 @@ class TrivialTests(unittest.TestCase):
# test the new-in-2.5 httpresponses dictionary
self.assertEquals(urllib2.httpresponses[404], "Not Found")
def test_parse_http_list(self):
tests = [('a,b,c', ['a', 'b', 'c']),
('path"o,l"og"i"cal, example', ['path"o,l"og"i"cal', 'example']),
('a, b, "c", "d", "e,f", g, h', ['a', 'b', '"c"', '"d"', '"e,f"', 'g', 'h']),
('a="b\\"c", d="e\\,f", g="h\\\\i"', ['a="b"c"', 'd="e,f"', 'g="h\\i"'])]
for string, list in tests:
self.assertEquals(urllib2.parse_http_list(string), list)
class MockOpener:
addheaders = []