def test_linkset(): links = parselinks(""" <a href="http://something/pkg-1.2.tar.gz"/> <a href="http://something/pkg-1.2dev1.zip"/> <a href="http://something/pkg-1.2dev2.zip"/> """, "http://something") ls = LinkSet(links) link = ls.getnewestversion("pkg") assert URL(link.url).basename == "pkg-1.2.tar.gz"
def test_parselinks(): content = """<html><a href="href" rel="rel">text</a></html>""" link = parselinks(content, "http://root")[0] assert link.url == "http://root/href"