def test_make_links_absolute(): doc = lx.to_doc(ex.LINKS) doc = lx.make_links_absolute(doc, base_url='http://retrogames.com') html = lx.tostring(doc) assert "http://retrogames.com/games/elite" in html assert "http://retrogames.com/games/commando" in html
def test_autolink(): doc = lx.to_doc(ex.TEXT) doc = lx.autolink(doc) html = lx.tostring(doc) assert '<a href="http://retrogames.com/games/commando">http://retrogames.com/games/commando</a>' in html
def test_tostring(): doc = lx.to_doc(ex.HTML_1) html = lx.tostring(doc) assert type(html) is str and len(html) > 0
def demo2(): url = "http://projecteuler.net/" text = get_page(url) doc = lx.to_doc(text) lx.make_links_absolute(doc, base_url=url) print lx.tostring(doc)