F999 Dictionary key repeated with different values.
MODIFY
test/test_util.py
test/test_util.py
@@ -143,39 +143,39 @@ class TestUtil(unittest.TestCase):
actual_normalized_url = parse_url(url).url
self.assertEqual(actual_normalized_url, expected_normalized_url)
- parse_url_host_map = {
- 'http://google.com/mail': Url('http', host='google.com', path='/mail'),
- 'http://google.com/mail/': Url('http', host='google.com', path='/mail/'),
- 'http://google.com/mail': Url('http', host='google.com', path='mail'),
- 'google.com/mail': Url(host='google.com', path='/mail'),
- 'http://google.com/': Url('http', host='google.com', path='/'),
- 'http://google.com': Url('http', host='google.com'),
- 'http://google.com?foo': Url('http', host='google.com', path='', query='foo'),
+ parse_url_host_map = [
+ ('http://google.com/mail', Url('http', host='google.com', path='/mail')),
+ ('http://google.com/mail/', Url('http', host='google.com', path='/mail/')),
+ ('http://google.com/mail', Url('http', host='google.com', path='mail')),
+ ('google.com/mail', Url(host='google.com', path='/mail')),
+ ('http://google.com/', Url('http', host='google.com', path='/')),
+ ('http://google.com', Url('http', host='google.com')),
+ ('http://google.com?foo', Url('http', host='google.com', path='', query='foo')),
# Path/query/fragment
- '': Url(),
- '/': Url(path='/'),
- '#?/!google.com/?foo#bar': Url(path='', fragment='?/!google.com/?foo#bar'),
- '/foo': Url(path='/foo'),
- '/foo?bar=baz': Url(path='/foo', query='bar=baz'),
- '/foo?bar=baz#banana?apple/orange': Url(path='/foo',
+ ('', Url()),
+ ('/', Url(path='/')),
+ ('#?/!google.com/?foo#bar', Url(path='', fragment='?/!google.com/?foo#bar')),
+ ('/foo', Url(path='/foo')),
+ ('/foo?bar=baz', Url(path='/foo', query='bar=baz')),
+ ('/foo?bar=baz#banana?apple/orange', Url(path='/foo',
query='bar=baz',
- fragment='banana?apple/orange'),
+ fragment='banana?apple/orange')),
# Port
- 'http://google.com/': Url('http', host='google.com', path='/'),
- 'http://google.com:80/': Url('http', host='google.com', port=80, path='/'),
- 'http://google.com:80': Url('http', host='google.com', port=80),
+ ('http://google.com/', Url('http', host='google.com', path='/')),
+ ('http://google.com:80/', Url('http', host='google.com', port=80, path='/')),
+ ('http://google.com:80', Url('http', host='google.com', port=80)),
# Auth
- 'http://foo:bar@localhost/': Url('http', auth='foo:bar', host='localhost', path='/'),
- 'http://foo@localhost/': Url('http', auth='foo', host='localhost', path='/'),
- 'http://foo:bar@baz@localhost/': Url('http',
+ ('http://foo:bar@localhost/', Url('http', auth='foo:bar', host='localhost', path='/')),
+ ('http://foo@localhost/', Url('http', auth='foo', host='localhost', path='/')),
+ ('http://foo:bar@baz@localhost/', Url('http',
auth='foo:bar@baz',
host='localhost',
- path='/'),
- 'http://@': Url('http', host=None, auth='')
- }
+ path='/')),
+ ('http://@', Url('http', host=None, auth=''))
+ ]
non_round_tripping_parse_url_host_map = {
# Path/query/fragment
@@ -189,13 +189,13 @@ class TestUtil(unittest.TestCase):
}
def test_parse_url(self):
- for url, expected_Url in chain(self.parse_url_host_map.items(),
+ for url, expected_Url in chain(self.parse_url_host_map,
self.non_round_tripping_parse_url_host_map.items()):
returned_Url = parse_url(url)
self.assertEqual(returned_Url, expected_Url)
def test_unparse_url(self):
- for url, expected_Url in self.parse_url_host_map.items():
+ for url, expected_Url in self.parse_url_host_map:
self.assertEqual(url, expected_Url.url)
def test_parse_url_invalid_IPv6(self):

F999 Dictionary key repeated with different values.