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

E.`rp@sdZdZddlZddlZddlZddlZddlmZddlmZddl	m
Z
mZmZm
Z
mZddlmZeZGdd	d	ejZGd
ddeZGdd
d
eZGdddeZddZdS)zHelper classes for tests.ZMITN)TestCase)
BeautifulSoup)CharsetMetaAttributeValueCommentContentMetaAttributeValueDoctypeSoupStrainer)HTMLParserTreeBuilderc@s:eZdZeddZddZddZddd	Zd
dZdS)
SoupTestcCstS)N)default_builder)selfr
</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markupkwargsrr
r
rsoupsz
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)rrassertEqualdecoder)rZto_parseZcompare_parsed_torobjr
r
rassertSoupEquals+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_elementprevious_element)rZelementZearlierer
r
rassertConnectedness3szSoupTest.assertConnectedness)N)	__name__
__module____qualname__propertyrrrrrr
r
r
rr
s

r
c@seZdZdZddZddZddZdd	Zd
dZdd
Z	ddZ
ddZddZddZ
ddZddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9Zd:d;Z d<d=Z!d>d?Z"d@dAZ#dBdCZ$dDdEZ%dFdGZ&dHdIZ'dJdKZ(dLdMZ)dNdOZ*dPdQZ+dRdSZ,dTdUZ-dVdWZ.dXdYZ/dZd[Z0d\d]Z1d^d_Z2d`daZ3dbdcZ4dddeZ5dfdgZ6dhS)iHTMLTreeBuilderSmokeTestaCA 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>)rpickledumpsloadsr	__class__rr)rtreedumpedloadedr
r
r!test_pickle_and_unpickle_identityHs


z:HTMLTreeBuilderSmokeTest.test_pickle_and_unpickle_identitycCsf||\}}|jd}||jt||||t|dt||||jjdddS)z8Assert that a given doctype string is handled correctly.rNfoo)_document_with_doctypecontentsrr&rstrlenp)rdoctype_fragmentZdoctype_strrdoctyper
r
rassertDoctypeHandledQs
z-HTMLTreeBuilderSmokeTest.assertDoctypeHandledcCs"d|}|d}||}||fS)z5Generate and parse a document with the given doctype.z
<!DOCTYPE %s>z
<p>foo</p>)r)rr1r2rrr
r
rr,_s
z/HTMLTreeBuilderSmokeTest._document_with_doctypecCs|d|ddS)z?Make sure normal, everyday HTML doctypes are handled correctly.htmlz4html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"N)r3)rr
r
rtest_normal_doctypesfs
z-HTMLTreeBuilderSmokeTest.test_normal_doctypescCs(|d}|jd}|d|dS)Nz
<!DOCTYPE>r)rr-rstrip)rrr2r
r
rtest_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")r3)rr2r
r
rtest_public_doctype_with_urlqsz5HTMLTreeBuilderSmokeTest.test_public_doctype_with_urlcCs|ddS)Nz$foo SYSTEM "http://www.example.com/")r3)rr
r
rtest_system_doctypeusz,HTMLTreeBuilderSmokeTest.test_system_doctypecCs|ddS)Nz#xsl:stylesheet SYSTEM "htmlent.dtd")r3)rr
r
rtest_namespaced_system_doctypexsz7HTMLTreeBuilderSmokeTest.test_namespaced_system_doctypecCs|ddS)Nz#xsl:stylesheet PUBLIC "htmlent.dtd")r3)rr
r
rtest_namespaced_public_doctype|sz7HTMLTreeBuilderSmokeTest.test_namespaced_public_doctypecCs4d}||}||ddd|dddS)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)rrencodereplace)rrrr
r
rtest_real_xhtml_documents

z1HTMLTreeBuilderSmokeTest.test_real_xhtml_documentcCsBd}||}|||d}||}|||ddS)Nz<?PITarget PIContent?>s<?PITarget PIContent?>utf8)rrrr?)rrrr
r
rtest_processing_instructions

