403Webshell
Server IP : 172.67.131.151  /  Your IP : 104.23.197.228
Web Server : Apache
System : Linux keen-cori.18-142-40-148.plesk.page 5.15.0-1084-aws #91~20.04.1-Ubuntu SMP Fri May 2 06:59:36 UTC 2025 x86_64
User : simottodesign.com_2tntp341vs7 ( 10011)
PHP Version : 8.3.31
Disable Function : opcache_get_status
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/bs4/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/bs4/__pycache__/testing.cpython-38.pyc
U

t�^!��@s�dZdZddlZddlZddlZddlZddlmZddlmZddl	m
Z
mZmZm
Z
mZmZddlmZeZdZGd	d
�d
ej�ZGdd�de�ZGd
d�de�ZGdd�de�Zdd�ZdS)zHelper classes for tests.ZMIT�N)�TestCase)�
BeautifulSoup)�CharsetMetaAttributeValue�Comment�ContentMetaAttributeValue�Doctype�SoupStrainer�Tag)�HTMLParserTreeBuilderu-
A bare string
<!DOCTYPE xsl:stylesheet SYSTEM "htmlent.dtd">
<!DOCTYPE xsl:stylesheet PUBLIC "htmlent.dtd">
<div><![CDATA[A CDATA section where it doesn't belong]]></div>
<div><svg><![CDATA[HTML5 does allow CDATA sections in SVG]]></svg></div>
<div>A <meta> tag</div>
<div>A <br> tag that supposedly has contents.</br></div>
<div>AT&T</div>
<div><textarea>Within a textarea, markup like <b> tags and <&<&amp; should be treated as literal</textarea></div>
<div><script>if (i < 2) { alert("<b>Markup within script tags should be treated as literal.</b>"); }</script></div>
<div>This numeric entity is missing the final semicolon: <x t="pi&#241ata"></div>
<div><a href="http://example.com/</a> that attribute value never got closed</div>
<div><a href="foo</a>, </a><a href="bar">that attribute value was closed by the subsequent tag</a></div>
<! This document starts with a bogus declaration ><div>a</div>
<div>This document contains <!an incomplete declaration <div>(do you see it?)</div>
<div>This document ends with <!an incomplete declaration
<div><a style={height:21px;}>That attribute value was bogus</a></div>
<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">The doctype is invalid because it contains extra whitespace
<div><table><td nowrap>That boolean attribute had no value</td></table></div>
<div>Here's a nonexistent entity: &#foo; (do you see it?)</div>
<div>This document ends before the entity finishes: &gt
<div><p>Paragraphs shouldn't contain block display elements, but this one does: <dl><dt>you see?</dt></p>
<b b="20" a="1" b="10" a="2" a="3" a="4">Multiple values for the same attribute.</b>
<div><table><tr><td>Here's a table</td></tr></table></div>
<div><table id="1"><tr><td>Here's a nested table:<table id="2"><tr><td>foo</td></tr></table></td></div>
<div>This tag contains nothing but whitespace: <b>    </b></div>
<div><blockquote><p><b>This p tag is cut off by</blockquote></p>the end of the blockquote tag</div>
<div><table><div>This table contains bare markup</div></table></div>
<div><div id="1">
 <a href="link1">This link is never closed.
</div>
<div id="2">
 <div id="3">
   <a href="link2">This link is closed.</a>
  </div>
</div></div>
<div>This document contains a <!DOCTYPE surprise>surprise doctype</div>
<div><a><B><Cd><EFG>Mixed case tags are folded to lowercase</efg></CD></b></A></div>
<div><our☃>Tag name contains Unicode characters</our☃></div>
<div><a ☃="snowman">Attribute name contains Unicode characters</a></div>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
c@sDeZdZedd��Zdd�Zdd�Zddd	�Zd
d�Zdd
d�Z	dS)�SoupTestcCstS�N)�default_builder��self�r�-/usr/lib/python3/dist-packages/bs4/testing.pyr
@szSoupTest.default_buildercKs"|�d|j�}t|fd|i|��S)z*Build a Beautiful Soup object from markup.�builder)�popr
r)r�markup�kwargsrrrr�soupDsz
SoupTest.soupcKs|jf|��|�S)z[Turn an HTML fragment into a document.

        The details depend on the builder.
        )r
Ztest_fragment_to_document)rrrrrr�document_forIszSoupTest.document_forNcCs8|j}t||d�}|dkr|}|�|��|�|��dS)N)r)r
r�assertEqual�decoder)rZto_parseZcompare_parsed_tor�objrrr�assertSoupEqualsPs
zSoupTest.assertSoupEqualscCs8d}|jD](}|r.|�||j�|�||j�|}q
dS)zyEnsure that next_element and previous_element are properly
        set for all descendants of the given element.
        N)Zdescendantsr�next_element�previous_element)r�elementZearlier�errr�assertConnectednessXs
