HEX
Server: Apache
System: Linux vps.rockyroadprinting.net 4.18.0 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64
User: rockyroadprintin (1011)
PHP: 8.2.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python2.7/site-packages/bs4/tests/test_html5lib.pyo
�
A�XXc@s�dZddlZyddlmZeZWnek
rGZeZnXddl	m
Z
ddlmZm
Z
mZeed�de
efd��Y�ZdS(	sDTests to ensure that the html5lib tree builder generates good trees.i����N(tHTML5TreeBuilder(tSoupStrainer(tHTML5TreeBuilderSmokeTesttSoupTesttskipIfs?html5lib seems not to be present, not testing its tree builder.tHTML5LibBuilderSmokeTestcBsweZdZed��Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�ZRS(s"See ``HTML5TreeBuilderSmokeTest``.cCst�S(N(R(tself((s;/usr/lib/python2.7/site-packages/bs4/tests/test_html5lib.pytdefault_builderscCs�td�}d}tjdt��}|j|d|�}WdQX|j|j�|j|��|jdt	|dj
�k�dS(Ntbs<p>A <b>bold</b> statement.</p>trecordt
parse_onlys4the html5lib tree builder doesn't support parse_onlyi(Rtwarningstcatch_warningstTruetsouptassertEqualtdecodetdocument_fort
assertTruetstrtmessage(RtstrainertmarkuptwR((s;/usr/lib/python2.7/site-packages/bs4/tests/test_html5lib.pyttest_soupstrainerscCs'd}|j|d�|jd�dS(s8html5lib inserts <tbody> tags where other parsers don't.s[<table id="1"><tr><td>Here's another table:<table id="2"><tr><td>foo</td></tr></table></td>s�<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>s{<table><thead><tr><td>Foo</td></tr></thead><tbody><tr><td>Bar</td></tr></tbody><tfoot><tr><td>Baz</td></tr></tfoot></table>N(tassertSoupEquals(RR((s;/usr/lib/python2.7/site-packages/bs4/tests/test_html5lib.pyttest_correctly_nested_tables(scCs2d}|j|�}|jd|jj��dS(Nsy<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>
<html>
  <head>
  </head>
  <body>
   <p>foo</p>
  </body>
</html>s
<p>foo</p>(RRtptencode(RRR((s;/usr/lib/python2.7/site-packages/bs4/tests/test_html5lib.pyt(test_xml_declaration_followed_by_doctype<s	cCsQd}|j|�}|jd|jj��|jdt|jd���dS(Ns%<p><em>foo</p>
<p>bar<a></a></em></p>uD<body><p><em>foo</em></p><em>
</em><p><em>bar<a></a></em></p></body>iR(RRtbodyRtlentfind_all(RRR((s;/usr/lib/python2.7/site-packages/bs4/tests/test_html5lib.pyttest_reparented_markupJscCsQd}|j|�}|jd|jj��|jdt|jd���dS(Ns&<p><em>foo</p>
<p>bar<a></a></em></p>
uE<body><p><em>foo</em></p><em>
</em><p><em>bar<a></a></em></p>
</body>iR(RRRRRR (RRR((s;/usr/lib/python2.7/site-packages/bs4/tests/test_html5lib.pyt+test_reparented_markup_ends_with_whitespaceQscCsFd}|j|�}|jdd�\}}|jd�\}}dS(s�Verify that we keep the two whitespace nodes in this
        document distinct when reparenting the adjacent <tbody> tags.
        s,<table> <tbody><tbody><ims></tbody> </table>tstringt ttbodyN(RR (RRRtspace1tspace2ttbody1ttbody2((s;/usr/lib/python2.7/site-packages/bs4/tests/test_html5lib.pyt<test_reparented_markup_containing_identical_whitespace_nodesWs
cCs�d}|j|�}|j}|jd|j�|jdd�}|jdd�d}|j||j�|j||j�dS(NsF<div><a>aftermath<p><noscript>target</noscript>aftermath</a></p></div>ttargetR#t	aftermathi����(RtnoscriptRtnext_elementtfindR tprevious_element(RRRR-R+tfinal_aftermath((s;/usr/lib/python2.7/site-packages/bs4/tests/test_html5lib.pyt*test_reparented_markup_containing_childrenbs	cCsd}|j|�}dS(s(Processing instructions become comments.s<?PITarget PIContent?>N(R(RRR((s;/usr/lib/python2.7/site-packages/bs4/tests/test_html5lib.pyttest_processing_instructionrscCs>d}|j|�}|jd�\}}|j||�dS(Ns<a class="my_class"><p></a>ta(RR R(RRRta1ta2((s;/usr/lib/python2.7/site-packages/bs4/tests/test_html5lib.pyttest_cloned_multivalue_nodexs
cCs2d}|j|�}|jd|jj��dS(Ns<table><td></tbody>Au><body>A<table><tbody><tr><td></td></tr></tbody></table></body>(RRRR(RRR((s;/usr/lib/python2.7/site-packages/bs4/tests/test_html5lib.pyttest_foster_parentings(t__name__t
__module__t__doc__tpropertyRRRRR!R"R*R2R3R7R8(((s;/usr/lib/python2.7/site-packages/bs4/tests/test_html5lib.pyRs	
								(R;Rtbs4.builderRR
tHTML5LIB_PRESENTtImportErrortetFalsetbs4.elementRtbs4.testingRRRR(((s;/usr/lib/python2.7/site-packages/bs4/tests/test_html5lib.pyt<module>s