z4HTMLTreeBuilderSmokeTest.test_processing_instructioncCst|jdS)zMake 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_deepcopysz&HTMLTreeBuilderSmokeTest.test_deepcopycCs.|d}||jj|t|jddS)zA <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)rZassertFalser0is_empty_elementrr.)rrr
r
r!test_p_tag_is_never_empty_elements
z:HTMLTreeBuilderSmokeTest.test_p_tag_is_never_empty_elementcCs(|dd|dd|dddS)zA 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
rtest_unclosed_tags_get_closedsz6HTMLTreeBuilderSmokeTest.test_unclosed_tags_get_closedcCs.|d}||jj|t|jddS)zA <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
assertTruebrrFrr.)rrr
r
r#test_br_is_always_empty_element_tags
z<HTMLTreeBuilderSmokeTest.test_br_is_always_empty_element_tagcCs|ddS)Nz<em><em></em></em>)r)rr
r
rtest_nested_formatting_elementssz8HTMLTreeBuilderSmokeTest.test_nested_formatting_elementscCs(d}||}|d|dddS)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/javascriptscripttype)rrfind)rr4rr
r
rtest_double_heads

z)HTMLTreeBuilderSmokeTest.test_double_headcCsjd}||||}|jdd}||jt|jdd}|||j|jdd}|||jdS)Nz<p>foo<!--foobar-->baz</p>Zfoobar)textr+baz)rrrOrr&rrr)rrrcommentr+rRr
r
rtest_comments

z%HTMLTreeBuilderSmokeTest.test_commentcCstd}d}||||||}||j|||}||j||d}||jddS)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_textareas




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
rtest_nested_inline_elementss

z4HTMLTreeBuilderSmokeTest.test_nested_inline_elementscCs6|d}|j}||jjjd||jjddS)zBlock elements can be nested.z*<blockquote><p><b>Foo</b></p></blockquote>ZFooN)r
blockquoterr0bstring)rrrWr
r
r test_nested_block_level_elementss
z9HTMLTreeBuilderSmokeTest.test_nested_block_level_elementscCsd}||d|ddS)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
rtest_correctly_nested_tablessz5HTMLTreeBuilderSmokeTest.test_correctly_nested_tablescCs(d}||}|dg|jjddS)Nz1<table><div><div class="css"></div></div></table>Zcssclass)rrZdiv)rrrr
r
r(test_deeply_nested_multivalued_attributes
zAHTMLTreeBuilderSmokeTest.test_deeply_nested_multivalued_attributecCs(d}||}|ddg|jddS)Nz<html class="a b"></html>arXr\)rrr4)rrrr
r
r"test_multivalued_attribute_on_html#s
z;HTMLTreeBuilderSmokeTest.test_multivalued_attribute_on_htmlcCs|dddS)Nz<a b="<a>"></a>z<a b="&lt;a&gt;"></a>)r)rr
r
r3test_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
r0test_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rar
r
r*test_entities_in_text_converted_to_unicode5s
zCHTMLTreeBuilderSmokeTest.test_entities_in_text_converted_to_unicodecCs|dddS)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rar
r
rtest_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>r0N)rrZh2rYrnamer0r)rrr
r
rtest_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)rZassertNotEqualr4bodyr)rcontentrr
r
r#test_head_tag_between_head_and_bodyMs
z<HTMLTreeBuilderSmokeTest.test_head_tag_between_head_and_bodycCsd}||}||jdS)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rirr
r
rtest_multiple_copies_of_a_tagXs

z6HTMLTreeBuilderSmokeTest.test_multiple_copies_of_a_tagcCs^d}||}||||j}|d|jd|d|jd|d|jddS)	zParsers 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?r4)rrrr4r
r
rtest_basic_namespacesis
z.HTMLTreeBuilderSmokeTest.test_basic_namespacescCs(d}||}|ddg|jddS)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|jjdS)NuD<html><head><meta encoding="euc-jp"></head><body>Sacré bleu!</body>uSacré bleu!)rrrhrY)rrrr
r
rtest_can_parse_unicode_documents
z8HTMLTreeBuilderSmokeTest.test_can_parse_unicode_documentcCs*td}|jd|d}||ddS)z2Parsers should be able to work with SoupStrainers.rXz&A <b>bold</b> <meta/> <i>statement</i>)Z
parse_onlyz<b>bold</b>N)rrrr)rZstrainerrr
r
rtest_soupstrainersz*HTMLTreeBuilderSmokeTest.test_soupstrainercCs|dddS)Nz<foo attr='bar'></foo>z<foo attr="bar"></foo>)r)rr
r
r7test_single_quote_attribute_values_become_double_quotesszPHTMLTreeBuilderSmokeTest.test_single_quote_attribute_values_become_double_quotescCsd}||dS)Nz'<foo attr='bar "brawls" happen'>a</foo>)r)rrQr
r
r7test_attribute_values_with_nested_quotes_are_left_aloneszPHTMLTreeBuilderSmokeTest.test_attribute_values_with_nested_quotes_are_left_alonecCs.d}||}d|jd<||jddS)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rQrr
r
r:test_attribute_values_with_double_nested_quotes_get_quoteds