zSoupTest.assertConnectednessFc		Cs�d}|jdkrh|jdks,td�||jd���|jdksJtd�||jd���|jdkshtd�||jd���d}d}d}t|j�d}|jD�]�}d}|dk�r|jdk	�r�|j|ks�td�||j|���|j|ks�td�||j|���|jdk�s�td�||jd���n�|j|j|dk�s:td	�||j|j|d���|j|dj|k�sxtd
�|j|d|j|dj|���|dk	�r�|j|k�s�td�||j||jj���|j|k�s�td�||j|���t	|t
��r|j�r|�|d
�}|jdk�std
�||jd���|dk	�r|}n|}||k�rF|jdk�sFtd
�||jd���|d7}q�|dk	�r^|n|}|dk�rp|}|�s�|dk	�r�|}|dk�r�|jdk�s�td�||jd����q�n4|jdk	�r�|j|jk�s�td�||j|j����q�|j}�q�dS|SdS)z.Ensure proper linkage throughout the document.Nz3Bad previous_element
NODE: {}
PREV: {}
EXPECTED: {}z3Bad previous_sibling
NODE: {}
PREV: {}
EXPECTED: {}z/Bad next_sibling
NODE: {}
NEXT: {}
EXPECTED: {}r�z/Bad next_element
NODE: {}
NEXT: {}
EXPECTED: {}z2Bad previous_sibling
NODE: {}
PREV {}
EXPECTED: {}z1Bad previous_sibling
NODE: {}
PREV {}
EXPECTED {}z-Bad next_sibling
NODE: {}
NEXT {}
EXPECTED {}z=Bad previous_element
NODE: {}
PREV {}
EXPECTED {}
CONTENTS {}z-Bad next_element
NODE: {}
NEXT {}
EXPECTED {}T)�parentr�AssertionError�formatZprevious_siblingZnext_sibling�len�contentsr�
isinstancer	�linkage_validator)	rZelZ_recursive_callZ
descendant�idxZchildZ
last_childZlast_idx�targetrrrr(cs
������
����������
������

��


����
zSoupTest.linkage_validator)N)F)
�__name__�
__module__�__qualname__�propertyr
rrrr r(rrrrr>s

rc@s�eZdZdZdd�Zdd�Zdd�Zd{d	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#dCdD�Z$dEdF�Z%dGdH�Z&dIdJ�Z'dKdL�Z(dMd�ZdNdO�Z)dPdQ�Z*dRdS�Z+dTdU�Z,dVdW�Z-dXdY�Z.dZd[�Z/d\d]�Z0d^d_�Z1d`da�Z2dbdc�Z3ddde�Z4dfdg�Z5dhdi�Z6djdk�Z7dldm�Z8dndo�Z9dpdq�Z:drds�Z;dtdu�Z<dvdw�Z=dxdy�Z>dzS)|�HTMLTreeBuilderSmokeTestaCA basic test of a treebuilder's competence.

    Any HTML treebuilder, present or future, should be able to pass
    these tests. With invalid markup, there's room for interpretation,
    and different parsers can handle it differently. But with the
    markup in these tests, there's not much room for interpretation.
    cCs0dD]&}|�d�}|�|�}|�d|j�qdS)zmVerify that all HTML4 and HTML5 empty element (aka void element) tags
        are handled correctly.
        )Zarea�base�br�colZembedZhrZimg�inputZkeygen�linkZmenuitem�metaZparam�sourceZtrackZwbrZspacer�frame�TN)r�new_tagr�is_empty_element)r�namerr9rrr�test_empty_element_tags�s

z0HTMLTreeBuilderSmokeTest.test_empty_element_tagscCsF|�d�}t�|d�}t�|�}|�|jt�|�|��|���dS�Nz
<a><b>foo</a>��r�pickle�dumps�loadsr�	__class__rr�rZtreeZdumpedZloadedrrr�!test_pickle_and_unpickle_identity�s


z:HTMLTreeBuilderSmokeTest.test_pickle_and_unpickle_identitycCsh|�|�\}}|jd}|�|jt�|�||�|�|�d�dt|��|�|�|jjdd�dS)z8Assert that a given doctype string is handled correctly.r�utf8N�foo��_document_with_doctyper&rrCr�encoder%�p�r�doctype_fragmentZdoctype_strr�doctyperrr�assertDoctypeHandled�s
�z-HTMLTreeBuilderSmokeTest.assertDoctypeHandled�DOCTYPEcCs,d||f}|d}|�|�}|�d�|fS)z5Generate and parse a document with the given doctype.z<!%s %s>z
<p>foo</p>rF)rrJ)rrMZdoctype_stringrNrrrrrrIs
z/HTMLTreeBuilderSmokeTest._document_with_doctypecCs|�d�|�d�dS)z?Make sure normal, everyday HTML doctypes are handled correctly.�htmlz4html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"N�rOrrrr�test_normal_doctypes
s
�z-HTMLTreeBuilderSmokeTest.test_normal_doctypescCs(|�d�}|jd}|�d|���dS)Nz
<!DOCTYPE>rr8)rr&r�strip)rrrNrrr�test_empty_doctypes

