403Webshell
Server IP : 192.158.238.246  /  Your IP : 18.225.7.106
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python37/lib/python3.7/site-packages/bs4/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib/python3.7/site-packages/bs4/__pycache__/testing.cpython-37.opt-1.pyc
B

�.�`rp�@s�dZdZddlZddlZddlZddlZddlmZddlmZddl	m
Z
mZmZm
Z
mZddlmZeZGdd	�d	ej�ZGd
d�de�ZGdd
�d
e�ZGdd�de�Zdd�ZdS)zHelper classes for tests.ZMIT�N)�TestCase)�
BeautifulSoup)�CharsetMetaAttributeValue�Comment�ContentMetaAttributeValue�Doctype�SoupStrainer)�HTMLParserTreeBuilderc@s:eZdZedd��Zdd�Zdd�Zddd	�Zd
d�ZdS)
�SoupTestcCst�S)N)�default_builder)�self�r
�</opt/alt/python37/lib/python3.7/site-packages/bs4/testing.pyrszSoupTest.default_buildercKs"|�d|j�}t|fd|i|��S)z*Build a Beautiful Soup object from markup.�builder)�poprr)r�markup�kwargsrr
r
r�soupsz
SoupTest.soupcCs|j�|�S)z[Turn an HTML fragment into a document.

        The details depend on the builder.
        )rZtest_fragment_to_document)rrr
r
r�document_for$szSoupTest.document_forNcCs8|j}t||d�}|dkr|}|�|��|�|��dS)N)r)rr�assertEqual�decoder)rZto_parseZcompare_parsed_tor�objr
r
r�assertSoupEquals+s
zSoupTest.assertSoupEqualscCs<d}x2|jD](}|r0|�||j�|�||j�|}qWdS)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�er
r
r�assertConnectedness3szSoupTest.assertConnectedness)N)	�__name__�
__module__�__qualname__�propertyrrrrrr
r
r
rr
s

r
c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�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.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Z d<d=�Z!d>d?�Z"d@dA�Z#dBdC�Z$dDdE�Z%dFdG�Z&dHdI�Z'dJdK�Z(dLdM�Z)dNdO�Z*dPdQ�Z+dRdS�Z,dTdU�Z-dVdW�Z.dXdY�Z/dZd[�Z0d\d]�Z1d^d_�Z2d`da�Z3dbdc�Z4ddde�Z5dfdg�Z6dhS)i�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.
    cCsF|�d�}t�|d�}t�|�}|�|jt�|�|��|���dS)Nz
<a><b>foo</a>�)r�pickle�dumps�loadsr�	__class__rr)r�tree�dumped�loadedr
r
r�!test_pickle_and_unpickle_identityHs


z:HTMLTreeBuilderSmokeTest.test_pickle_and_unpickle_identitycCsf|�|�\}}|jd}|�|jt�|�||�|�t|�dt|��|�|�|jjdd�dS)z8Assert that a given doctype string is handled correctly.rN�foo)�_document_with_doctype�contentsrr'r�str�len�p)r�doctype_fragmentZdoctype_strr�doctyper
r
r�assertDoctypeHandledQs
z-HTMLTreeBuilderSmokeTest.assertDoctypeHandledcCs"d|}|d}|�|�}||fS)z5Generate and parse a document with the given doctype.z
<!DOCTYPE %s>z
<p>foo</p>)r)rr2r3rrr
r
rr-_s
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)r4)rr
r
r�test_normal_doctypesfs
z-HTMLTreeBuilderSmokeTest.test_normal_doctypescCs(|�d�}|jd}|�d|���dS)Nz
<!DOCTYPE>r�)rr.r�strip)rrr3r
r
r�test_empty_doctypels

z+HTMLTreeBuilderSmokeTest.test_empty_doctypecCsd}|�|�dS)Nznhtml PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd")r4)rr3r
r
r�test_public_doctype_with_urlqsz5HTMLTreeBuilderSmokeTest.test_public_doctype_with_urlcCs|�d�dS)Nz$foo SYSTEM "http://www.example.com/")r4)rr
r
r�test_system_doctypeusz,HTMLTreeBuilderSmokeTest.test_system_doctypecCs|�d�dS)Nz#xsl:stylesheet SYSTEM "htmlent.dtd")r4)rr
r
r�test_namespaced_system_doctypexsz7HTMLTreeBuilderSmokeTest.test_namespaced_system_doctypecCs|�d�dS)Nz#xsl:stylesheet PUBLIC "htmlent.dtd")r4)rr
r
r�test_namespaced_public_doctype|sz7HTMLTreeBuilderSmokeTest.test_namespaced_public_doctypecCs4d}|�|�}|�|�d��dd�|�dd��dS)zJA real XHTML document should come out more or less the same as it went in.s�<?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>zutf-8�
�N)rr�encode�replace)rrrr
r
r�test_real_xhtml_document�s