zSHTMLTreeBuilderSmokeTest.test_attribute_values_with_double_nested_quotes_get_quotedcCs|dd|dddS)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_escapeds
zGHTMLTreeBuilderSmokeTest.test_ampersand_in_attribute_value_gets_escapedcCs|ddS)Nz/<a href="http://example.org?a=1&amp;b=2;3"></a>)r)rr
r
r7test_escaped_ampersand_in_attribute_value_is_left_aloneszPHTMLTreeBuilderSmokeTest.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rQexpectedr
r
r1test_entities_in_strings_converted_during_parsingszJHTMLTreeBuilderSmokeTest.test_entities_in_strings_converted_during_parsingcCs"d}||}||jjddS)Ns<p>Foo</p>u	‘Foo’)rrr0rY)rZquoterr
r
r)test_smart_quotes_converted_on_the_way_ins

zBHTMLTreeBuilderSmokeTest.test_smart_quotes_converted_on_the_way_incCs|d}||jjddS)Nz<a>&nbsp;&nbsp;</a>u  )rrr^rY)rrr
r
r0test_non_breaking_spaces_converted_on_the_way_ins
zIHTMLTreeBuilderSmokeTest.test_non_breaking_spaces_converted_on_the_way_incCs0d}dd}||}||jd|dS)Nz-<p>&lt;&lt;sacr&eacute;&#32;bleu!&gt;&gt;</p>u#<p>&lt;&lt;sacré bleu!&gt;&gt;</p>zutf-8)r?rrr0)rrQrwrr
r
r&test_entities_converted_on_the_way_outs

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?rr@r)runicode_htmlZiso_latin_htmlrresultrwr
r
rtest_real_iso_latin_documents



z5HTMLTreeBuilderSmokeTest.test_real_iso_latin_documentcCsLd}|d}||}||d|d||d|ddS)Nsk<html><head></head><body><pre>Shift-JISŃR[fBOꂽ{̃t@CłB</pre></body></html>z	shift-jiszutf-8euc_jp)rrrr?)rshift_jis_htmlr|rr
r
rtest_real_shift_jis_documents


z5HTMLTreeBuilderSmokeTest.test_real_shift_jis_documentcCsBd}|j|dd}|jdks t||d|dddS)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_encodingAssertionErrorrr?r)rZhebrew_documentrr
r
rtest_real_hebrew_documents
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-typeriztext/html; charset=x-sjisztext/html; charset=utf8rB)rrOrrI
isinstancerr?)rmeta_tagrrparsed_metarir
r
r'test_meta_tag_reflects_current_encodings
z@HTMLTreeBuilderSmokeTest.test_meta_tag_reflects_current_encodingcCs^d}d|}||}|jddd}|d}|d||t|t|d|ddS)	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.rencoding)idcharsetzx-sjisrB)rrOrrIrrr?)rrrrrrr
r
r3test_html5_style_meta_tag_reflects_current_encodings
zLHTMLTreeBuilderSmokeTest.test_html5_style_meta_tag_reflects_current_encodingcCs*|d}d|jd<|d|jdS)Nz<a>text</a>rmr+z<a foo="bar">text</a>)rr^rr)rdatar
r
r5test_tag_with_no_attributes_can_have_attributes_added5s