z+HTMLTreeBuilderSmokeTest.test_empty_doctypecCstdD]j}|�d|�\}}|jd}|�|jt�|�|d�|�|�d�dt|��d�|�|jjdd�qdS)N)rNZDocTyperQrrFs<!DOCTYPE html>rGrHrLrrr�test_mixed_case_doctypes�
�z0HTMLTreeBuilderSmokeTest.test_mixed_case_doctypecCsd}|�|�dS)Nznhtml PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"rR)rrNrrr�test_public_doctype_with_url-sz5HTMLTreeBuilderSmokeTest.test_public_doctype_with_urlcCs|�d�dS)Nz$foo SYSTEM "http://www.example.com/"rRrrrr�test_system_doctype1sz,HTMLTreeBuilderSmokeTest.test_system_doctypecCs|�d�dS)Nz#xsl:stylesheet SYSTEM "htmlent.dtd"rRrrrr�test_namespaced_system_doctype4sz7HTMLTreeBuilderSmokeTest.test_namespaced_system_doctypecCs|�d�dS)Nz#xsl:stylesheet PUBLIC "htmlent.dtd"rRrrrr�test_namespaced_public_doctype8sz7HTMLTreeBuilderSmokeTest.test_namespaced_public_doctypecCs4d}|�|�}|�|�d��dd�|�dd��dS)zJA real XHTML document should come out more or less the same as it went in.��<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>Hello.</title></head>
<body>Goodbye.</body>
</html>�utf-8�
�N)rrrJ�replace�rrrrrr�test_real_xhtml_document<s

�z1HTMLTreeBuilderSmokeTest.test_real_xhtml_documentcCs(d}|�|�}|�dt|�d���dS)ztWhen a namespaced XML document is parsed as HTML it should
        be treated as HTML with weird tag names.
        s.<ns1:foo>content</ns1:foo><ns1:foo/><ns2:foo/>r>zns1:fooN�rrr%Zfind_allr`rrr�test_namespaced_htmlIs
z-HTMLTreeBuilderSmokeTest.test_namespaced_htmlcCsBd}|�|�}|�||���d}|�|�}|�||�d��dS)Nz<?PITarget PIContent?>s<?PITarget PIContent?>rF)rrrrJr`rrr�test_processing_instructionQs

z4HTMLTreeBuilderSmokeTest.test_processing_instructioncCst�|j�dS)z�Make sure you can copy the tree builder.

        This is important because the builder is part of a
        BeautifulSoup object, and we want to be able to copy that.
        N)�copy�deepcopyr
rrrr�
test_deepcopy^sz&HTMLTreeBuilderSmokeTest.test_deepcopycCs.|�d�}|�|jj�|�t|j�d�dS)z�A <p> tag is never designated as an empty-element tag.

        Even if the markup shows it as an empty-element tag, it
        shouldn't be presented that way.
        �<p/>�<p></p>N)rZassertFalserKr:r�str�rrrrr�!test_p_tag_is_never_empty_elementfs
z:HTMLTreeBuilderSmokeTest.test_p_tag_is_never_empty_elementcCs(|�dd�|�dd�|�dd�dS)z�A tag that's not closed by the end of the document should be closed.

        This applies to all tags except empty-element tags.
        �<p>riz<b>z<b></b>z<br>�<br/>N�rrrrr�test_unclosed_tags_get_closedpsz6HTMLTreeBuilderSmokeTest.test_unclosed_tags_get_closedcCs.|�d�}|�|jj�|�t|j�d�dS)z�A <br> tag is designated as an empty-element tag.

        Some parsers treat <br></br> as one <br/> tag, some parsers as
        two tags, but it should always be an empty-element tag.
        z	<br></br>rnN)r�
assertTruer1r:rrjrkrrr�#test_br_is_always_empty_element_tagzs
z<HTMLTreeBuilderSmokeTest.test_br_is_always_empty_element_tagcCs|�d�dS)Nz<em><em></em></em>rorrrr�test_nested_formatting_elements�sz8HTMLTreeBuilderSmokeTest.test_nested_formatting_elementscCs(d}|�|�}|�d|�d�d�dS)Nz�<!DOCTYPE html>
<html>
<head>
<title>Ordinary HEAD element test</title>
</head>
<script type="text/javascript">
alert("Help!");
</script>
<body>
Hello, world!
</body>
</html>
ztext/javascript�script�type)rr�find)rrQrrrr�test_double_head�s
z)HTMLTreeBuilderSmokeTest.test_double_headcCsjd}|�|�|�|�}|jdd�}|�|jt�|jdd�}|�||j�|jdd�}|�||j�dS)Nz<p>foo<!--foobar-->baz</p>Zfoobar)�textrG�baz)rrrvrrCrrr)rrrZcommentrGryrrr�test_comment�s

