'Given two URLs, make sure all their components (the ones given by
urlparse) are equal, only comparing components that are present in both
URLs.
If `parse_qs` is True, then the querystrings are parsed with QueryDict.
This is useful if you don\'t want the order of parameters to matter.
Otherwise, the query strings are compared as-is.'

def assertURLEqual(self, url, expected, parse_qs=False):

    fields = ParseResult._fields
    for (attr, x, y) in zip(fields, urlparse(url), urlparse(expected)):
        if (parse_qs and (attr == 'query')):
            (x, y) = (QueryDict(x), QueryDict(y))
        if (x and y and (x != y)):
            self.fail(("%r    !=    %r    (%s    doesn't    match)" % (url, expected, attr)))