zNHTMLTreeBuilderSmokeTest.test_tag_with_no_attributes_can_have_attributes_addedN)7rrr__doc__r*r3r,r5r8r9r:r;r<rArCrErGrHrKrLrPrTrUrVrZr[r]r_r`rbrcrdrergrjrkrlrnrorprqrrrtrurvrxryrzr{r~rrrrrr
r
r
rr!>sh	




	
r!c@seZdZddZddZddZddZd	d
ZddZd
dZ	ddZ
ddZddZddZ
ddZddZddZddZdS) 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}||ddS)Nz<root/>s.<?xml version="1.0" encoding="utf-8"?>
<root/>)rrr?)rrr
r
rtest_docstring_generatedEs
z0XMLTreeBuilderSmokeTest.test_docstring_generatedcCs$d}||}|||ddS)Ns,<?xml version="1.0" encoding="utf8"?>
<foo/>rB)rrr?)rrrr
r
rtest_xml_declarationJs
z,XMLTreeBuilderSmokeTest.test_xml_declarationcCs$d}||}|||ddS)Ns<<?xml version="1.0" encoding="utf8"?>
<?PITarget PIContent?>rB)rrr?)rrrr
r
rrCOs
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
rrATs
z0XMLTreeBuilderSmokeTest.test_real_xhtml_documentcCs0d}t|d}d|j_|}|d|kdS)Nz/
  <script type="text/javascript">
  </script>
zlxml-xmlzconsole.log("< < hey > > ");s&lt; &lt; hey &gt; &gt;)rrMrYr?rI)rdocrZencodedr
r
r5test_formatter_processes_script_tag_for_xml_documents`s

zMXMLTreeBuilderSmokeTest.test_formatter_processes_script_tag_for_xml_documentscCs"d}||}|d|jjdS)Nu?<?xml version="1.0" encoding="euc-jp"><root>Sacré bleu!</root>uSacré bleu!)rrrootrY)rrrr
r
rrols
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
rtest_popping_namespaced_tagqs
z3XMLTreeBuilderSmokeTest.test_popping_namespaced_tagcCs |d}||dddS)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
rtest_large_xml_document}s
z/XMLTreeBuilderSmokeTest.test_large_xml_documentcCs|dd|ddS)Nz<p>z<p/>z
<p>foo</p>)r)rr
r
r9test_tags_are_empty_element_if_and_only_if_they_are_emptyszQXMLTreeBuilderSmokeTest.test_tags_are_empty_element_if_and_only_if_they_are_emptycCs8d}||}|j}|d|d|d|ddS)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)rrr)rrrrr
r
rtest_namespaces_are_preserveds

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.r0)rrrr
r
rtest_closing_namespaced_tags
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
rtest_namespaced_attributess
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_namespaces
z@XMLTreeBuilderSmokeTest.test_namespaced_attributes_xml_namespaceN)rrrr*rrrCrArrorrrrrrrrr
r
r
rr:s		rc@s8eZdZdZddZddZddZdd	Zd
dZdS)
HTML5TreeBuilderSmokeTestz2Smoke test for a tree builder that supports HTML5.cCsdS)Nr
)rr
r
rrAsz2HTML5TreeBuilderSmokeTest.test_real_xhtml_documentcCs"d}||}|d|jjdS)Nz<a>zhttp://www.w3.org/1999/xhtml)rrr^	namespace)rrrr
r
rtest_html_tags_have_namespaces
z7HTML5TreeBuilderSmokeTest.test_html_tags_have_namespacecCs6d}||}d}|||jj|||jjdS)Nz<svg><circle/></svg>zhttp://www.w3.org/2000/svg)rrZsvgrZcircle)rrrrr
r
rtest_svg_tags_have_namespaces

z6HTML5TreeBuilderSmokeTest.test_svg_tags_have_namespacecCs6d}||}d}|||jj|||jjdS)Nz<math><msqrt>5</msqrt></math>z"http://www.w3.org/1998/Math/MathML)rrZmathrZmsqrt)rrrrr
r
rtest_mathml_tags_have_namespaces

z9HTML5TreeBuilderSmokeTest.test_mathml_tags_have_namespacecCsPd}||}|t|jdt||jdd|d|jdjjdS)Nz3<?xml version="1.0" encoding="utf-8"?><html></html>rz$?xml version="1.0" encoding="utf-8"?r4)rrIrr-rrrrf)rrrr
r
r$test_xml_declaration_becomes_comments

z>HTML5TreeBuilderSmokeTest.test_xml_declaration_becomes_commentN)	rrrrrArrrrr
r
r
rrsrcsddfdd}|S)Nc_sdS)Nr
)Ztestargsrr
r
rnothingszskipIf.<locals>.nothingcsrS|SdS)Nr
)Z	test_item)	conditionrr
r	decoratorszskipIf.<locals>.decoratorr
)rreasonrr
)rrrskipIfsr)rZ__license__r#rD	functoolsZunittestrZbs4rZbs4.elementrrrrrZbs4.builderr	rr
objectr!rrrr
r
r
r<module>s&%f#