z%HTMLTreeBuilderSmokeTest.test_commentcCstd}d}|�|�|�|�|�|�}|�|j��|�|�|�}|�|j��|�|�d�}|�|j��d�dS)zWhitespace must be preserved in <pre> and <textarea> tags,
        even if that would mean not prettifying the markup.
        z<pre>   </pre>z<textarea> woo
woo  </textarea>z<textarea></textarea>N)rrrZpreZprettifyZtextarea)rZ
pre_markupZtextarea_markuprrrr�-test_preserved_whitespace_in_pre_and_textarea�s




zFHTMLTreeBuilderSmokeTest.test_preserved_whitespace_in_pre_and_textareacCs.d}|�|�d}|�|�d}|�|�dS)z+Inline elements can be nested indefinitely.z<b>Inside a B tag</b>z!<p>A <i>nested <b>tag</b></i></p>z/<p>A <a>doubly <i>nested <b>tag</b></i></a></p>Nro)rZb_tagZnested_b_tagZdouble_nested_b_tagrrr�test_nested_inline_elements�s

z4HTMLTreeBuilderSmokeTest.test_nested_inline_elementscCs6|�d�}|j}|�|jjjd�|�|jjd�dS)zBlock elements can be nested.z*<blockquote><p><b>Foo</b></p></blockquote>ZFooN)r�
blockquoterrK�b�string)rrr}rrr� test_nested_block_level_elements�s
z9HTMLTreeBuilderSmokeTest.test_nested_block_level_elementscCsd}|�|d�|�d�dS)z$One table can go inside another one.z[<table id="1"><tr><td>Here's another table:<table id="2"><tr><td>foo</td></tr></table></td>zh<table id="1"><tr><td>Here's another table:<table id="2"><tr><td>foo</td></tr></table></td></tr></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>Nro)rrrrr�test_correctly_nested_tables�s��z5HTMLTreeBuilderSmokeTest.test_correctly_nested_tablescCs@d}|�|�}|�ddg|jd�|�|j|jddd��dS)Nz<div class=" foo bar	 "></a>rG�bar�class�divzfoo bar)Zclass_)rrr�rvr`rrr�*test_multivalued_attribute_with_whitespace�s
zCHTMLTreeBuilderSmokeTest.test_multivalued_attribute_with_whitespacecCs(d}|�|�}|�dg|jjd�dS)Nz1<table><div><div class="css"></div></div></table>Zcssr�)rrr�r`rrr�(test_deeply_nested_multivalued_attribute�s
zAHTMLTreeBuilderSmokeTest.test_deeply_nested_multivalued_attributecCs(d}|�|�}|�ddg|jd�dS)Nz<html class="a b"></html>�ar~r�)rrrQr`rrr�"test_multivalued_attribute_on_html�s
z;HTMLTreeBuilderSmokeTest.test_multivalued_attribute_on_htmlcCs|�dd�dS)Nz<a b="<a>"></a>z<a b="&lt;a&gt;"></a>rorrrr�3test_angle_brackets_in_attribute_values_are_escaped�szLHTMLTreeBuilderSmokeTest.test_angle_brackets_in_attribute_values_are_escapedcCs|�dd�dS)Nz$<p>&bull; AT&T is in the s&p 500</p>u)<p>• AT&amp;T is in the s&amp;p 500</p>rorrrr�3test_strings_resembling_character_entity_references�s�zLHTMLTreeBuilderSmokeTest.test_strings_resembling_character_entity_referencescCs|�dd�dS)Nz<p>Bob&apos;s Bar</p>z<p>Bob's Bar</p>rorrrr�test_apos_entitys�z)HTMLTreeBuilderSmokeTest.test_apos_entitycCs"d}|�|�}|�d|jj�dS)Nz%<p>&#147;Hello&#148; &#45;&#9731;</p>u“Hello” -☃�rrrKrr`rrr�*test_entities_in_foreign_document_encodings
zCHTMLTreeBuilderSmokeTest.test_entities_in_foreign_document_encodingcCs8d}|�d|�|�d|�|�d|�|�d|�dS)Nu<p id="piñata"></p>z<p id="pi&#241;ata"></p>z<p id="pi&#xf1;ata"></p>z<p id="pi&#Xf1;ata"></p>z<p id="pi&ntilde;ata"></p>ro�rZexpectrrr�0test_entities_in_attributes_converted_to_unicodes
zIHTMLTreeBuilderSmokeTest.test_entities_in_attributes_converted_to_unicodecCs8d}|�d|�|�d|�|�d|�|�d|�dS)Nu<p>piñata</p>z<p>pi&#241;ata</p>z<p>pi&#xf1;ata</p>z<p>pi&#Xf1;ata</p>z<p>pi&ntilde;ata</p>ror�rrr�*test_entities_in_text_converted_to_unicodes
zCHTMLTreeBuilderSmokeTest.test_entities_in_text_converted_to_unicodecCs|�dd�dS)Nz#<p>I said &quot;good day!&quot;</p>z<p>I said "good day!"</p>rorrrr�,test_quot_entity_converted_to_quotation_mark&s�zEHTMLTreeBuilderSmokeTest.test_quot_entity_converted_to_quotation_markcCs,d}|�d|�|�d|�|�d|�dS)Nu�z&#10000000000000;z&#x10000000000000;z
&#1000000000;ror�rrr�test_out_of_range_entity*sz1HTMLTreeBuilderSmokeTest.test_out_of_range_entitycCs<|�d�}|�d|jjjj�|�d|jj�|�|�dS)zDMostly to prevent a recurrence of a bug in the html5lib treebuilder.z!<html><h2>
foo</h2><p></p></html>rKN)rrZh2rrr;rKr rkrrr�test_multipart_strings0s
z/HTMLTreeBuilderSmokeTest.test_multipart_stringscCs|�dd�|�dd�dS)zqVerify consistent handling of empty-element tags,
        no matter how they come in through the markup.
        z<br/><br/><br/>z<br /><br /><br />Nrorrrrr<7scCs,d}|�|�}|�d|jj�|�|�dS)�8Prevent recurrence of a bug in the html5lib treebuilder.z?<html><head></head>
  <link></link>
  <body>foo</body>
