def assert_url_equal(url, other, compare_host=False):
 parsed = urlparse(unicode(url))
 parsed_other = urlparse(unicode(other))
 assert (parsed.path == parsed_other.path)
 assert (parse_qs(parsed.query) == parse_qs(parsed_other.query))
 if compare_host:
  assert (parsed.netloc == parsed_other.netloc)

def assert_url_equal ( url , other , compare_host = False ) : parsed = urlparse ( unicode ( url ) ) parsed_other = urlparse ( unicode ( other ) ) assert ( parsed . path == parsed_other . path ) assert ( parse_qs ( parsed . query ) == parse_qs ( parsed_other . query ) ) if compare_host : assert ( parsed . netloc == parsed_other . netloc )
compare url paths and query strings .