def test_parse_html(foo_file): etree = parse_html(foo_file, encoding='ascii') divs = etree.xpath('//body/article/div') for node in divs: assert node.tag == 'div' assert node.text == 'foo.' assert len(divs) == 9
def etree(): with open(FOO, 'rb') as fp: return parse_html(fp.read())
def etree(): with open(FOOS_FILENAME, 'rb') as fp: return parse_html(fp, encoding='utf8')