
    Tij                         S r SrSSKrSSKrSSKrSSKrSSKJr  SSKJr  SSK	J
r
JrJrJrJrJrJrJrJr  SSKJr  \rSr " S	 S
\R                  5      r " S S\5      r " S S\5      r " S S\5      rS rg)zHelper classes for tests.MIT    N)TestCase)BeautifulSoup)	CharsetMetaAttributeValueCommentContentMetaAttributeValueDoctypePYTHON_SPECIFIC_ENCODINGSSoupStrainerScript
Stylesheet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                   J    \ rS rSr\S 5       rS rS rS
S jrS r	SS jr
S	rg)SoupTestA   c                     [         $ N)default_builderselfs    ]/var/www/html/backend/Backoffice_Marketplace/venv/lib/python3.13/site-packages/bs4/testing.pyr   SoupTest.default_builderC   s        c                 V    UR                  SU R                  5      n[        U4SU0UD6$ )z*Build a Beautiful Soup object from markup.builder)popr   r   )r   markupkwargsr   s       r   soupSoupTest.soupG   s-    **Y(<(<=V?W???r   c                 D    U R                   " S0 UD6R                  U5      $ )zKTurn an HTML fragment into a document.

The details depend on the builder.
 )r   test_fragment_to_document)r   r   r   s      r   document_forSoupTest.document_forL   s#    
 ##-f-GGOOr   Nc                    U R                   n[        XS9nUc  UnU R                  UR                  5       U R	                  U5      5        [        S [        UR                  R                  5       5       5       5      (       d   eU R                  UR                  /UR                   Vs/ s H  oUR                  PM     sn5        g s  snf )N)r   c              3   *   #    U  H	  oS :H  v   M     g7f)r   Nr#   ).0vs     r   	<genexpr>,SoupTest.assertSoupEquals.<locals>.<genexpr>a   s     E!DAa4!Ds   )r   r   assertEqualdecoder%   alllistopen_tag_countervaluesROOT_TAG_NAMEtagStackname)r   to_parsecompare_parsed_tor   objxs         r   assertSoupEqualsSoupTest.assertSoupEqualsS   s    &&H6$ ( 	t'8'89J'KL Ec&:&:&A&A&C!DEEEEE 	#,,!?,Q&&,!?	
