예제 #1
0
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
예제 #2
0
def etree():
    with open(FOO, 'rb') as fp:
        return parse_html(fp.read())
예제 #3
0
def etree():
    with open(FOOS_FILENAME, 'rb') as fp:
        return parse_html(fp, encoding='utf8')