</html>
N)rZassertNotEqualrQ�bodyr �r�contentrrrr�#test_head_tag_between_head_and_body>s
z<HTMLTreeBuilderSmokeTest.test_head_tag_between_head_and_bodycCsd}|�|�}|�|j�dS)r�z�<!DOCTYPE html>
<html>
 <body>
   <article id="a" >
   <div><a href="1"></div>
   <footer>
     <a href="2"></a>
   </footer>
  </article>
  </body>
</html>
N)rr Zarticler�rrr�test_multiple_copies_of_a_tagIs
z6HTMLTreeBuilderSmokeTest.test_multiple_copies_of_a_tagcCs^d}|�|�}|�||���|j}|�d|jd�|�d|jd�|�d|jd�dS)	z�Parsers don't need to *understand* namespaces, but at the
        very least they should not choke on namespaces or lose
        data.s�<html xmlns="http://www.w3.org/1999/xhtml" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:svg="http://www.w3.org/2000/svg"><head></head><body><mathml:msqrt>4</mathml:msqrt><b svg:fill="red"></b></body></html>�http://www.w3.org/1999/xhtmlZxmlns�"http://www.w3.org/1998/Math/MathMLzxmlns:mathml�http://www.w3.org/2000/svgz	xmlns:svgN)rrrJrQ)rrrrQrrr�test_basic_namespacesZs
��z.HTMLTreeBuilderSmokeTest.test_basic_namespacescCs(d}|�|�}|�ddg|jd�dS)Ns<a class="foo bar">rGr�r�)rrr�r`rrr�-test_multivalued_attribute_value_becomes_listis
zFHTMLTreeBuilderSmokeTest.test_multivalued_attribute_value_becomes_listcCs"d}|�|�}|�d|jj�dS)NuD<html><head><meta encoding="euc-jp"></head><body>Sacré bleu!</body>�Sacré bleu!)rrr�rr`rrr�test_can_parse_unicode_documentus
z8HTMLTreeBuilderSmokeTest.test_can_parse_unicode_documentcCs*td�}|jd|d�}|�|��d�dS)z2Parsers should be able to work with SoupStrainers.r~z&A <b>bold</b> <meta/> <i>statement</i>)Z
parse_onlyz<b>bold</b>N)rrrr)rZstrainerrrrr�test_soupstrainer}s
�z*HTMLTreeBuilderSmokeTest.test_soupstrainercCs|�dd�dS)Nz<foo attr='bar'></foo>z<foo attr="bar"></foo>rorrrr�7test_single_quote_attribute_values_become_double_quotes�s�zPHTMLTreeBuilderSmokeTest.test_single_quote_attribute_values_become_double_quotescCsd}|�|�dS)N�'<foo attr='bar "brawls" happen'>a</foo>ro)rrxrrr�7test_attribute_values_with_nested_quotes_are_left_alone�szPHTMLTreeBuilderSmokeTest.test_attribute_values_with_nested_quotes_are_left_alonecCs.d}|�|�}d|jd<|�|j��d�dS)Nr�zBrawls happen at "Bob's Bar"�attrz:<foo attr="Brawls happen at &quot;Bob's Bar&quot;">a</foo>)rrGrr)rrxrrrr�:test_attribute_values_with_double_nested_quotes_get_quoted�s