!?s   )C
c                     SnUR                    HB  nU(       a6  U R                  X2R                  5        U R                  X#R                  5        UnMD     g)ziEnsure that next_element and previous_element are properly
set for all descendants of the given element.
N)descendantsr-   next_elementprevious_element)r   elementearlieres       r   assertConnectednessSoupTest.assertConnectednessi   sI     $$A  $8$89  *<*<=G	 %r   c           	         SnUR                   c  UR                  b!   SR                  XR                  S5      5       eUR                  b!   SR                  XR                  S5      5       eUR                  b!   SR                  XR                  S5      5       eSnSnSn[        UR                  5      S-
  nUR                   GHw  nSnUS:X  a  UR                   b  UR                  UL d!   SR                  XR                  U5      5       eUR                  UL d!   SR                  XUR                  U5      5       eUR                  b!   SR                  XUR                  S5      5       eGO(UR                  UR                  US-
     L d1   S	R                  XUR                  UR                  US-
     5      5       eUR                  US-
     R                  UL dB   S
R                  UR                  US-
     UR                  US-
     R                  U5      5       eUbt  UR                  UL d5   SR                  XUR                  XeR                   R                  5      5       eUR                  UL d!   SR                  XfR                  U5      5       e[        U[        5      (       aQ  UR                  (       a@  U R                  US5      nUR                  b!   S
R                  X3R                  S5      5       eUb  UnOUnXG:X  a.  UR                  b!   S
R                  XUR                  S5      5       eUS-  nGMz     Ub  UOUnUc  UnU(       d  Ub  Un Uc0  UR                  b!   SR                  XUR                  S5      5       e gUR                  bF  UR                  UR                  L d+   SR                  XUR                  UR                  5      5       e gUR                   nM  U$ )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?   formatprevious_siblingnext_siblinglencontentsr>   
isinstancer   linkage_validator)	r   el_recursive_call
descendantidxchild
last_childlast_idxtargets	            r   rN   SoupTest.linkage_validatort   sC   
 99&&. HOO++T. &&. HOO++T. ??* DKK*
 
r{{#a'[[EJ ax99(??e3 KRR3 !11R7 OVV!#9#927 !119 NUU!#9#949 --S1W1EE JQQ55r{{377KE {{37+88EA FMMC!G,bkk#'.B.O.OQVA
 ) 11Z? [bb!#9#9:||G\G\? &22e; JQQ&(?(?;
 %%%%..!33E4@
!..6 FMM"$;$;T6 %'
"
 ))1 FMM1141 1HC} !@ )4
%=E5#4F> --5 JQQ!#5#5t5   ((4 --1D1DD JQQ!#5#5v7J7JD     & Lr   r#   r   )F)__name__
__module____qualname____firstlineno__propertyr   r    r%   r:   rC   rN   __static_attributes__r#   r   r   r   r   A   s0     @
P
,	pr   r   c                      \ rS rSrSrS rS rS rS rSDS jr	S r
S	 rS
 rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS r S r!S  r"S! r#S" r$S# r%S$ r&S% r'S& r(S' r)S( r*S) rS* r+S+ r,S, r-S- r.S. r/S/ r0S0 r1S1 r2S2 r3S3 r4S4 r5S5 r6S6 r7S7 r8S8 r9S9 r:S: r;S; r<S< r=S= r>S> r?S? r@S@ rASA rBSBrCgC)EHTMLTreeBuilderSmokeTest   a/  A 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.
c                     S HA  nU R                  S5      nUR                  U5      nU R                  SUR                  5        MC     g)z]Verify that all HTML4 and HTML5 empty element (aka void element) tags
are handled correctly.
)areabasebrcolembedhrimginputkeygenlinkmenuitemmetaparamsourcetrackwbrspacerframe TN)r    new_tagr-   is_empty_element)r   r5   r    ru   s       r   test_empty_element_tags0HTMLTreeBuilderSmokeTest.test_empty_element_tags   sA    
D 99R=Dll4(GT7#;#;<
r   c                    U R                  S5      n[        UR                  R                  [        5      (       d   e[        UR
                  R                  [        5      (       d   eU R                  S5      n[        UR                  R                  [        5      (       d   eU R                  SUR                  R                  5        [        UR                  R                  [        5      (       d   eg )Nz7<style>Some CSS</style><script>Some Javascript</script>z<style><!--Some CSS--></style>z<!--Some CSS-->)r    rM   stylestringr   scriptr   r-   r   r    s     r   test_special_string_containers7HTMLTreeBuilderSmokeTest.test_special_string_containers   s    yyE
 $**++Z8888$++,,f5555yy,
 $**++Z8888 	*DJJ,=,=>$**++Z8888r   c                    U R                  S5      n[        R                  " US5      n[        R                  " U5      nU R	                  UR
                  [        5        U R	                  UR                  5       UR                  5       5        g Nz<a><b>foo</a>   r    pickledumpsloadsr-   	__class__r   r.   r   treedumpedloadeds       r   !test_pickle_and_unpickle_identity:HTMLTreeBuilderSmokeTest.test_pickle_and_unpickle_identity  b     yy)dA&f%))=9$++-8r   c                 V   U R                  U5      u  p#UR                  S   nU R                  UR                  [        5        U R                  XA5        U R                  UR                  S5      S[        U5       U5        U R                  UR                  R                  S   S5        g)z8Assert that a given doctype string is handled correctly.r   utf8Nfoo_document_with_doctyperL   r-   r   r	   encoderK   pr   doctype_fragmentdoctype_strr    doctypes        r   assertDoctypeHandled-HTMLTreeBuilderSmokeTest.assertDoctypeHandled  s     778HI --"**G43KK 1[!12	
 	+U3r   c                 j    SU< SU< S3nUS-   nU R                  U5      nUR                  S5      U4$ )z5Generate and parse a document with the given doctype.z<! >z
<p>foo</p>r   )r    r   )r   r   doctype_stringr   r   r    s         r   r   /HTMLTreeBuilderSmokeTest._document_with_doctype'  s9     .0@A>)yy ~~f%t++r   c                 H    U R                  S5        U R                  S5        g)z?Make sure normal, everyday HTML doctypes are handled correctly.htmlz4html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"Nr   r   s    r   test_normal_doctypes-HTMLTreeBuilderSmokeTest.test_normal_doctypes.  s"    !!&)!!B	Dr   c                     U R                  S5      nUR                  S   nU R                  SUR                  5       5        g )Nz
<!DOCTYPE>r   rt   )r    rL   r-   strip)r   r    r   s      r   test_empty_doctype+HTMLTreeBuilderSmokeTest.test_empty_doctype4  s4    yy&--"W]]_-r   c                 l   S H  nU R                  SU5      u  p#UR                  S   nU R                  UR                  [        5        U R                  US5        U R                  UR                  S5      S [        U5       S5        U R                  UR                  R                  S   S5        M     g )N)r   DocTyper   r   r   s   <!DOCTYPE html>r   r   r   s        r   test_mixed_case_doctype0HTMLTreeBuilderSmokeTest.test_mixed_case_doctype9  s     6 $ ; ;(!K mmA&GW..8Wf-F#$5S%56" TVV__Q/7# !7r   c                 *    SnU R                  U5        g )Nznhtml PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"r   )r   r   s     r   test_public_doctype_with_url5HTMLTreeBuilderSmokeTest.test_public_doctype_with_urlN  s     C!!'*r   c                 &    U R                  S5        g )Nz$foo SYSTEM "http://www.example.com/"r   r   s    r   test_system_doctype,HTMLTreeBuilderSmokeTest.test_system_doctypeR  s    !!"HIr   c                 &    U R                  S5        g )Nz#xsl:stylesheet SYSTEM "htmlent.dtd"r   r   s    r   test_namespaced_system_doctype7HTMLTreeBuilderSmokeTest.test_namespaced_system_doctypeU      !!"GHr   c                 &    U R                  S5        g )Nz#xsl:stylesheet PUBLIC "htmlent.dtd"r   r   s    r   test_namespaced_public_doctype7HTMLTreeBuilderSmokeTest.test_namespaced_public_doctypeY  r   r   c                     SnU R                  U5      nU R                  UR                  S5      R                  SS5      UR                  SS5      5        g)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   
r   N)r    r-   r   replacer   r   r    s      r   test_real_xhtml_document1HTMLTreeBuilderSmokeTest.test_real_xhtml_document]  sN     yy KK ((4NN5#&	(r   c                 ~    SnU R                  U5      nU R                  S[        UR                  S5      5      5        g)zdWhen 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   zns1:fooNr    r-   rK   find_allr   s      r   test_namespaced_html-HTMLTreeBuilderSmokeTest.test_namespaced_htmlj  s6     Gyy Ci 89:r   c                     SnU R                  U5      nU R                  XR                  5       5        SnU R                  U5      nU R                  XR                  S5      5        g )Nz<?PITarget PIContent?>s   <?PITarget PIContent?>r   )r    r-   r.   r   r   s      r   test_processing_instruction4HTMLTreeBuilderSmokeTest.test_processing_instructionr  sU    
 .yy /.yy V!45r   c                 D    [         R                  " U R                  5        g)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)copydeepcopyr   r   s    r   test_deepcopy&HTMLTreeBuilderSmokeTest.test_deepcopy  s     	d**+r   c                     U R                  S5      nU R                  UR                  R                  5        U R	                  [        UR                  5      S5        g)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.
<p/><p></p>N)r    assertFalser   rv   r-   strr}   s     r   !test_p_tag_is_never_empty_element:HTMLTreeBuilderSmokeTest.test_p_tag_is_never_empty_element  sB     yy 001TVVi0r   c                 p    U R                  SS5        U R                  SS5        U R                  SS5        g)zzA tag that's not closed by the end of the document should be closed.

This applies to all tags except empty-element tags.
<p>r   z<b>z<b></b>z<br><br/>Nr:   r   s    r   test_unclosed_tags_get_closed6HTMLTreeBuilderSmokeTest.test_unclosed_tags_get_closed  s4    
 	eY/eY/fg.r   c                     U R                  S5      nU R                  UR                  R                  5        U R	                  [        UR                  5      S5        g)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>r   N)r    
assertTruerd   rv   r-   r   r}   s     r   #test_br_is_always_empty_element_tag<HTMLTreeBuilderSmokeTest.test_br_is_always_empty_element_tag  s@     yy%001TWWw/r   c                 &    U R                  S5        g )Nz<em><em></em></em>r   r   s    r   test_nested_formatting_elements8HTMLTreeBuilderSmokeTest.test_nested_formatting_elements  s    23r   c                 r    SnU R                  U5      nU R                  SUR                  S5      S   5        g )Nz<!DOCTYPE html>
<html>
<head>
<title>Ordinary HEAD element test</title>
</head>
<script type="text/javascript">
alert("Help!");
</script>
<body>
Hello, world!
</body>
</html>
ztext/javascriptr|   type)r    r-   find)r   r   r    s      r   test_double_head)HTMLTreeBuilderSmokeTest.test_double_head  s7     yy*DIIh,?,GHr   c                 R   SnU R                  U5        U R                  U5      nUR                  SS9nU R                  UR                  [
        5        UR                  SS9nU R                  X4R                  5        UR                  SS9nU R                  X5R                  5        g )Nz<p>foo<!--foobar-->baz</p>foobar)textr   baz)r:   r    r   r-   r   r   r>   r?   )r   r   r    commentr   r   s         r   test_comment%HTMLTreeBuilderSmokeTest.test_comment  s    -f%yy )))***G4 iiUi#"2"23iiUi#"6"67r   c                    SnSnU R                  U5        U R                  U5        U R                  U5      nU R                  UR                  R	                  5       U5        U R                  U5      nU R                  UR
                  R	                  5       U5        U R                  S5      nU R                  UR
                  R	                  5       S5        g)zoWhitespace 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)r:   r    r-   preprettifytextarea)r   
