def test_netloc(self):
        url_netloc_map = {
            'http://google.com/mail': 'google.com',
            'http://google.com:80/mail': 'google.com:80',
            'google.com/foobar': 'google.com',
            'google.com:12345': 'google.com:12345',
        }

        for url, expected_netloc in url_netloc_map.items():
            self.assertEqual(parse_url(url).netloc, expected_netloc)
 def test_request_uri(self):
     url_host_map = {
         'http://google.com/mail': '/mail',
         'http://google.com/mail/': '/mail/',
         'http://google.com/': '/',
         'http://google.com': '/',
         '': '/',
         '/': '/',
         '?': '/?',
         '#': '/',
         '/foo?bar=baz': '/foo?bar=baz',
     }
     for url, expected_request_uri in url_host_map.items():
         returned_url = parse_url(url)
         self.assertEqual(returned_url.request_uri, expected_request_uri)
 def test_parse_url(self):
     for url, expected_Url in chain(self.parse_url_host_map.items(), self.non_round_tripping_parse_url_host_map.items()):
         returned_Url = parse_url(url)
         self.assertEqual(returned_Url, expected_Url)