�zSHTMLTreeBuilderSmokeTest.test_attribute_values_with_double_nested_quotes_get_quotedcCs|�dd�|�dd�dS)Nz+<this is="really messed up & stuff"></this>z/<this is="really messed up &amp; stuff"></this>z.<a href="http://example.org?a=1&b=2;3">foo</a>z2<a href="http://example.org?a=1&amp;b=2;3">foo</a>rorrrr�.test_ampersand_in_attribute_value_gets_escaped�s��zGHTMLTreeBuilderSmokeTest.test_ampersand_in_attribute_value_gets_escapedcCs|�d�dS)Nz/<a href="http://example.org?a=1&amp;b=2;3"></a>rorrrr�7test_escaped_ampersand_in_attribute_value_is_left_alone�szPHTMLTreeBuilderSmokeTest.test_escaped_ampersand_in_attribute_value_is_left_alonecCsd}d}|�||�dS)N�-<p>&lt;&lt;sacr&eacute;&#32;bleu!&gt;&gt;</p>�#<p>&lt;&lt;sacré bleu!&gt;&gt;</p>ro)rrx�expectedrrr�1test_entities_in_strings_converted_during_parsing�szJHTMLTreeBuilderSmokeTest.test_entities_in_strings_converted_during_parsingcCs"d}|�|�}|�|jjd�dS)Ns<p>�Foo�</p>u	‘Foo’r�)rZquoterrrr�)test_smart_quotes_converted_on_the_way_in�s
�zBHTMLTreeBuilderSmokeTest.test_smart_quotes_converted_on_the_way_incCs|�d�}|�|jjd�dS)Nz<a>&nbsp;&nbsp;</a>u  )rrr�rrkrrr�0test_non_breaking_spaces_converted_on_the_way_in�s
zIHTMLTreeBuilderSmokeTest.test_non_breaking_spaces_converted_on_the_way_incCs0d}d�d�}|�|�}|�|j�d�|�dS)Nr�r�r\)rJrrrK)rrxr�rrrr�&test_entities_converted_on_the_way_out�s

z?HTMLTreeBuilderSmokeTest.test_entities_converted_on_the_way_outcCsHd}|�d�}|�|�}|�d�}|�dd�}|�d�}|�||�dS)Nu�<html><head><meta content="text/html; charset=ISO-Latin-1" http-equiv="Content-type"/></head><body><p>Sacré bleu!</p></body></html>z
iso-8859-1r\zISO-Latin-1)rJrr_r)r�unicode_htmlZiso_latin_htmlr�resultr�rrr�test_real_iso_latin_document�s



z5HTMLTreeBuilderSmokeTest.test_real_iso_latin_documentcCsLd}|�d�}|�|�}|�|�d�|�d��|�|�d�|�d��dS)Nsk<html><head></head><body><pre>�����Shift-JIS�ŃR�[�f�B���O���ꂽ���{��̃t�@�C���ł��B</pre></body></html>z	shift-jisr\�euc_jp)rrrrJ)r�shift_jis_htmlr�rrrr�test_real_shift_jis_document�s�

z5HTMLTreeBuilderSmokeTest.test_real_shift_jis_documentcCsBd}|j|dd�}|jdks t�|�|�d�|�d��d��dS)Ns�<html><head><title>Hebrew (ISO 8859-8) in Visual Directionality</title></head><body><h1>Hebrew (ISO 8859-8) in Visual Directionality</h1>���</body></html>�	iso8859-8)Z
from_encoding)r�z
iso-8859-8r\)rZoriginal_encodingr#rrJr)rZhebrew_documentrrrr�test_real_hebrew_document�s��z2HTMLTreeBuilderSmokeTest.test_real_hebrew_documentcCs`d}d|}|�|�}|�dddi�}|d}|�d|�|�t|t��|�d|�d	��dS)
NzE<meta content="text/html; charset=x-sjis" http-equiv="Content-type"/>�j<html><head>
%s
<meta http-equiv="Content-language" content="ja"/></head><body>Shift-JIS markup goes here.r5z
http-equivzContent-typer�ztext/html; charset=x-sjisztext/html; charset=utf8rF)rrvrrqr'rrJ)r�meta_tagr�r�parsed_metar�rrr�'test_meta_tag_reflects_current_encoding�s�
[email protected]_meta_tag_reflects_current_encodingcCs^d}d|}|�|�}|jddd�}|d}|�d|�|�t|t��|�d|�d��dS)	Nz'<meta id="encoding" charset="x-sjis" />r�r5�encoding)�id�charsetzx-sjisrF)rrvrrqr'rrJ)rr�r�rr�r�rrr�3test_html5_style_meta_tag_reflects_current_encodings�
zLHTMLTreeBuilderSmokeTest.test_html5_style_meta_tag_reflects_current_encodingcCs*|�d�}d|jd<|�d|j���dS)Nz<a>text</a>r�rGz<a foo="bar">text</a>)rr�rr)r�datarrr�5test_tag_with_no_attributes_can_have_attributes_added&s