pre_markuptextarea_markupr    s       r   -test_preserved_whitespace_in_pre_and_textareaFHTMLTreeBuilderSmokeTest.test_preserved_whitespace_in_pre_and_textarea  s     &
<j)o.yy$**,j9yy)//1?Cyy01//13JKr   c                 v    SnU R                  U5        SnU R                  U5        SnU R                  U5        g)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>Nr   )r   b_tagnested_b_tagdouble_nested_b_tags       r   test_nested_inline_elements4HTMLTreeBuilderSmokeTest.test_nested_inline_elements  s<    'e$:l+Ol+r   c                     U R                  S5      nUR                  nU R                  UR                  R                  R
                  S5        U R                  UR                  R
                  S5        g)zBlock elements can be nested.z*<blockquote><p><b>Foo</b></p></blockquote>FooN)r    
blockquoter-   r   br{   )r   r    r   s      r    test_nested_block_level_elements9HTMLTreeBuilderSmokeTest.test_nested_block_level_elements  sR    yyEF__
..6,,e4r   c                 N    SnU R                  US5        U R                  S5        g)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>Nr   )r   r   s     r   test_correctly_nested_tables5HTMLTreeBuilderSmokeTest.test_correctly_nested_tables  s6    " 	!	" 	;	<r   c                     SnU R                  U5      nU R                  SS/UR                  S   5        U R                  UR                  UR                  SSS95        g )Nz<div class=" foo bar	 "></a>r   barclassdivzfoo bar)class_)r    r-   r
  r   r   s      r   *test_multivalued_attribute_with_whitespaceCHTMLTreeBuilderSmokeTest.test_multivalued_attribute_with_whitespace   sW     0yy %'):; 	499U99#EFr   c                 ~    SnU R                  U5      nU R                  S/UR                  R                  S   5        g )Nz1<table><div><div class="css"></div></div></table>cssr	  )r    r-   r
  r   s      r   (test_deeply_nested_multivalued_attributeAHTMLTreeBuilderSmokeTest.test_deeply_nested_multivalued_attribute  s7     Eyy %$((,,w"78r   c                 l    SnU R                  U5      nU R                  SS/UR                  S   5        g )Nz<html class="a b"></html>ar  r	  )r    r-   r   r   s      r   "test_multivalued_attribute_on_html;HTMLTreeBuilderSmokeTest.test_multivalued_attribute_on_html  s4     -yy #sTYYw%78r   c                 (    U R                  SS5        g )Nz<a b="<a>"></a>z<a b="&lt;a&gt;"></a>r   r   s    r   3test_angle_brackets_in_attribute_values_are_escapedLHTMLTreeBuilderSmokeTest.test_angle_brackets_in_attribute_values_are_escaped  s    /1HIr   c                 (    U R                  SS5        g )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>r   r   s    r   3test_strings_resembling_character_entity_referencesLHTMLTreeBuilderSmokeTest.test_strings_resembling_character_entity_references  s     	2:	
r   c                 (    U R                  SS5        g )Nz<p>Bob&apos;s Bar</p>z<p>Bob's Bar</p>r   r   s    r   test_apos_entity)HTMLTreeBuilderSmokeTest.test_apos_entity'  s    #	
r   c                 v    SnU R                  U5      nU R                  SUR                  R                  5        g )Nz%<p>&#147;Hello&#148; &#45;&#9731;</p>u   “Hello” -☃r    r-   r   r{   r   s      r   *test_entities_in_foreign_document_encodingCHTMLTreeBuilderSmokeTest.test_entities_in_foreign_document_encoding-  s0     9yy +TVV]];r   c                     SnU R                  SU5        U R                  SU5        U R                  SU5        U R                  SU5        g )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   expects     r   0test_entities_in_attributes_converted_to_unicodeIHTMLTreeBuilderSmokeTest.test_entities_in_attributes_converted_to_unicode9  sK    H8&A8&A8&A:FCr   c                     SnU R                  SU5        U R                  SU5        U R                  SU5        U R                  SU5        g )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$  s     r   *test_entities_in_text_converted_to_unicodeCHTMLTreeBuilderSmokeTest.test_entities_in_text_converted_to_unicode@  sK    B2F;2F;2F;4f=r   c                 (    U R                  SS5        g )Nz#<p>I said &quot;good day!&quot;</p>z<p>I said "good day!"</p>r   r   s    r   ,test_quot_entity_converted_to_quotation_markEHTMLTreeBuilderSmokeTest.test_quot_entity_converted_to_quotation_markG  s    C9	;r   c                 t    SnU R                  SU5        U R                  SU5        U R                  SU5        g )Nu   �z&#10000000000000;z&#x10000000000000;z&#1000000000;r   r$  s     r   test_out_of_range_entity1HTMLTreeBuilderSmokeTest.test_out_of_range_entityK  s9    ,16:2F;ov6r   c                    U R                  S5      nU R                  SUR                  R                  R                  R
                  5        U R                  SUR                  R
                  5        U R                  U5        g)zDMostly to prevent a recurrence of a bug in the html5lib treebuilder.z!<html><h2>
foo</h2><p></p></html>r   N)r    r-   h2r{   r>   r5   r   rC   r}   s     r   test_multipart_strings/HTMLTreeBuilderSmokeTest.test_multipart_stringsQ  s[    yy=>dggnn99>>?dffkk*  &r   c                 L    U R                  SS5        U R                  SS5        g)zaVerify consistent handling of empty-element tags,
no matter how they come in through the markup.
z<br/><br/><br/>z<br /><br /><br />Nr   r   s    r   rw   rx   X  s(     	/1BC24EFr   c                     SnU R                  U5      nU R                  SUR                  R                  5        U R	                  U5        g)8Prevent recurrence of a bug in the html5lib treebuilder.z?<html><head></head>
  <link></link>
  <body>foo</body>
