def test__nromalize_url(self): test_list = { "http://www.a.com#abc": "http://www.a.com/", "http://www.a.com/a/b/c": "http://www.a.com/a/b/c", # if no scheme is provided, urlsplit treats the domain name as the path # so we don't expect a trailing "/" after www.a.com "www.a.com?abc=123#abc": "://www.a.com?abc=123" } for test in test_list: usplit = urlparse.urlsplit(test) c = Crawler("http://mydomain.com") self.assertEqual(c._normalize_url(usplit), test_list[test])