z1HTMLTreeBuilderSmokeTest.test_real_xhtml_documentcCsBd}|�|�}|�||���d}|�|�}|�||�d��dS)Nz<?PITarget PIContent?>s<?PITarget PIContent?>�utf8)rrrr@)rrrr
r
r�test_processing_instruction�s

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)�copyZdeepcopyr)rr
r
r�
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.
        z<p/>z<p></p>N)rZassertFalser1�is_empty_elementrr/)rrr
r
r�!test_p_tag_is_never_empty_element�s
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.
        z<p>z<p></p>z<b>z<b></b>z<br>z<br/>N)r)rr
r
r�test_unclosed_tags_get_closed�s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>z<br/>N)r�
assertTrue�brrGrr/)rrr
r
r�#test_br_is_always_empty_element_tag�s
z<HTMLTreeBuilderSmokeTest.test_br_is_always_empty_element_tagcCs|�d�dS)Nz<em><em></em></em>)r)rr
r
r�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)rr5rr
r
r�test_double_head�s

z)HTMLTreeBuilderSmokeTest.test_double_headcCsjd}|�|�|�|�}|jdd�}|�|jt�|jdd�}|�||j�|jdd�}|�||j�dS)Nz<p>foo<!--foobar-->baz</p>Zfoobar)�textr,�baz)rrrPrr'rrr)rrr�commentr,rSr
r
r�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)rZ
pre_markupZtextarea_markuprr
r
r�-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>N)r)rZb_tagZnested_b_tagZdouble_nested_b_tagr
r
r�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�
blockquoterr1�b�string)rrrXr
r
r� test_nested_block_level_elementss
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>N)r)rrr
r
r�test_correctly_nested_tablessz5HTMLTreeBuilderSmokeTest.test_correctly_nested_tablescCs(d}|�|�}|�dg|jjd�dS)Nz1<table><div><div class="css"></div></div></table>Zcss�class)rrZdiv)rrrr
r
r�(test_deeply_nested_multivalued_attributes
zAHTMLTreeBuilderSmokeTest.test_deeply_nested_multivalued_attributecCs(d}|�|�}|�ddg|jd�dS)Nz<html class="a b"></html>�arYr])rrr5)rrrr
r
r�"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>)r)rr
r
r�3test_angle_brackets_in_attribute_values_are_escaped+szLHTMLTreeBuilderSmokeTest.test_angle_brackets_in_attribute_values_are_escapedcCs8d}|�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>)r)r�expectr
r
r�0test_entities_in_attributes_converted_to_unicode.s
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>)r)rrbr
r
r�*test_entities_in_text_converted_to_unicode5s
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>)r)rr
r
r�,test_quot_entity_converted_to_quotation_mark<szEHTMLTreeBuilderSmokeTest.test_quot_entity_converted_to_quotation_markcCs,d}|�d|�|�d|�|�d|�dS)Nu�z&#10000000000000;z&#x10000000000000;z
&#1000000000;)r)rrbr
r
r�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>r1N)rrZh2rZr�namer1r)rrr
r
r�test_multipart_stringsFs
z/HTMLTreeBuilderSmokeTest.test_multipart_stringscCs,d}|�|�}|�d|jj�|�|�dS)z8Prevent recurrence of a bug in the html5lib treebuilder.z?<html><head></head>
  <link></link>
  <body>foo</body>
</html>
N)rZassertNotEqualr5�bodyr)r�contentrr
r
r�#test_head_tag_between_head_and_bodyMs
z<HTMLTreeBuilderSmokeTest.test_head_tag_between_head_and_bodycCsd}|�|�}|�|j�dS)z8Prevent recurrence of a bug in the html5lib treebuilder.z�<!DOCTYPE html>
<html>
 <body>
   <article id="a" >
   <div><a href="1"></div>
   <footer>
     <a href="2"></a>
   </footer>
  </article>
  </body>
