Ejemplo n.º 1
0
def test_has_name():
    """py.test for has_name"""
    soup = BeautifulSoup(SAMPLE_HTML)
    # soup.p = <p><a href="#toc" style="float: right">Table of Contents</a></p>
    assert readhtml._has_name(soup.p) is True
    # soup.b = <b>EnergyPlus-Windows-OMP-32 7.2.0.006, YMD=2013.01.28 16:38</b>
    assert readhtml._has_name(soup.b) is True
    # soup.p.contents[0] = <a href="#toc" style="float: right">Table of Contents</a>
    assert readhtml._has_name(soup.p.contents[0]) is True
    # soup.b.contents[0] = u'EnergyPlus-Windows-OMP-32 7.2.0.006, YMD=2013.01.28 16:38'
    assert readhtml._has_name(soup.b.contents[0]) is False
Ejemplo n.º 2
0
def test_has_name():
    """py.test for has_name"""
    soup = BeautifulSoup(SAMPLE_HTML, "lxml")
    # soup.p = <p><a href="#toc" style="float: right">Table of Contents</a></p>
    assert readhtml._has_name(soup.p) is True
    # soup.b = <b>EnergyPlus-Windows-OMP-32 7.2.0.006, YMD=2013.01.28 16:38</b>
    assert readhtml._has_name(soup.b) is True
    # soup.p.contents[0] = <a href="#toc" style="float: right">Table of Contents</a>
    assert readhtml._has_name(soup.p.contents[0]) is True
    # soup.b.contents[0] = u'EnergyPlus-Windows-OMP-32 7.2.0.006, YMD=2013.01.28 16:38'
    assert readhtml._has_name(soup.b.contents[0]) is False