zNHTMLTreeBuilderSmokeTest.test_tag_with_no_attributes_can_have_attributes_addedcCs|�t�}|�|�dS�z3Test the worst case (currently) for linking issues.N�r�BAD_DOCUMENTr(rkrrr�test_worst_case+s
z(HTMLTreeBuilderSmokeTest.test_worst_caseN)rP)?r+r,r-�__doc__r<rErOrIrSrUrVrWrXrYrZrarcrdrgrlrprrrsrwrzr{r|r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr/�sz	





	
r/c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'S)(�XMLTreeBuilderSmokeTestcCsF|�d�}t�|d�}t�|�}|�|jt�|�|��|���dSr=r?rDrrrrE4s


z9XMLTreeBuilderSmokeTest.test_pickle_and_unpickle_identitycCs|�d�}|�|��d�dS)N�<root/>s.<?xml version="1.0" encoding="utf-8"?>
<root/>�rrrJrkrrr�test_docstring_generated=s

�z0XMLTreeBuilderSmokeTest.test_docstring_generatedcCs$d}|�|�}|�||�d��dS)Ns,<?xml version="1.0" encoding="utf8"?>
<foo/>rFr�r`rrr�test_xml_declarationBs
z,XMLTreeBuilderSmokeTest.test_xml_declarationcCs$d}|�|�}|�||�d��dS)Ns<<?xml version="1.0" encoding="utf8"?>
<?PITarget PIContent?>rFr�r`rrrrdGs
z3XMLTreeBuilderSmokeTest.test_processing_instructioncCs$d}|�|�}|�|�d�|�dS)zGA real XHTML document should come out *exactly* the same as it went in.r[r\Nr�r`rrrraLs
�z0XMLTreeBuilderSmokeTest.test_real_xhtml_documentcCs"d}|�|�}|�||���dS)Ns<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<parent xmlns="http://ns1/">
<child xmlns="http://ns2/" xmlns:ns3="http://ns3/">
<grandchild ns3:attr="value" xmlns="http://ns4/"/>
</child>
</parent>r��r�docrrrr�test_nested_namespacesXs
z.XMLTreeBuilderSmokeTest.test_nested_namespacescCs0d}t|d�}d|j_|��}|�d|k�dS)Nz/
  <script type="text/javascript">
  </script>
zlxml-xmlzconsole.log("< < hey > > ");s&lt; &lt; hey &gt; &gt;)rrtrrJrq)rr�rZencodedrrr�5test_formatter_processes_script_tag_for_xml_documentscs

zMXMLTreeBuilderSmokeTest.test_formatter_processes_script_tag_for_xml_documentscCs"d}|�|�}|�d|jj�dS)Nu?<?xml version="1.0" encoding="euc-jp"><root>Sacré bleu!</root>r�)rr�rootrr`rrrr�os
z7XMLTreeBuilderSmokeTest.test_can_parse_unicode_documentcCs$d}|�|�}|�t|j�|�dS)Nz�<rss xmlns:dc="foo"><dc:creator>b</dc:creator><dc:date>2012-07-02T20:33:42Z</dc:date><dc:rights>c</dc:rights><image>d</image></rss>)rrrjZrssr`rrr�test_popping_namespaced_tagts
�z3XMLTreeBuilderSmokeTest.test_popping_namespaced_tagcCs |�d�}|�|�d�d�dS)Nr��latin1s/<?xml version="1.0" encoding="latin1"?>
<root/>r�rkrrr�(test_docstring_includes_correct_encodingzs

�[email protected]_docstring_includes_correct_encodingcCs$d}|�|�}|�|�d�|�dS)z<A large XML document should come out the same as it went in.s4<?xml version="1.0" encoding="utf-8"?>
<root>0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000</root>r\Nr�r`rrr�test_large_xml_document�s
z/XMLTreeBuilderSmokeTest.test_large_xml_documentcCs|�dd�|�d�dS)Nrmrhz
<p>foo</p>rorrrr�9test_tags_are_empty_element_if_and_only_if_they_are_empty�szQXMLTreeBuilderSmokeTest.test_tags_are_empty_element_if_and_only_if_they_are_emptycCs8d}|�|�}|j}|�d|d�|�d|d�dS)Nz�<root xmlns:a="http://example.com/" xmlns:b="http://example.net/"><a:foo>This tag is in the a namespace</a:foo><b:foo>This tag is in the b namespace</b:foo></root>zhttp://example.com/zxmlns:azhttp://example.net/zxmlns:b)rr�r)rrrr�rrr�test_namespaces_are_preserved�s