</html>
N)rrZarticle)rrjrr
r
r�test_multiple_copies_of_a_tagXs

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>zhttp://www.w3.org/1999/xhtmlZxmlnsz"http://www.w3.org/1998/Math/MathMLzxmlns:mathmlzhttp://www.w3.org/2000/svgz	xmlns:svgN)rrr@r5)rrrr5r
r
r�test_basic_namespacesis
z.HTMLTreeBuilderSmokeTest.test_basic_namespacescCs(d}|�|�}|�ddg|jd�dS)Ns<a class="foo bar">r,�barr])rrr_)rrrr
r
r�-test_multivalued_attribute_value_becomes_listxs
zFHTMLTreeBuilderSmokeTest.test_multivalued_attribute_value_becomes_listcCs"d}|�|�}|�d|jj�dS)NuD<html><head><meta encoding="euc-jp"></head><body>Sacré bleu!</body>uSacré bleu!)rrrirZ)rrrr
r
r�test_can_parse_unicode_document�s
z8HTMLTreeBuilderSmokeTest.test_can_parse_unicode_documentcCs*td�}|jd|d�}|�|��d�dS)z2Parsers should be able to work with SoupStrainers.rYz&A <b>bold</b> <meta/> <i>statement</i>)Z
parse_onlyz<b>bold</b>N)rrrr)rZstrainerrr
r
r�test_soupstrainer�sz*HTMLTreeBuilderSmokeTest.test_soupstrainercCs|�dd�dS)Nz<foo attr='bar'></foo>z<foo attr="bar"></foo>)r)rr
r
r�7test_single_quote_attribute_values_become_double_quotes�szPHTMLTreeBuilderSmokeTest.test_single_quote_attribute_values_become_double_quotescCsd}|�|�dS)Nz'<foo attr='bar "brawls" happen'>a</foo>)r)rrRr
r
r�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)Nz'<foo attr='bar "brawls" happen'>a</foo>zBrawls happen at "Bob's Bar"�attrz:<foo attr="Brawls happen at &quot;Bob's Bar&quot;">a</foo>)rr,rr)rrRrr
r
r�: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>)r)rr
r
r�.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>)r)rr
r
r�7test_escaped_ampersand_in_attribute_value_is_left_alone�szPHTMLTreeBuilderSmokeTest.test_escaped_ampersand_in_attribute_value_is_left_alonecCsd}d}|�||�dS)Nz-<p>&lt;&lt;sacr&eacute;&#32;bleu!&gt;&gt;</p>u#<p>&lt;&lt;sacré bleu!&gt;&gt;</p>)r)rrR�expectedr
r
r�1test_entities_in_strings_converted_during_parsing�szJHTMLTreeBuilderSmokeTest.test_entities_in_strings_converted_during_parsingcCs"d}|�|�}|�|jjd�dS)Ns<p>�Foo�</p>u	‘Foo’)rrr1rZ)rZquoterr
r
r�)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_rZ)rrr
r
r�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)Nz-<p>&lt;&lt;sacr&eacute;&#32;bleu!&gt;&gt;</p>u#<p>&lt;&lt;sacré bleu!&gt;&gt;</p>zutf-8)r@rrr1)rrRrxrr
r
r�&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-1zutf-8zISO-Latin-1)r@rrAr)r�unicode_htmlZiso_latin_htmlr�resultrxr
r
r�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-jiszutf-8�euc_jp)rrrr@)r�shift_jis_htmlr}rr
r
r�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>z	iso8859-8)Z
from_encoding)z	iso8859-8z
iso-8859-8zutf-8)rZoriginal_encoding�AssertionErrorrr@r)rZhebrew_documentrr
r
r�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"/>zj<html><head>
%s
<meta http-equiv="Content-language" content="ja"/></head><body>Shift-JIS markup goes here.�metaz
http-equivzContent-typerjztext/html; charset=x-sjisztext/html; charset=utf8rC)rrPrrJ�
isinstancerr@)r�meta_tagr�r�parsed_metarjr
r
r�'test_meta_tag_reflects_current_encodings
z@HTMLTreeBuilderSmokeTest.test_meta_tag_reflects_current_encodingcCs^d}d|}|�|�}|jddd�}|d}|�d|�|�t|t��|�d|�d��dS)	Nz'<meta id="encoding" charset="x-sjis" />zj<html><head>
%s
<meta http-equiv="Content-language" content="ja"/></head><body>Shift-JIS markup goes here.r��encoding)�id�charsetzx-sjisrC)rrPrrJr�rr@)rr�r�rr�r�r
r
r�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>rnr,z<a foo="bar">text</a>)rr_rr)r�datar
r
r�5test_tag_with_no_attributes_can_have_attributes_added5s

