def _match_clause_for_uri(uristr): """Return an Elasticsearch match clause dict for the given URI.""" if not uristr: return None uristrs = uri.expand(uri.normalise(uristr)) matchers = [{"match": {"uri": uri.normalise(u)}} for u in uristrs] if len(matchers) == 1: return matchers[0] return { "bool": { "minimum_should_match": 1, "should": matchers } }
def test_normalise(url_in, url_out): assert uri.normalise(url_in) == url_out