z5XMLTreeBuilderSmokeTest.test_namespaces_are_preservedcCs$d}|�|�}|�t|j�|�dS)NzN<p xmlns:dc="http://purl.org/dc/elements/1.1/"><dc:date>20010504</dc:date></p>)rrrjrKr`rrr�test_closing_namespaced_tag�s
z3XMLTreeBuilderSmokeTest.test_closing_namespaced_tagcCs$d}|�|�}|�t|j�|�dS)Nzs<foo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><bar xsi:schemaLocation="http://www.example.com"/></foo>�rrrjrGr`rrr�test_namespaced_attributes�s
z2XMLTreeBuilderSmokeTest.test_namespaced_attributescCs$d}|�|�}|�t|j�|�dS)Nz<foo xml:lang="fr">bar</foo>r�r`rrr�(test_namespaced_attributes_xml_namespace�s
[email protected]_namespaced_attributes_xml_namespacecCs�d}|�|�}|�dt|�d���|�dt|�d���|�dt|�d���|�dt|jddd	���|�dt|�ddg���dS)
Na<?xml version="1.0" encoding="utf-8"?>
<Document xmlns="http://example.com/ns0"
    xmlns:ns1="http://example.com/ns1"
    xmlns:ns2="http://example.com/ns2"
    <ns1:tag>foo</ns1:tag>
    <ns1:tag>bar</ns1:tag>
    <ns2:tag key="value">baz</ns2:tag>
</Document>
��tagr>zns1:tagr!zns2:tag�value)�keyrbr�rrr�test_find_by_prefixed_name�s	
z2XMLTreeBuilderSmokeTest.test_find_by_prefixed_namecCs2d}|�|�}|j}t�|�}|�|j|j�dS)Nzf<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document xmlns:w="http://example.com/ns0"/>)rZdocumentrer�prefix)rZxmlrr�Z	duplicaterrr�!test_copy_tag_preserves_namespace�s


z9XMLTreeBuilderSmokeTest.test_copy_tag_preserves_namespacecCs|�t�}|�|�dSr�r�rkrrrr��s
z'XMLTreeBuilderSmokeTest.test_worst_caseN)r+r,r-rEr�r�rdrar�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr�2s&		r�c@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�HTML5TreeBuilderSmokeTestz2Smoke test for a tree builder that supports HTML5.cCsdSrrrrrrra�sz2HTML5TreeBuilderSmokeTest.test_real_xhtml_documentcCs"d}|�|�}|�d|jj�dS)Nz<a>r�)rrr��	namespacer`rrr�test_html_tags_have_namespace�s
z7HTML5TreeBuilderSmokeTest.test_html_tags_have_namespacecCs6d}|�|�}d}|�||jj�|�||jj�dS)Nz<svg><circle/></svg>r�)rrZsvgr�Zcircle�rrrr�rrr�test_svg_tags_have_namespace�s

z6HTML5TreeBuilderSmokeTest.test_svg_tags_have_namespacecCs6d}|�|�}d}|�||jj�|�||jj�dS)Nz<math><msqrt>5</msqrt></math>r�)rrZmathr�Zmsqrtr�rrr�test_mathml_tags_have_namespace�s

z9HTML5TreeBuilderSmokeTest.test_mathml_tags_have_namespacecCsPd}|�|�}|�t|jdt��|�|jdd�|�d|jdjj�dS)Nz3<?xml version="1.0" encoding="utf-8"?><html></html>rz$?xml version="1.0" encoding="utf-8"?rQ)rrqr'r&rrrr;r`rrr�$test_xml_declaration_becomes_comment�s

z>HTML5TreeBuilderSmokeTest.test_xml_declaration_becomes_commentN)	r+r,r-r�rar�r�r�r�rrrrr��sr�csdd����fdd�}|S)Nc_sdSrr)Ztest�argsrrrr�nothing�szskipIf.<locals>.nothingcs�r�S|SdSrr)Z	test_item��	conditionr�rr�	decorator�szskipIf.<locals>.decoratorr)r��reasonr�rr�r�skipIf�sr�)r�Z__license__r@re�	functoolsZunittestrZbs4rZbs4.elementrrrrrr	Zbs4.builderr
r
r�r�objectr/r�r�r�rrrr�<module>s, 	%`#

Youez - 2016 - github.com/yon3zu
LinuXploit