zNHTMLTreeBuilderSmokeTest.test_tag_with_no_attributes_can_have_attributes_addedN)7rrr �__doc__r+r4r-r6r9r:r;r<r=rBrDrFrHrIrLrMrQrUrVrWr[r\r^r`rarcrdrerfrhrkrlrmrorprqrrrsrurvrwryrzr{r|rr�r�r�r�r�r
r
r
rr">sh	




	
r"c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS) �XMLTreeBuilderSmokeTestcCsF|�d�}t�|d�}t�|�}|�|jt�|�|��|���dS)Nz
<a><b>foo</a>r#)rr$r%r&rr'rr)rr(r)r*r
r
rr+<s


z9XMLTreeBuilderSmokeTest.test_pickle_and_unpickle_identitycCs|�d�}|�|��d�dS)Nz<root/>s.<?xml version="1.0" encoding="utf-8"?>
<root/>)rrr@)rrr
r
r�test_docstring_generatedEs
z0XMLTreeBuilderSmokeTest.test_docstring_generatedcCs$d}|�|�}|�||�d��dS)Ns,<?xml version="1.0" encoding="utf8"?>
<foo/>rC)rrr@)rrrr
r
r�test_xml_declarationJs
z,XMLTreeBuilderSmokeTest.test_xml_declarationcCs$d}|�|�}|�||�d��dS)Ns<<?xml version="1.0" encoding="utf8"?>
<?PITarget PIContent?>rC)rrr@)rrrr
r
rrDOs
z3XMLTreeBuilderSmokeTest.test_processing_instructioncCs$d}|�|�}|�|�d�|�dS)zGA real XHTML document should come out *exactly* the same as it went in.s�<?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>zutf-8N)rrr@)rrrr
r
rrBTs
z0XMLTreeBuilderSmokeTest.test_real_xhtml_documentcCs0d}t|d�}d|j_|��}|�d|k�dS)Nz/
  <script type="text/javascript">
  </script>
zlxml-xmlzconsole.log("< < hey > > ");s&lt; &lt; hey &gt; &gt;)rrNrZr@rJ)r�docrZencodedr
r
r�5test_formatter_processes_script_tag_for_xml_documents`s

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>uSacré bleu!)rr�rootrZ)rrrr
r
rrpls
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>)rrr/Zrss)rrrr
r
r�test_popping_namespaced_tagqs
z3XMLTreeBuilderSmokeTest.test_popping_namespaced_tagcCs |�d�}|�|�d�d�dS)Nz<root/>�latin1s/<?xml version="1.0" encoding="latin1"?>
<root/>)rrr@)rrr
r
r�(test_docstring_includes_correct_encodingws
z@XMLTreeBuilderSmokeTest.test_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>zutf-8N)rrr@)rrrr
r
r�test_large_xml_document}s
z/XMLTreeBuilderSmokeTest.test_large_xml_documentcCs|�dd�|�d�dS)Nz<p>z<p/>z
<p>foo</p>)r)rr
r
r�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)rrrr�r
r
r�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>)rrr/r1)rrrr
r
r�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>)rrr/r,)rrrr
r
r�test_namespaced_attributes�s
z2XMLTreeBuilderSmokeTest.test_namespaced_attributescCs$d}|�|�}|�t|j�|�dS)Nz<foo xml:lang="fr">bar</foo>)rrr/r,)rrrr
r
r�(test_namespaced_attributes_xml_namespace�s
z@XMLTreeBuilderSmokeTest.test_namespaced_attributes_xml_namespaceN)rrr r+r�r�rDrBr�rpr�r�r�r�r�r�r�r�r
r
r
rr�:s		r�c@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�HTML5TreeBuilderSmokeTestz2Smoke test for a tree builder that supports HTML5.cCsdS)Nr
)rr
r
rrB�sz2HTML5TreeBuilderSmokeTest.test_real_xhtml_documentcCs"d}|�|�}|�d|jj�dS)Nz<a>zhttp://www.w3.org/1999/xhtml)rrr_�	namespace)rrrr
r
r�test_html_tags_have_namespace�s
z7HTML5TreeBuilderSmokeTest.test_html_tags_have_namespacecCs6d}|�|�}d}|�||jj�|�||jj�dS)Nz<svg><circle/></svg>zhttp://www.w3.org/2000/svg)rrZsvgr�Zcircle)rrrr�r
r
r�test_svg_tags_have_namespace�s

z6HTML5TreeBuilderSmokeTest.test_svg_tags_have_namespacecCs6d}|�|�}d}|�||jj�|�||jj�dS)Nz<math><msqrt>5</msqrt></math>z"http://www.w3.org/1998/Math/MathML)rr�mathr�Zmsqrt)rrrr�r
r
r�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"?r5)rrJr�r.rrrrg)rrrr
r
r�$test_xml_declaration_becomes_comment�s

z>HTML5TreeBuilderSmokeTest.test_xml_declaration_becomes_commentN)	rrr r�rBr�r�r�r�r
r
r
rr��sr�csdd����fdd�}|S)Nc_sdS)Nr
)Ztest�argsrr
r
r�nothing�szskipIf.<locals>.nothingcs�r�S|SdS)Nr
)Z	test_item)�	conditionr�r
r�	decorator�szskipIf.<locals>.decoratorr
)r��reasonr�r
)r�r�r�skipIf�sr�)r�Z__license__r$rE�	functoolsZunittestrZbs4rZbs4.elementrrrrrZbs4.builderr	rr
�objectr"r�r�r�r
r
r
r�<module>s&%f#

Youez - 2016 - github.com/yon3zu
LinuXploit