</html>
N)r    assertNotEqualr   bodyrC   r   contentr    s      r   #test_head_tag_between_head_and_body<HTMLTreeBuilderSmokeTest.test_head_tag_between_head_and_body_  s?    
 yy!D$))..1  &r   c                 `    SnU R                  U5      nU R                  UR                  5        g)r7  z<!DOCTYPE html>
<html>
 <body>
   <article id="a" >
   <div><a href="1"></div>
   <footer>
     <a href="2"></a>
   </footer>
  </article>
  </body>
</html>
N)r    rC   articler:  s      r   test_multiple_copies_of_a_tag6HTMLTreeBuilderSmokeTest.test_multiple_copies_of_a_tagj  s+     yy!  .r   c                 :   SnU R                  U5      nU R                  XR                  5       5        UR                  nU R                  SUR                  S   5        U R                  SUR                  S   5        U R                  SUR                  S   5        g)	zvParsers 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/xhtmlxmlns"http://www.w3.org/1998/Math/MathMLzxmlns:mathmlhttp://www.w3.org/2000/svgz	xmlns:svgN)r    r-   r   r   )r   r   r    r   s       r   test_basic_namespaces.HTMLTreeBuilderSmokeTest.test_basic_namespaces{  s    
 nyy /yy779KL0$))N2K	M($))K*@	Br   c                 l    SnU R                  U5      nU R                  SS/UR                  S   5        g )Ns   <a class="foo bar">r   r  r	  )r    r-   r  r   s      r   -test_multivalued_attribute_value_becomes_listFHTMLTreeBuilderSmokeTest.test_multivalued_attribute_value_becomes_list  s1    'yy %9r   c                 v    SnU R                  U5      nU R                  SUR                  R                  5        g )NuD   <html><head><meta encoding="euc-jp"></head><body>Sacré bleu!</body>   Sacré bleu!)r    r-   r9  r{   r   s      r   test_can_parse_unicode_document8HTMLTreeBuilderSmokeTest.test_can_parse_unicode_document  s3     yyy )499+;+;<r   c                 z    [        S5      nU R                  SUS9nU R                  UR                  5       S5        g)z2Parsers should be able to work with SoupStrainers.r  z&A <b>bold</b> <meta/> <i>statement</i>)
parse_onlyz<b>bold</b>N)r   r    r-   r.   )r   strainerr    s      r   test_soupstrainer*HTMLTreeBuilderSmokeTest.test_soupstrainer  s;    $yyA$,  .6r   c                 (    U R                  SS5        g )Nz<foo attr='bar'></foo>z<foo attr="bar"></foo>r   r   s    r   7test_single_quote_attribute_values_become_double_quotesPHTMLTreeBuilderSmokeTest.test_single_quote_attribute_values_become_double_quotes  s    66	8r   c                 *    SnU R                  U5        g )N'<foo attr='bar "brawls" happen'>a</foo>r   )r   r   s     r   7test_attribute_values_with_nested_quotes_are_left_alonePHTMLTreeBuilderSmokeTest.test_attribute_values_with_nested_quotes_are_left_alone  s    <d#r   c                     SnU R                  U5      nSUR                  S'   U R                  UR                  R                  5       S5        g )NrY  zBrawls happen at "Bob's Bar"attrz:<foo attr="Brawls happen at &quot;Bob's Bar&quot;">a</foo>)r    r   r:   r.   )r   r   r    s      r   :test_attribute_values_with_double_nested_quotes_get_quotedSHTMLTreeBuilderSmokeTest.test_attribute_values_with_double_nested_quotes_get_quoted  sB    <yy:HHOOM	Or   c                 L    U R                  SS5        U R                  SS5        g )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   s    r   .test_ampersand_in_attribute_value_gets_escapedGHTMLTreeBuilderSmokeTest.test_ampersand_in_attribute_value_gets_escaped  s.    KO	Q 	<@	Br   c                 &    U R                  S5        g )Nz/<a href="http://example.org?a=1&amp;b=2;3"></a>r   r   s    r   7test_escaped_ampersand_in_attribute_value_is_left_alonePHTMLTreeBuilderSmokeTest.test_escaped_ampersand_in_attribute_value_is_left_alone  s    OPr   c                 .    SnSnU R                  X5        g )N-<p>&lt;&lt;sacr&eacute;&#32;bleu!&gt;&gt;</p>#   <p>&lt;&lt;sacré bleu!&gt;&gt;</p>r   )r   r   expecteds      r   1test_entities_in_strings_converted_during_parsingJHTMLTreeBuilderSmokeTest.test_entities_in_strings_converted_during_parsing  s     ?Yd-r   c                 v    SnU R                  U5      nU R                  UR                  R                  S5        g )Ns   <p>Foo</p>u	   ‘Foo’r   )r   quoter    s      r   )test_smart_quotes_converted_on_the_way_inBHTMLTreeBuilderSmokeTest.test_smart_quotes_converted_on_the_way_in  s4     &yyFFMMN	Pr   c                 r    U R                  S5      nU R                  UR                  R                  S5        g )Nz<a>&nbsp;&nbsp;</a>u     )r    r-   r  r{   r}   s     r   0test_non_breaking_spaces_converted_on_the_way_inIHTMLTreeBuilderSmokeTest.test_non_breaking_spaces_converted_on_the_way_in  s*    yy./(@Ar   c                     SnSR                  S5      nU R                  U5      nU R                  UR                  R                  S5      U5        g )Nrg  rh  r   )r   r    r-   r   )r   r   ri  r    s       r   &test_entities_converted_on_the_way_out?HTMLTreeBuilderSmokeTest.test_entities_converted_on_the_way_out  sB    >Y``ahiyyw/:r   c                     SnUR                  S5      nU R                  U5      nUR                  S5      nUR                  SS5      nUR                  S5      nU R                  XE5        g )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   zISO-Latin-1)r   r    r   r-   )r   unicode_htmliso_latin_htmlr    resultri  s         r   test_real_iso_latin_document5HTMLTreeBuilderSmokeTest.test_real_iso_latin_document  sn    
  &,,\: yy(W%
  ''w? ??7+ 	*r   c                    SnUR                  S5      nU R                  U5      nU R                  UR                  S5      UR                  S5      5        U R                  UR                  S5      UR                  S5      5        g )Nsk   <html><head></head><body><pre>Shift-JISŃR[fBOꂽ{̃t@CłB</pre></body></html>z	shift-jisr   euc_jp)r.   r    r-   r   )r   shift_jis_htmlrw  r    s       r   test_real_shift_jis_document5HTMLTreeBuilderSmokeTest.test_real_shift_jis_document  sv    $ 	 &,,[9yy& 	W-|/B/B7/KLX.0C0CH0MNr   c                     SnU R                  USS9nUR                  S;   d   eU R                  UR                  S5      UR	                  S5      R                  S5      5        g )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)from_encoding)r  z
iso-8859-8r   )r    original_encodingr-   r   r.   )r   hebrew_documentr    s      r   test_real_hebrew_document2HTMLTreeBuilderSmokeTest.test_real_hebrew_document  sm     Eyy;  8 %%)DDDDKK "";/66w?	Ar   c                 
   SnSU-  nU R                  U5      nUR                  SSS05      nUS   nU R                  SU5        U R                  [	        U[
        5      5        U R                  SUR                  S	5      5        g )
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.rm   z
http-equivzContent-typer;  ztext/html; charset=x-sjisztext/html; charset=utf8r   )r    r   r-   r   rM   r   r   )r   meta_tagr~  r    parsed_metar;  s         r   'test_meta_tag_reflects_current_encoding@HTMLTreeBuilderSmokeTest.test_meta_tag_reflects_current_encoding  s    2
7:BC yy( ii~(FGi(4g> 	
7,EFG 	2GNN64JKr   c                    SnSU-  nU R                  U5      nUR                  SSS9nUS   nU R                  SU5        U R                  [	        U[
        5      5        U R                  SUR                  S5      5        g )	Nz'<meta id="encoding" charset="x-sjis" />r  rm   encoding)idcharsetzx-sjisr   )r    r   r-   r   rM   r   r   )r   r  r~  r    r  r  s         r   3test_html5_style_meta_tag_reflects_current_encodingLHTMLTreeBuilderSmokeTest.test_html5_style_meta_tag_reflects_current_encoding/  s     >7:BC yy( ii:i6i(7+ 	
7,EFG 	!78r   c                     S HY  nU R                  U5      n[         H;  nUS;   a  M  UR                  U5      nSU;   d   eUR                  S5      U;  a  M;   e   M[     g )N)sB   <meta charset="utf8"></head><meta id="encoding" charset="utf-8" />idnambcsoem	undefinedstring_escapezstring-escapes   meta charset=""asciir    r
   r   r   r   r    r  encodeds        r   2test_python_specific_encodings_not_used_in_charsetKHTMLTreeBuilderSmokeTest.test_python_specific_encodings_not_used_in_charsetG  sm    

F 99V$D5    ++h/)W444w/w>>> 6
r   c                     U R                  S5      nSUR                  S'   U R                  SUR                  R                  5       5        g )Nz<a>text</a>r  r   z<a foo="bar">text</a>)r    r  r-   r.   )r   datas     r   5test_tag_with_no_attributes_can_have_attributes_addedNHTMLTreeBuilderSmokeTest.test_tag_with_no_attributes_can_have_attributes_added^  s8    yy'u0$&&--/Br   c                 z    U R                  S5      nU R                  SUR                  R                  5       5        g )Nz0<body><div><p>text1</p></span>text2</div></body>z)<body><div><p>text1</p>text2</div></body>)r    r-   r9  r.   r}   s     r   $test_closing_tag_with_no_opening_tag=HTMLTreeBuilderSmokeTest.test_closing_tag_with_no_opening_tagc  s3    
 yyKL79I9I9K	
r   c                 P    U R                  [        5      nU R                  U5        gz3Test the worst case (currently) for linking issues.Nr    BAD_DOCUMENTrN   r}   s     r   test_worst_case(HTMLTreeBuilderSmokeTest.test_worst_casem        yy&t$r   r#   N)DOCTYPE)DrX   rY   rZ   r[   __doc__rw   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/  r3  r<  r@  rG  rJ  rN  rS  rV  rZ  r^  ra  rd  rj  rn  rq  rt  rz  r  r  r  r  r  r  r  r  r]   r#   r   r   r_   r_      sV   
=9 94",D.
8*+JII(;6,1/04I"8L$	,5<(
G99J


<D>;7'G	'/"B:=78$OBQ.PB;+6O"AL890?.C

%r   r_   c                       \ rS rSrS rS rS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rS rS rS rS rS rS rSrg)XMLTreeBuilderSmokeTestit  c                    U R                  S5      n[        R                  " US5      n[        R                  " U5      nU R	                  UR
                  [        5        U R	                  UR                  5       UR                  5       5        g r   r   r   s       r   r   9XMLTreeBuilderSmokeTest.test_pickle_and_unpickle_identityv  r   r   c                 f    U R                  S5      nU R                  UR                  5       S5        g )N<root/>s.   <?xml version="1.0" encoding="utf-8"?>
<root/>r    r-   r   r}   s     r   test_docstring_generated0XMLTreeBuilderSmokeTest.test_docstring_generated  s+    yy#KKMM	Or   c                 j    SnU R                  U5      nU R                  XR                  S5      5        g )Ns,   <?xml version="1.0" encoding="utf8"?>
<foo/>r   r  r   s      r   test_xml_declaration,XMLTreeBuilderSmokeTest.test_xml_declaration  s,    Eyy V!45r   c                     SnU R                  U5      n[         H;  nUS;   a  M  UR                  U5      nSU;   d   eUR                  S5      U;  a  M;   e   g )Ns   <?xml version="1.0"?>
<foo/>r  s   <?xml version="1.0"?>r  r  r  s        r   :test_python_specific_encodings_not_used_in_xml_declarationRXMLTreeBuilderSmokeTest.test_python_specific_encodings_not_used_in_xml_declaration  sf     6yy 1H   kk(+G+w666??7+7::: 2r   c                 j    SnU R                  U5      nU R                  XR                  S5      5        g )Ns<   <?xml version="1.0" encoding="utf8"?>
<?PITarget PIContent?>r   r  r   s      r   r   3XMLTreeBuilderSmokeTest.test_processing_instruction  s,    Uyy V!45r   c                 l    SnU R                  U5      nU R                  UR                  S5      U5        g)zGA real XHTML document should come out *exactly* the same as it went in.r   r   Nr  r   s      r   r   0XMLTreeBuilderSmokeTest.test_real_xhtml_document  s5     yy KK &	*r   c                 h    SnU R                  U5      nU R                  XR                  5       5        g )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   docr    s      r   test_nested_namespaces.XMLTreeBuilderSmokeTest.test_nested_namespaces  s,     yy~kkm,r   c                     Sn[        US5      nSUR                  l        UR                  5       nU R	                  SU;   5        g )Nz/
  <script type="text/javascript">
  </script>
zlxml-xmlzconsole.log("< < hey > > ");s   &lt; &lt; hey &gt; &gt;)r   r|   r{   r   r   )r   r  r    r  s       r   5test_formatter_processes_script_tag_for_xml_documentsMXMLTreeBuilderSmokeTest.test_formatter_processes_script_tag_for_xml_documents  sB     S*- <++-2g=>r   c                 v    SnU R                  U5      nU R                  SUR                  R                  5        g )Nu?   <?xml version="1.0" encoding="euc-jp"><root>Sacré bleu!</root>rM  )r    r-   rootr{   r   s      r   rN  7XMLTreeBuilderSmokeTest.test_can_parse_unicode_document  s0    syy )499+;+;<r   c                 t    SnU R                  U5      nU R                  [        UR                  5      U5        g )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>)r    r-   r   rssr   s      r   test_popping_namespaced_tag3XMLTreeBuilderSmokeTest.test_popping_namespaced_tag  s3     Wyy M6	#r   c                 h    U R                  S5      nU R                  UR                  S5      S5        g )Nr  latin1s/   <?xml version="1.0" encoding="latin1"?>
<root/>r  r}   s     r   (test_docstring_includes_correct_encoding@XMLTreeBuilderSmokeTest.test_docstring_includes_correct_encoding  s.    yy#KK!?	Ar   c                 l    SnU R                  U5      nU R                  UR                  S5      U5        g)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   s      r   test_large_xml_document/XMLTreeBuilderSmokeTest.test_large_xml_document  s2     yy W-v6r   c                 J    U R                  SS5        U R                  S5        g )Nr   r   z
<p>foo</p>r   r   s    r   9test_tags_are_empty_element_if_and_only_if_they_are_emptyQXMLTreeBuilderSmokeTest.test_tags_are_empty_element_if_and_only_if_they_are_empty  s     eV,l+r   c                     SnU R                  U5      nUR                  nU R                  SUS   5        U R                  SUS   5        g )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>zhttp://example.com/zxmlns:azhttp://example.net/zxmlns:b)r    r  r-   )r   r   r    r  s       r   test_namespaces_are_preserved5XMLTreeBuilderSmokeTest.test_namespaces_are_preserved  sK     wyy yy.Y@.Y@r   c                 t    SnU R                  U5      nU R                  [        UR                  5      U5        g )NzN<p xmlns:dc="http://purl.org/dc/elements/1.1/"><dc:date>20010504</dc:date></p>)r    r-   r   r   r   s      r   test_closing_namespaced_tag3XMLTreeBuilderSmokeTest.test_closing_namespaced_tag  s-    ayy TVVf-r   c                 t    SnU R                  U5      nU R                  [        UR                  5      U5        g )Nzs<foo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><bar xsi:schemaLocation="http://www.example.com"/></foo>r    r-   r   r   r   s      r   test_namespaced_attributes2XMLTreeBuilderSmokeTest.test_namespaced_attributes  s0     Gyy TXX/r   c                 t    SnU R                  U5      nU R                  [        UR                  5      U5        g )Nz<foo xml:lang="fr">bar</foo>r  r   s      r   (test_namespaced_attributes_xml_namespace@XMLTreeBuilderSmokeTest.test_namespaced_attributes_xml_namespace  s-    /yy TXX/r   c           
         SnU R                  U5      nU R                  S[        UR                  S5      5      5        U R                  S[        UR                  S5      5      5        U R                  S[        UR                  S5      5      5        U R                  S[        UR                  SSS	95      5        U R                  S[        UR                  SS/5      5      5        g )
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   zns1:tagrF   zns2:tagvalue)keyr   r  s      r   test_find_by_prefixed_name2XMLTreeBuilderSmokeTest.test_find_by_prefixed_name  s     yy~ 	Ce 456 	Ci 89:Ci 89:CiW EFGCy).D EFGr   c                     SnU R                  U5      nUR                  n[        R                  " U5      nU R                  UR                  UR                  5        g )Nzf<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document xmlns:w="http://example.com/ns0"/>)r    documentr   r-   prefix)r   xmlr    r  	duplicates        r   !test_copy_tag_preserves_namespace9XMLTreeBuilderSmokeTest.test_copy_tag_preserves_namespace  sJ    2 yy~mmIIcN	 	Y%5%56r   c                 P    U R                  [        5      nU R                  U5        gr  r  r}   s     r   r  'XMLTreeBuilderSmokeTest.test_worst_case  r  r   r#   N)rX   rY   rZ   r[   r   r  r  r  r   r   r  r  rN  r  r  r  r  r  r  r  r  r  r  r  r]   r#   r   r   r  r  t  sj    9O
6
;&6

*	-
?=
#A7,A.
0
0
H,	7%r   r  c                   6    \ rS rSrSrS rS rS rS rS r	Sr
g	)
HTML5TreeBuilderSmokeTesti   z2Smoke test for a tree builder that supports HTML5.c                     g r   r#   r   s    r   r   2HTML5TreeBuilderSmokeTest.test_real_xhtml_document#  s     	r   c                 v    SnU R                  U5      nU R                  SUR                  R                  5        g )Nz<a>rC  )r    r-   r  	namespacer   s      r   test_html_tags_have_namespace7HTML5TreeBuilderSmokeTest.test_html_tags_have_namespace(  s0    yy 79I9IJr   c                     SnU R                  U5      nSnU R                  X2R                  R                  5        U R                  X2R                  R                  5        g )Nz<svg><circle/></svg>rF  )r    r-   svgr  circler   r   r    r  s       r   test_svg_tags_have_namespace6HTML5TreeBuilderSmokeTest.test_svg_tags_have_namespace-  sJ    'yy 0	HH$6$67KK$9$9:r   c                     SnU R                  U5      nSnU R                  X2R                  R                  5        U R                  X2R                  R                  5        g )Nz<math><msqrt>5</msqrt></math>rE  )r    r-   mathr  msqrtr  s       r   test_mathml_tags_have_namespace9HTML5TreeBuilderSmokeTest.test_mathml_tags_have_namespace5  sJ    0yy 8	II$7$78JJ$8$89r   c                 &   SnU R                  U5      nU R                  [        UR                  S   [        5      5        U R                  UR                  S   S5        U R                  SUR                  S   R                  R                  5        g )Nz3<?xml version="1.0" encoding="utf-8"?><html></html>r   z$?xml version="1.0" encoding="utf-8"?r   )r    r   rM   rL   r   r-   r>   r5   r   s      r   $test_xml_declaration_becomes_comment>HTML5TreeBuilderSmokeTest.test_xml_declaration_becomes_comment<  sp    Fyy 
4==#3W=>q)+QRq!1!>!>!C!CDr   r#   N)rX   rY   rZ   r[   r  r   r   r  r  r  r]   r#   r   r   r  r     s     <
K
;:Er   r  c                    ^ ^ S mU U4S jnU$ )Nc                     g r   r#   )testargsr   s      r   nothingskipIf.<locals>.nothingD  s    r   c                    > T(       a  T$ U $ r   r#   )	test_item	conditionr  s    r   	decoratorskipIf.<locals>.decoratorG  s    
>r   r#   )r  reasonr  r  s   `  @r   skipIfr  C  s     r   )r  __license__r   r   	functoolsunittestr   bs4r   bs4.elementr   r   r   r	   r
   r   r   r   r   bs4.builderr   r   r  r   objectr_   r  r  r  r#   r   r   <module>r$     s           
 
 
 .'"Jcx   cLJ
%v J
%Zi%f i%X!E 8 !EF
r   