def test_iter_links__yanked_reason(self, anchor_html, expected): html = ( # Mark this as a unicode string for Python 2 since anchor_html # can contain non-ascii. u'<html><head><meta charset="utf-8"><head>' '<body>{}</body></html>').format(anchor_html) html_bytes = html.encode('utf-8') page = HTMLPage(html_bytes, url='https://example.com/simple/') links = list(page.iter_links()) link, = links actual = link.yanked_reason assert actual == expected
def test_base_url(html, url, expected): assert HTMLPage(html, url).base_url == expected