• File: test_html5lib.cpython-37.opt-1.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/opt/alt/python37/lib/python3.7/site-packages/bs4/tests/__pycache__/test_html5lib.cpython-37.opt-1.pyc
  • Date Modified: 07/07/2021 10:44 PM
  • File size: 4.33 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
B

F.`F
@sdZddlZyddlmZdZWn&ek
rFZzdZWddZ[XYnXddlmZddl	m
Z
mZmZeedGd	d
d
ee
Z
dS)zDTests to ensure that the html5lib tree builder generates good trees.N)HTML5TreeBuilderTF)SoupStrainer)HTML5TreeBuilderSmokeTestSoupTestskipIfz?html5lib seems not to be present, not testing its tree builder.c@s\eZdZdZeddZddZddZdd	Zd
dZ	dd
Z
ddZddZddZ
dS)HTML5LibBuilderSmokeTestz"See ``HTML5TreeBuilderSmokeTest``.cCstS)N)r)selfr	H/opt/alt/python37/lib/python3.7/site-packages/bs4/tests/test_html5lib.pydefault_buildersz(HTML5LibBuilderSmokeTest.default_builderc	Csdtd}d}tjdd}|j||d}WdQRX|||||dt|dj	kdS)Nbz<p>A <b>bold</b> statement.</p>T)record)Z
parse_onlyz4the html5lib tree builder doesn't support parse_onlyr)
rwarningscatch_warningssoupassertEqualdecodeZdocument_forZ
assertTruestrmessage)rZstrainermarkupwrr	r	r
test_soupstrainersz*HTML5LibBuilderSmokeTest.test_soupstrainercCsd}||d|ddS)z8html5lib inserts <tbody> tags where other parsers don't.z[<table id="1"><tr><td>Here's another table:<table id="2"><tr><td>foo</td></tr></table></td>z<table id="1"><tbody><tr><td>Here's another table:<table id="2"><tbody><tr><td>foo</td></tr></tbody></table></td></tr></tbody></table>z{<table><thead><tr><td>Foo</td></tr></thead><tbody><tr><td>Bar</td></tr></tbody><tfoot><tr><td>Baz</td></tr></tfoot></table>N)ZassertSoupEquals)rrr	r	r
test_correctly_nested_tables(sz5HTML5LibBuilderSmokeTest.test_correctly_nested_tablescCs$d}||}|d|jdS)Nzy<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>
<html>
  <head>
  </head>
  <body>
   <p>foo</p>
  </body>
</html>s
<p>foo</p>)rrpencode)rrrr	r	r
(test_xml_declaration_followed_by_doctype<s	
zAHTML5LibBuilderSmokeTest.test_xml_declaration_followed_by_doctypecCs:d}||}|d|j|dt|ddS)Nz%<p><em>foo</p>
<p>bar<a></a></em></p>zD<body><p><em>foo</em></p><em>
</em><p><em>bar<a></a></em></p></body>r)rrbodyrlenfind_all)rrrr	r	r
test_reparented_markupJs
z/HTML5LibBuilderSmokeTest.test_reparented_markupcCs:d}||}|d|j|dt|ddS)Nz&<p><em>foo</p>
<p>bar<a></a></em></p>
zE<body><p><em>foo</em></p><em>
</em><p><em>bar<a></a></em></p>
</body>rr)rrrrrr)rrrr	r	r
+test_reparented_markup_ends_with_whitespaceQs
zDHTML5LibBuilderSmokeTest.test_reparented_markup_ends_with_whitespacecCs0d}||}|jdd\}}|d\}}dS)zVerify that we keep the two whitespace nodes in this
        document distinct when reparenting the adjacent <tbody> tags.
        z,<table> <tbody><tbody><ims></tbody> </table> )stringZtbodyN)rr)rrrZspace1Zspace2Ztbody1Ztbody2r	r	r
<test_reparented_markup_containing_identical_whitespace_nodesWs

zUHTML5LibBuilderSmokeTest.test_reparented_markup_containing_identical_whitespace_nodescCsd}||}dS)z(Processing instructions become comments.s<?PITarget PIContent?>N)r)rrrr	r	r
test_processing_instructionbs
z4HTML5LibBuilderSmokeTest.test_processing_instructioncCs,d}||}|d\}}|||dS)Ns<a class="my_class"><p></a>a)rrr)rrrZa1Za2r	r	r
test_cloned_multivalue_nodehs

z4HTML5LibBuilderSmokeTest.test_cloned_multivalue_nodeN)__name__
__module____qualname____doc__propertyrrrrr r!r$r%r'r	r	r	r
rs
r)r+rZbs4.builderrZHTML5LIB_PRESENTImportErroreZbs4.elementrZbs4.testingrrrrr	r	r	r
<module>s