+
    Bi                     j   ^ RI t^ RIt^ RIt^ RIHt ^ RIHt  ! R R]P                  P                  4      t
 ! R R]
4      t ! R R	]
4      t ! R
 R]
4      t ! R R]P                  4      t ! R R]4      t ! R R]4      t ! R R]P                  4      t]R8X  d   ]P(                  ! 4        R# R# )    N)patch)supportc                   p   a  ] tR t^t o RR/R ltR tR tR tR tR t	R	 t
R
 tR tR tR tR tRtV tR# )EventCollector	autocdataFc                   Wn         . V n        V P                  P                  V n        \        P                  P
                  P                  ! V .VO5/ VB  V'       d   V P                  R 4       R# R# )FN)r   eventsappendhtmlparser
HTMLParser__init___set_support_cdata)selfr   argskws   &$*,+/usr/lib/python3.14/test/test_htmlparser.pyr   EventCollector.__init__   sW    "kk(('':t:r:##E*     c                    . pR pV P                    FT  pV^ ,          pYBu;8X  d   R8X  d(   M M$RVR,          ^,          V^,          ,           3VR&   MVP                  V4       TpKV  	  Wn         V# )Ndata)r	   r
   )r   Lprevtypeeventtypes   &    r   
get_eventsEventCollector.get_events   sk     [[E8D)6)2qE!H!45"H ! r   c                    V P                  R W34       V P                  '       d   VR8X  d   V P                  R4       R# R# R# )starttagsvgTNr
   r   r   r   tagattrss   &&&r   handle_starttagEventCollector.handle_starttag&   s7    Z,->>>cUl##D) +>r   c                ,    V P                  R W34       R# )startendtagNr
   r#   s   &&&r   handle_startendtag!EventCollector.handle_startendtag+   s    ]C/0r   c                    V P                  R V34       V P                  '       d   VR8X  d   V P                  R4       R# R# R# )endtagr!   FNr"   )r   r$   s   &&r   handle_endtagEventCollector.handle_endtag.   s6    XsO$>>>cUl##E* +>r   c                ,    V P                  R V34       R# )commentNr*   r   r   s   &&r   handle_commentEventCollector.handle_comment5       Y%&r   c                ,    V P                  R V34       R# )charrefNr*   r3   s   &&r   handle_charrefEventCollector.handle_charref8   r6   r   c                ,    V P                  R V34       R# )r   Nr*   r3   s   &&r   handle_dataEventCollector.handle_data;       VTN#r   c                ,    V P                  R V34       R# )declNr*   r3   s   &&r   handle_declEventCollector.handle_decl>   r>   r   c                ,    V P                  R V34       R# )	entityrefNr*   r3   s   &&r   handle_entityrefEventCollector.handle_entityrefA   s    [$'(r   c                ,    V P                  R V34       R# )piNr*   r3   s   &&r   	handle_piEventCollector.handle_piD   s    T4L!r   c                ,    V P                  R V34       R# )unknown declNr*   )r   r@   s   &&r   unknown_declEventCollector.unknown_declG   s    ^T*+r   )r
   r   r	   N)__name__
__module____qualname____firstlineno__r   r   r&   r+   r/   r4   r9   r<   rA   rE   rI   rM   __static_attributes____classdictcell____classdict__s   @r   r   r      sM     + +"*
1+''$$)", ,r   r   c                   &   a  ] tR t^Kt o R tRtV tR# )EventCollectorExtrac                t    \         P                  WV4       V P                  R V P                  4       34       R# )starttag_textN)r   r&   r
   get_starttag_textr#   s   &&&r   r&   #EventCollectorExtra.handle_starttagM   s,    &&t%8_d&<&<&>?@r    N)rO   rP   rQ   rR   r&   rS   rT   rU   s   @r   rX   rX   K   s     A Ar   rX   c                   ,   a  ] tR t^Rt o R tR tRtV tR# )EventCollectorCharrefsc                (    V P                  R 4       R# z6This should never be called with convert_charrefs=TrueNfailr3   s   &&r   r9   %EventCollectorCharrefs.handle_charrefT       		JKr   c                (    V P                  R 4       R# ra   rb   r3   s   &&r   rE   'EventCollectorCharrefs.handle_entityrefW   re   r   r]   N)rO   rP   rQ   rR   r9   rE   rS   rT   rU   s   @r   r_   r_   R   s     LL Lr   r_   c                   &   a  ] tR t^]t o R tRtV tR# )EventCollectorNoNormalizec                    V P                   # N)r	   r   s   &r   r   $EventCollectorNoNormalize.get_events^   s    {{r   r]   N)rO   rP   rQ   rR   r   rS   rT   rU   s   @r   ri   ri   ]   s      r   ri   c                   6   a  ] tR t^bt o R tRR ltR tRtV tR# )TestCaseBasec                    \        R R7      # )Fconvert_charrefs)r   rl   s   &r   get_collectorTestCaseBase.get_collectord   s    u55r   Nc                   Vf   V P                  4       pTpV F  pVP                  V4       K  	  VP                  4        VP                  4       pWb8w  dh   V P	                  R\        V4      ,           R,           \        P                  ! V4      ,           R,           \        P                  ! V4      ,           4       R # R # )Nz
Expected:
z
Received:
z6received events did not match expected events
Source:
)rs   feedcloser   rc   reprpprintpformat)r   sourceexpected_events	collectorr   sr	   s   &&&&   r   
_run_checkTestCaseBase._run_checkg   s    **,IAKKN ""$$II $&*6l3%&(.(GH && )/v(>? @ %r   c                >    V P                  W\        R R7      4       R# )Frq   N)r   rX   )r   r{   r	   s   &&&r   _run_check_extraTestCaseBase._run_check_extrau   s    +UC	Er   r]   rk   )	rO   rP   rQ   rR   rs   r   r   rS   rT   rU   s   @r   ro   ro   b   s     6@E Er   ro   c                     a  ] tR t^zt o R tR tR tR tR tR t	R t
R tR	 tR
 tR tR t]P"                  ! R. R4O4      R 4       t]P"                  ! R. R5O4      R 4       t]P"                  ! R. R6O4      R 4       t]P"                  ! R. R7O4      R 4       t]P"                  ! R. R8O4      R 4       t]P"                  ! R. R9O4      R 4       t]P"                  ! R. R:O4      R 4       t]P"                  ! R. R;O4      R 4       t]P"                  ! R. R<O4      R 4       t]P"                  ! R. R=O4      R 4       tR tR tR tR tR t R t!R  t"R! t#R" t$R# t%R$ t&R% t'R& t(R' t)R( t*R) t+]P"                  ! R. R>O4      R* 4       t,R+ t-R, t.]P"                  ! R. R?O4      R- 4       t/R. t0R/ t1]Pd                  ! R04      R1 4       t3R2t4V t5R3# )@HTMLParserTestCasec                R    V P                  R R.4       V P                  RR.4       R# )z<?processing instruction>z<?processing instruction ?>N)rH   zprocessing instruction)rH   zprocessing instruction ?r   rl   s   &r    test_processing_instruction_only3HTMLParserTestCase.test_processing_instruction_only|   s2    3,6 	 	5.8 	r   c                \    V P                  R RRRRR. 3RRRR	RRRR
R.3RRRRRRR.4       R# )z
<!DOCTYPE html PUBLIC 'foo'>
<HTML>&entity;&#32;
<!--comment1a
-></foo><bar>&lt;<?pi?></foo<bar
comment1b-->
<Img sRc='Bar' isMAP>sample
text
&#x201C;
<!--comment2a-- --comment2b-->
</Html>
r    r   imgNr   
)r@   zDOCTYPE html PUBLIC 'foo')rD   entity)r8   32)r2   z4comment1a
-></foo><bar>&lt;<?pi?></foo<bar
comment1b)srcBar)ismapN)r   zsample
text
)r8   x201C)r2   zcomment2a-- --comment2br.   r   r   rl   s   &r   test_simple_html#HTMLParserTestCase.test_simple_html   s`      )I9:*#	r   c                h    V P                  R RR. 3RR.4       V P                  R.RR. 3RR.4       R# )	z<p>&#bad;</p>r    pz<div>&#bad;</div>divN)r   z&#bad;r.   r   r.   r   r   rl   s   &r   test_malformatted_charref,HTMLParserTestCase.test_malformatted_charref   sN    b!*
 	 	,-#0
 	r   c                .    V P                  R RR.4       R# )z&entityref fooN)rD   rD   )r   z foor   rl   s   &r   test_unclosed_entityref*HTMLParserTestCase.test_unclosed_entityref   s    (&+ 	r   c                >    V P                  R RR. 3RR. 3RR.4       R# )z<a><b></a></b>r    abNr.   r   r.   r   r   rl   s   &r   test_bad_nesting#HTMLParserTestCase.test_bad_nesting   s2     	(b!b!	+ 	r   c                ,    V P                  R R.4       R# )#this text & contains & ampersands &N)r   r   r   rl   s   &r   test_bare_ampersands'HTMLParserTestCase.test_bare_ampersands   s    =;@ 	r   c                ,    V P                  R R.4       R# ).this < text > contains < bare>pointy< bracketsN)r   r   r   rl   s   &r   test_bare_pointy_brackets,HTMLParserTestCase.test_bare_pointy_brackets   s    HFK 	r   c                b    V P                  R RRR.3.4       V P                  RRRR.3.4       R# )	<a b='<'>r    r   	<a b='>'>Nr   <r   >r   rl   s   &r   test_starttag_end_boundary-HTMLParserTestCase.test_starttag_end_boundary   s6    :sZL*I)JK:sZL*I)JKr   c                   R RR'.3.pV P                  R.V4       V P                  RR.V4       V P                  RR.V4       V P                  RR	.V4       V P                  R
R.V4       V P                  RR.V4       R RR(.3.pV P                  R.V4       V P                  RR.V4       V P                  RR.V4       V P                  RR.V4       V P                  RR.V4       V P                  RR.V4       R).pV P                  RR.V4       V P                  RR.V4       V P                  RR.V4       V P                  RR.V4       V P                  RR.V4       V P                  RR.V4       V P                  RR .V4       V P                  R!R".V4       V P                  R#R$.V4       V P                  R%R.V4       V P                  RR.V4       R&# )*r    r   r   r   <a zb='<'>z<a bz='<'>z<a b=z'<'>z<a b='<z'>z<a b='<'r   r   zb='>'>z='>'>z'>'>z<a b='>z<a b='>' z
<!--abc-->z	!--abc--><!z--abc--><!-z-abc--><!--zabc-->z<!--azbc-->z<!--abzc-->z<!--abcz-->z<!--abc-z->z	<!--abc--Nr   r   )r2   abcr   r   outputs   & r   test_buffer_artefacts(HTMLParserTestCase.test_buffer_artefacts   s   sZL12v.)62)62&)62D)62S)62sZL12v.)62)62&)62D)62S)62$%\*F3k*F3z*F3	*F3*F3'*F36*F3E*F3T*F3c*F3r*F3r   c                f    . ROpV F&  pV P                  RV,          RRV,           3.4       K(  	  R# )HTMLz<!DOCTYPE %s>r@   DOCTYPE N)
r   zOHTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"z[HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"zbhtml PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"zfhtml PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"zYmath PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd"zhtml PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"zWsvg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"z'html PUBLIC "-//IETF//DTD HTML 2.0//EN"z,html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"r   )r   dtdsdtds   &  r   test_valid_doctypes&HTMLParserTestCase.test_valid_doctypes   s9    @$ COOOc1$j3&678: r   c                    V P                  R RR. 3.4       V P                  RRR. 3R.4       V P                  RRR. 3RRR	.3R.4       R# )
z<p/>r)   r   z<p></p>r    z<p><img src='foo' /></p>r   Nr   )r   foor   rl   s   &r   test_startendtag#HTMLParserTestCase.test_startendtag  sq    C$! 	 		b!$ 	 	2b!EN#345 	r   c                @    R pV P                  VRRRR.3RV3.4       R# )z <foo:bar   
   one="1"	two=2   >r    zfoo:barrZ   N)one1)two2)r   )r   r~   s   & r   test_get_starttag_text)HTMLParserTestCase.test_get_starttag_text  s3    4a\<$@Aa "" 	#r   contentc                F    R V R2pV P                  VRR. 3RV3R.4       R# )z<script>z	</script>r    scriptr   Nr.   r   r   r   r   r~   s   && r   test_script_content&HTMLParserTestCase.test_script_content  s9    , wiy)Z26#W-02 	3r   c                F    R V R2pV P                  VRR. 3RV3R.4       R# )z<style>z</style>r    styler   Nr.   r   r   r   s   && r   test_style_content%HTMLParserTestCase.test_style_content5  s9     gYh'Z"5#W-/1 	2r   c                F    R V R2pV P                  VRR. 3RV3R.4       R# )z<title>z</title>r    titler   Nr.   r   r   r   r   r{   s   && r   test_title_content%HTMLParserTestCase.test_title_contentG  s:     7)8,"%W!
 	r   c                F    R V R2pV P                  VRR. 3RV3R.4       R# )z
<textarea>z</textarea>r    textarear   Nr.   r   r   r   s   && r   test_textarea_content(HTMLParserTestCase.test_textarea_content]  s:     gYk2R(W"!
 	r   r.   c                h    R pRV RV R2pV P                  VRR. 3RV3R.\        RR7      R	7       R
# )z<!-- not a comment --> &not-an-entity-ref;
                  <a href="" /> </p><p> <span></span></style>
                  '</script' + '>'<ScrIPt></r   r    r   r   Frq   r}   Nr   r   ri   r   r.   r   r~   s   &&  r   test_script_closing_tag*HTMLParserTestCase.test_script_closing_tagr  sV    
& wir&+Z26#W-02 #<U"S 	 	Ur   c                h    R pRV RV R2pV P                  VRR. 3RV3R.\        RR7      R	7       R
# )z
            b::before { content: "<!-- not a comment -->"; }
            p::before { content: "&not-an-entity-ref;"; }
            a::before { content: "<i>"; }
            a::after { content: "</i>"; }
            z<StyLE>r   r   r    r   r   Frq   r   Nr   r   r   s   &&  r   test_style_closing_tag)HTMLParserTestCase.test_style_closing_tag  sV     gYb*Z"5#W-/1 #<U"S 	 	Ur   c                    R pRV RV R2pV P                  VRR. 3RR.\        RR7      R7       V P                  VRR. 3RRRR.\        R	R7      R7       R
# )+<!-- not a comment --><i>Egg &amp; Spam</i>z<TitLe>r   r   r    r   Trq   r   FNr   z'<!-- not a comment --><i>Egg & Spam</i>r   r   z<!-- not a comment --><i>Egg rD   ampr   z	 Spam</i>r   r   s   &&  r   test_title_closing_tag)HTMLParserTestCase.test_title_closing_tag  s     @gYb*Z"5O/1 #<T"R 	 	T 	Z"5E01/	1
 #<U"S 	 	Ur   c                    R pRV RV R2pV P                  VRR. 3RR.\        RR7      R7       V P                  VRR. 3RRRR.\        R	R7      R7       R
# )r   z
<TexTarEa>r   r   r    r   Trq   r   FNr   r   r   r   r   r   r   s   &&  r   test_textarea_closing_tag,HTMLParserTestCase.test_textarea_closing_tag  s     @	F81-ZR8O24 #<T"R 	 	T 	ZR8E012	4
 #<U"S 	 	Ur   ztail,endc                    R pRV V 2pT P                  TRR. 3RV'       d   TMW1,           3.\        RR7      R7       R# )	za = 123r   r    r   r   Frq   r   Nr   )r   tailendr   r~   s   &&&  r   test_eof_in_script%HTMLParserTestCase.test_eof_in_script  sR     wiv&Z26#WHJ";U"S 	 	Ur   c           	         R V 2pT P                  TRR. 3RRV'       d   RMT,           3.\        RR7      R7       T P                  TRR. 3RRRR	V'       d   RMT,           3.\        R
R7      R7       R# )z<TitLe>Egg &amp; Spamr    r   r   z
Egg & Spamr   Trq   r   z SpamFN)r   zEgg r   r   )r   r  r  r~   s   &&& r   test_eof_in_title$HTMLParserTestCase.test_eof_in_title  s     $D6*Z"5#\3RD%IJL";T"R 	 	T 	Z"5,0#Wct%DEG #<U"S	 	 	Ur   c                4    R p. ROpV P                  W4       R# )a.  <!-- I'm a valid comment --><!--me too!--><!------><!-----><!----><!---><!--><!----I have many hyphens----><!-- I have a > in the middle --><!-- and I have -- in the middle! --><!--incorrectly-closed-comment--!><!----!><!----!--><!---- >--><!---!>--><!--!>--><!-- <!-- nested --> --><!--<!--><!--<!--!>N))r2   z I'm a valid comment )r2   zme too!r2   z--r2   -r2   r   r  r  )r2   z--I have many hyphens--)r2   z I have a > in the middle )r2   z and I have -- in the middle! )r2   zincorrectly-closed-commentr  )r2   z--!)r2   z-- >r2   z-!>)r2   z!>)r2   z <!-- nested )r   z -->r2   r   r  r   r   r   expecteds   &  r   test_comments HTMLParserTestCase.test_comments  s    ,
( 	'r   c                4    R p. ROpV P                  W4       R# )zs<!--[if IE & !(lte IE 8)]>aren't<![endif]--><!--[if IE 8]>condcoms<![endif]--><!--[if lte IE 7]>pretty?<![endif]-->N))r2   z%[if IE & !(lte IE 8)]>aren't<![endif])r2   z[if IE 8]>condcoms<![endif])r2   z[if lte IE 7]>pretty?<![endif]r   r  s   &  r   test_condcoms HTMLParserTestCase.test_condcoms  s    8C 	'r   c           
        R  pV P                  V! 4       P                  4       . ROpRR. 3RR.pV F*  pV P                  RP                  V4      W1! 4       R7       K,  	  RRR. 3RRR.pV F*  pV P                  RP                  V4      W1! 4       R7       K,  	  V FX  pRP	                  V.^,          4      pRRR. 3RV3RRRR	. 3RV3RR.	pV P                  R
P                  WT4      W1! 4       R7       KZ  	  Rp\        ^\        V4      4       F%  pV P                  VRV RVRV 3.V! 4       R7       K'  	  V P                  RR.V! 4       R7       R# )c                      \        4       # rk   r_   r]   r   r   <lambda>:HTMLParserTestCase.test_convert_charrefs.<locals>.<lambda>      24r   r    r   r   z<a>a{0}z</a>r   z{0}<a>{0}</a>{0}Xr   r   z/{1}<script>{0}</script>{1}<style>{0}</style>{1}z&quo &# &#xNno charrefs here)z&quot;z&#34;z&#x22;z&quotz&#34z&#x22)r   za"zr   )r   "r   r   )r   r!  )
assertTruerr   r   formatjoinrangelen)r   r}   charrefsr  r8   textr   xs   &       r   test_convert_charrefs(HTMLParserTestCase.test_convert_charrefs  s   4		445Jb)?OLGOON11':$	  =   "JR#8!?MCGOO ))/$	  =  
  G88WIaK(D%#Xr2VTN,m#Wb1FD>+]	<H
 OO 44:F44I$	  =   q#d)$AOOD!HRa'9&:&/k  3 % 	*-I,J"++ 	 	/r   c                *   R  pV P                  V! 4       P                  4       . ROpRR. RO3R	.pV F*  pV P                  RP                  V4      W1! 4       R7       K,  	  RpRR. R
O3R	.pV P                  RP                  V4      W1! 4       R7       R# )c                      \        4       # rk   r  r]   r   r   r  NHTMLParserTestCase.test_convert_charrefs_in_attribute_values.<locals>.<lambda>2  r  r   r    r   zB<a x="{0}" x="z{0}" x="{0}z"    x="z{0}z" x="{0} z" x="{0}=z"></a>r   z&centN)z&cent;z&#xa2;z&#xa2z&#162;z&#162)r*     ¢r*  u   z¢)r*  u   ¢z)r*  u   z¢zr*  u   ¢ z)r*  u   ¢=zr   )r0  r2  )r*  z&centz)r*  zz&centzr3  )r*  z&cent=z)r#  rr   r   r$  )r   r}   r(  r  r8   s   &    r   )test_convert_charrefs_in_attribute_values<HTMLParserTestCase.test_convert_charrefs_in_attribute_values0  s    4		445
 DCD $%  GOO D#VG_h)+  O   IJ $% 	 @(ik 	 	Kr   c           
     H    V P                  R RRR.3RRRRRR	.3R
R.4       R# )zF<html <html>te>>xt&a<<bc</a></html>
<img src="URL><//img></html</html>r    r   Nzbc<)z<htmlN)r   zte>>xt)rD   r   r   r   )r   Nr   r   r   rl   s   &r   test_tolerant_parsing(HTMLParserTestCase.test_tolerant_parsingO  s@     ='/1BC..)'>.*?,	-r   c                   V P                  R R.4       V P                  RR .4       V P                  RR!.4       V P                  RR".4       V P                  R. 4       V P                  RR#.4       V P                  RR$.4       V P                  RR%.4       V P                  R. 4       V P                  R	R&.4       V P                  R
R&.4       V P                  RRR. 3.4       V P                  RR'.4       V P                  RR(.4       V P                  R. 4       V P                  R. 4       V P                  R. 4       V P                  R. 4       V P                  R. 4       V P                  RRR. 3.4       V P                  RRR. 3.4       V P                  RRR. 3.4       V P                  RRR. 3.4       V P                  RRR. 3.4       V P                  RR).4       R# )*r   <>< >< z</><$>z</$>r   z</az</ a>z</ az<a<a>r    a<az</a<a>r   z<az<a foo='bar'z<a foo='barz
<a foo='>'z	<a foo='>z<a$>za$z<a$b>a$bz<a$b/>r)   z<a$b  >z<a$b  />z</a$b>Nr7  )r   r;  )r   r<  )r   r=  )r   r>  )r2   $)r   r   )r2   z a)r.   r?  r  )r.   r@  r   rl   s   &r   test_starttag_junk_chars+HTMLParserTestCase.test_starttag_junk_charsZ  s   m_-~./01~./r"01!1 23~./r""3!45!2 34:ub"9!:;#4"56/0b!+r*b)R(*dB!7 89:ub"9!:;M5"#=">?	Z$;#<=
mUB%?$@A#4"56r   c           
        V P                  R RRR
.3.4       RpRR. RO3.pV P                  W4       RpRR. RO3RR. RO3.pV P                  W4       RpRR	. 3RR	. 3RR	. 3RR	. 3RR	. 3RR	. 3RR	. 3RR	. 3.pV P                  W4       R# )z<a foo="var"/>r)   r   zj<img width=902 height=250px src="/sites/default/files/images/homepage/foo.jpg" /*what am I doing here*/ />r   Nz9<a / /foo/ / /=/ / /bar/ / /><a / /foo/ / /=/ / /bar/ / >r    zD<meta><meta / ><meta // ><meta / / ><meta/><meta /><meta //><meta//>meta)r   var))width902)height250px)r   z,/sites/default/files/images/homepage/foo.jpg)z*whatN)amN)iN)doingN)zhere*N))r   N)=N)barNr   r  s   &  r   test_slashes_in_starttag+HTMLParserTestCase.test_slashes_in_starttagu  s    (M3@P+Q*RS. 5/
  	'/ C!LMIJ
 	'3 $z62&>$z62&>FB'-)DFB'-)D	
 	'r   c                R    V P                  R R.4       V P                  RR.4       R# )z</a/>z</a foo="var"/>Nr   r   rl   s   &r   test_slashes_in_endtag)HTMLParserTestCase.test_slashes_in_endtag  s%    /!23)O+<=r   c                ,    V P                  R R.4       R# )z<!DOCTYPE foo $ >N)r@   zDOCTYPE foo $ r   rl   s   &r   test_declaration_junk_chars.HTMLParserTestCase.test_declaration_junk_chars  s    +.H-IJr   c                ,    V P                  R R.4       R# )z"<!spacer type="block" height="25">N)r2   zspacer type="block" height="25"r   rl   s   &r   test_illegal_declarations,HTMLParserTestCase.test_illegal_declarations  s    <GH	Jr   c                r    R pRR. 3RRR. 3RRR. 3RRR. 3RRR. 3RRR. 3RR. 3.pV P                  W4       R# )zn<br></label</p><br></div end tmAd-leaderBoard><br></<h4><br></li class="unit"><br></li
						</ul><br></><br>r    brN)r.   zlabel<r   )r2   z<h4)r.   lir   r  s   &  r   test_invalid_end_tags(HTMLParserTestCase.test_invalid_end_tags  st    Mr*(r*%r*&r*$r*$r*r*#,$ 	'r   c                >    R pRR. 3RRR.pV P                  W4       R# )z(<b>This</b attr=">"> confuses the parserr    r   N)r   Thisr   )r   z confuses the parserr   r  s   &  r   test_broken_invalid_end_tag.HTMLParserTestCase.test_broken_invalid_end_tag  s/    9b)$#46 	'r   c                    R pRRR
.3RR. 3RRRR.3RRRRR. 3RRR. 3RRRR.pV P                  W4       RpRR. RO3RR. 3RRRR.3RR.pV P                  W4       R	# )z[<div style=""    ><b>The <a href="some_url">rain</a> <br /> in <span>Spain</span></b></div>r    r   r   r   r)   r\  spanz><div style="", foo = "bar" ><b>The <a href="some_url">rain</a>Nr   r   )r   zThe )hrefsome_url)r   rainr   r    )r   z in )r   Spainr.   re  r   r   )rf  ,Nr   rO  r   r  s   &  r   $test_correct_detection_of_start_tags7HTMLParserTestCase.test_correct_detection_of_start_tags  s    9 0b!345D"%$
  	'O LMb!345
 	'r   c                f    R R.3RR.3R. R	O3RRR.3.pV F  w  r#V P                  W#4       K  	  R# )
a&za&bza&b za&b;N)r   rt  )r   abr   r   rD   r   )rv  rw  rj  r   r   r   r   r  s   &   r   test_EOF_in_charref&HTMLParserTestCase.test_EOF_in_charref  sR     N#$^$%GHm%789	
 #NDOOD+ #r   c                    R R.3RR.3RR.3RR.3RR.3RR.3RR.3RR.3RR.3R	R.3R
R.3RR.3RR.3RR.3.pV F  w  r#V P                  W#4       K  	  R# )r   z<!---z<!----z<!-----z<!------z<!----!z<!---!z<!---!>z<!--fooz<!--foo-z	<!--foo--z
<!--foo--!z<!--<!--z	<!--<!--!Nr  r  r  )r2   z-!r  )r2   r   r  r   rx  s   &   r   test_eof_in_comments'HTMLParserTestCase.test_eof_in_comments  s    o&''(())*++,-)*)*++,-+,-,-.-././0+,-,-.
  #NDOOD+ #r   c                    R R.3RR.3RR.3RR.3RR.3RR.3RR.3RR.3RR.3R	R.3.
pV F  w  r#V P                  W#4       K  	  R
# )r   r   z<![z	<!DOCTYPEz
<!DOCTYPE z<!DOCTYPE htmlz<!DOCTYPE html z<!DOCTYPE html PUBLICz<!DOCTYPE html PUBLIC "fooz6<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "fooNr  r  )r2   [)r@   DOCTYPE)r@   r   )r@   zDOCTYPE html)r@   zDOCTYPE html )r@   zDOCTYPE html PUBLIC)r@   zDOCTYPE html PUBLIC "foo)r@   z4DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "foor   rx  s   &   r   test_eof_in_declarations+HTMLParserTestCase.test_eof_in_declarations  s    O$%%&'%&'./0012 89:!: ;<$'F&GH),P+QRENOQ
 #NDOOD+ #r   c                   V P                  R V,           RRV,           3.4       V P                  R V,           RRV,           3.\        RR7      R7       V P                  RV,           R	R
. 3R	RR.3RRV,           3.4       R# )z	<![CDATA[rL   CDATA[r2   z[CDATA[Tr   r   <svg><text y="100"><![CDATA[r    r!   r)  Ny100r   r   )r   r   s   &&r   test_eof_in_cdata$HTMLParserTestCase.test_eof_in_cdata  s    g-((W*<=>	@g-#Y%89:"04"@ 	 	B 	6@$eR0$f|n=((W*<=?	@r   c                4    R p. ROpV P                  W4       R# )aH  <!ELEMENT br EMPTY><! not really a comment ><! not a comment either --><! -- close enough --><!><!<-- this was an empty comment><!!! another bogus comment !!!><![with square brackets]!><![
multiline
bogusness
]!><![more brackets]-[and a hyphen]!><![cdata[should be uppercase]]><![CDATA [whitespaces are not ignored]]><![CDATA]]>N))r2   zELEMENT br EMPTY)r2   z not really a comment )r2   z not a comment either --)r2   z -- close enough --r  )r2   z<-- this was an empty comment)r2   z!! another bogus comment !!!)r2   z[with square brackets]!)r2   z[
multiline
bogusness
]!)r2   z[more brackets]-[and a hyphen]!)r2   z[cdata[should be uppercase]])r2   z%[CDATA [whitespaces are not ignored]])r2   z[CDATA]]r   r  s   &  r   test_bogus_comments&HTMLParserTestCase.test_bogus_comments!  s    
 	'r   c                p    R pRRR	R
RRR.3R	RRRR.3R	RRR. 3RRR	RRRR.3R	.pV P                  W4       R# )z<![if !(IE)]>broken condcom<![endif]><![if ! IE]><link href="favicon.tiff"/><![endif]><![if !IE 6]><img src="firefox.png" /><![endif]><![if !ie 6]><b>foo</b><![endif]><![if (!IE)|(lt IE 9)]><img src="mammoth.bmp" /><![endif]>r)   linkr   r    r   N)r2   z
[if !(IE)])r   zbroken condcom)r2   z[endif])r2   z	[if ! IE])rg  zfavicon.tiff)r2   z
[if !IE 6])r   zfirefox.png)r2   z
[if !ie 6])r   r   r   )r2   z[if (!IE)|(lt IE 9)])r   zmammoth.bmpr   r  s   &  r   test_broken_condcoms'HTMLParserTestCase.test_broken_condcomsA  s|    M &&"$F%=$>?"%E$:#;<"%b!"/E$:#;<"#
& 	'r   c                    R V R2pRR. 3RRR.3RRV,           3RR.pV P                  W#4       V P                  W#\        RR7      R	7       R
# )r  z]]></text></svg>r    r!   r)  rL   r  Tr  r   Nr  r.   r)  r.   r!   r  )r   r   r   r  s   &&  r   test_cdata_section_content-HTMLParserTestCase.test_cdata_section_content_  sf    & .gY6FG#,0X/0
 	'.42PQr   c           	     h    R pRR	RR. 3RRR
.3RRRRR	.	pV P                  W\        RR7      R7       R# )zb<![CDATA[foo<br>bar]]><svg><text y="100"><![CDATA[foo<br>bar]]></text></svg><![CDATA[foo<br>bar]]>r    r!   r)  Tr  r   N)r2   z[CDATA[foo<br)r   zbar]]>r  )rL   zCDATA[foo<br>barr  r  r  r  s   &  r   test_cdata_section%HTMLParserTestCase.test_cdata_section}  sT    ) )#,00(

 	.42PQr   c                    \        R R7      pVP                  R4       V P                  VP                  4       RRR. 3RRR	.4       R# )
Trq   zfoo <a>link</a> bar &amp; bazr    r   N)r   zfoo )r   r  r   )r   z
 bar & baz)r   rv   assertEqualr   )r   r   s   & r   "test_convert_charrefs_dropped_text5HTMLParserTestCase.test_convert_charrefs_dropped_text  sO      634
C46F46	
r   cpuc                <   R  pRpV! RV,          4       V! RV,          4       V! RV,          4       V! RV,          4       V! RV,          4       V! RV,          4       V! R	V,          4       V! R
V,          4       V! RV,          4       V! RV,          4       R# )c                     \         P                  P                  4       pVP                  V 4       VP	                  4        R # rk   )r   r   r   rv   rw   )r{   r   s   & r   checkBHTMLParserTestCase.test_eof_no_quadratic_complexity.<locals>.check  s)    [[++-FKKLLNr   i r   z<a a=Nz8</a </a </a </a </a </a </a </a </a </a </a </a </a </a zB</a a=</a a=</a a=</a a=</a a=</a a=</a a=</a a=</a a=</a a=</a a=z<!--<!--<!--<!--zx<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!<!z&<?<?<?<?<?<?<?<?<?<?<?<?<?<?<?<?<?<?<?z-</$</$</$</$</$</$</$</$</$</$</$</$</$</$</$zQ<![CDATA[<![CDATA[<![CDATA[<![CDATA[<![CDATA[<![CDATA[<![CDATA[<![CDATA[<![CDATA[a;  <!doctype<!doctype<!doctype<!doctype<!doctype<!doctype<!doctype<!doctype<!doctype<!doctype<!doctype<!doctype<!doctype<!doctype<!doctype<!doctype<!doctype<!doctype<!doctype<!doctype<!doctype<!doctype<!doctype<!doctype<!doctype<!doctype<!doctype<!doctype<!doctype<!doctype<!doctype<!doctype<!doctype<!doctype<!doctyper]   )r   r  ns   &  r    test_eof_no_quadratic_complexity3HTMLParserTestCase.test_eof_no_quadratic_complexity  s    	 eaigkkAoma j1ni!mi!mj1no!""#r   r]   N)z*<!-- not a comment --> &not-an-entity-ref;<not a='start tag'>z<a href="" /> <p> <span></span>zfoo = "</scr" + "ipt>";zfoo = "</SCRIPT" + ">";zfoo = <
/script> z*<!-- document.write("</scr" + "ipt>"); -->z
//<![CDATA[
document.write('<s'+'cript type="text/javascript" src="http://www.example.org/r='+new Date().getTime()+'"><\/s'+'cript>');
//]]>z 
<!-- //
var foo = 3.14;
// -->
u   <!-- ☃ -->zfoo = "</ script>"zfoo = "</scripture>"zfoo = "</script>"u   foo = "</script >"u   foo = "</ſcript>"u   foo = "</scrıpt>")
z0a::before { content: "<!-- not a comment -->"; }z-a::before { content: "&not-an-entity-ref;"; }z-a::before { content: "<not a='start tag'>"; }u   a::before { content: "☃"; }z#a::before { content: "< /style>"; }z#a::before { content: "</ style>"; }z#a::before { content: "</styled>"; }z#a::before { content: "</style>"; }u$   a::before { content: "</style >"; }u#   a::before { content: "</ſtyle>"; })<!-- not a comment -->r  <![CDATA[not a cdata]]><!not a bogus comment></not a bogus comment>   ☃z	< /title>z	</ title>z	</titled>z	</title>u
   </title >u	   </tıtle>)r  r  r  r  r  r  z< /textarea>z</ textarea>z</textareable>z</textarea>u   </textarea >)r   SCRIPTzscript zscript
zscript/zscript foo=barzscript foo=">")r   STYLEzstyle zstyle
zstyle/zstyle foo=barzstyle foo=">")r   TITLEztitle ztitle
ztitle/ztitle foo=barztitle foo=">")r   TEXTAREAz	textarea z	textarea
z	textarea/ztextarea foo=barztextarea foo=">")r   Fr   Fr   F)z</sF)z</scriptF)z	</script T)z</script foo=barT)z</script foo=">T)r  r  r  )z</tF)z</titleF)z</title T)z</title foo=barT)z</title foo=">T)r   r*  zx]zx]])zjust some plain textr  z&not-an-entity-ref;r  r   z[[I have many brackets]]zI have a > in the middlezI have a ]] in the middlez] ]>z]] >zN
    if (a < b && a > b) {
        printf("[<marquee>How?</marquee>]");
    }
)6rO   rP   rQ   rR   r   r   r   r   r   r   r   r   r   r   r   r   r   subTestsr   r   r   r   r   r   r   r  r  r
  r  r  r+  r4  r8  rB  rP  rS  rV  rY  r^  rb  rq  ry  r|  r  r  r  r  r  r  r  requires_resourcer  rS   rT   rU   s   @r   r   r   z   s    @	

L4<:0# i "
 *3+*3 i "
 22 i "
  i "
  h !P Q
UQ
U h !M NUNU h !M NUNU h !V WUWU j 	# 	U	U j 	# 		U		U+(Z(#/JK>	-76(>>KJ(4((B,,(," i!78	@ 9	@(@(< i "  R! RR$

 u%$ &$r   r   c                      a  ] tR tRt o R tR tR tR tR tR t	R t
R	 tR
 tR tR tR tR tR tR tR tR tRtV tR# )AttributesTestCasei  c                   R R. RO3.pV P                  RV4       V P                  RR RR.3.4       V P                  RR RR.3.4       V P                  RR RR.3.4       V P                  RR RR.3.4       V P                  RR RR.3.4       V P                  R	R RR.3.4       V P                  R
R RR.3.4       V P                  RR RR.3.4       V P                  RR RR.3.4       R# )r    r   Nz<a b='v' c="v" d=v e>z<a foo==bar>z<a foo =bar>z<a foo	=bar>z<a foo=bar>u   <a foo =bar>z<a foo= bar>z<a foo=	bar>z<a foo=bar>u   <a foo= bar>))r   v)cr  )dr  )eN)r   z=barrp  )zfoorO  )u   foo rO  )r   zbar)r   u    barr   r   s   & r   test_attr_syntax#AttributesTestCase.test_attr_syntax  s   sM
N
 	3V<*cO;L)M(NO*cN;K)L(MN:s^<L*M)NO:s=M<N*O)PQ)Z?Q>R,S+TU*cN;K)L(MN:s^<L*M)NO:s=M<N*O)PQ)Z?Q>R,S+TUr   c                "   V P                  R RR. R
O3.4       V P                  RRRRR.3.4       V P                  RRRRR.3.4       V P                  RRRRR.3.4       V P                  RRRR.3.4       V P                  RRRR.3.4       R	# )z'<a b='xxx
	xxx' c="yyy	
yyy" d='	xyz
'>r    r   z<a b='' c="">z<a b=	x c=
y>u   <a b= c= >z<e a=rgb(1,2,3)>r  z<a href=mailto:xyz@example.com>N))r   zxxx
	xxx)r  zyyy	
yyy)r  z	xyz
)r   r   )r  r   )r   r*  )r  r  )r   )r      )r   z
rgb(1,2,3))rg  zmailto:xyz@example.comr   rl   s   &r   test_attr_values#AttributesTestCase.test_attr_values  s    K$c ,> ? @	A 	+$cIy+ABC	E)$cJ
+CDE	G)$cK+GHI	K 	*$c,?+@AB	D 	-# BCDE	Gr   c                    V P                  R RRRR.3.4       V P                  RRRR	R
.3.4       V P                  RRRR	R
.3.4       R# )u!   <img src=/foo/bar.png alt=中文>r    r   u+   <a title='テスト' href='テスト.html'>r   u+   <a title="テスト" href="テスト.html">N)r   z/foo/bar.png)altu   中文)r   u	   テスト)rg  u   テスト.htmlr   rl   s   &r   test_attr_nonascii%AttributesTestCase.test_attr_nonascii  s    5%"9"9"; < =	> 	K# ? C E F G	H 	K# ? C E F G	Hr   c                4    V P                  R RRR.3.4       R# )z!<a b='&amp;&gt;&lt;&quot;&apos;'>r    r   N)r   z&><"'r   rl   s   &r   test_attr_entity_replacement/AttributesTestCase.test_attr_entity_replacement  s!    /#012	4r   c                6    V P                  R RR. RO3.4       R# )z<a a.b='v' c:d=v e-f=v>r    r   N))za.br  )zc:dr  )ze-fr  r   rl   s   &r   test_attr_funky_names(AttributesTestCase.test_attr_funky_names  s     %#IJK	Mr   c                4    V P                  R RRR.3.4       R# )z0<html foo='&euro;&amp;&#97;&#x61;&unsupported;'>r    r   N)r   u   €&aa&unsupported;r   rl   s   &r   test_entityrefs_in_attributes0AttributesTestCase.test_entityrefs_in_attributes  s#    >&#D"EFG	Ir   c                H    V P                  R RRR.3RRR.3RRR.3.4       R# )	z<a $><b $=%><c \=/>r    r   Nr   r  )rA  N)rA  %)\/r   rl   s   &r   test_attr_funky_names2)AttributesTestCase.test_attr_funky_names2  s:    "#}-#
|,#}-/	0r   c                    R F]  pV P                  RV,          RRR.3.4       V P                  RV,          RRR.3.4       V P                  RV,          RRR.3.4       K_  	  R# )	&z<a href="%s">r    r   z<a href='%s'>z<a href=%s>N)r  z&amp;z&#38;z&#x26;)rg  r  r   )r   r   s   & r    test_entities_in_attribute_value3AttributesTestCase.test_entities_in_attribute_value  su    7FOOOf4(#?@BOOOf4(#?@BOOMF2(#?@B 8r   c                h    R pRRR.3RRRRR.3RRRRR	.3R
RRRR.3RR.pV P                  W4       R# )z<a href=test'style='color:red;bad1'>test - bad1</a><a href=test'+style='color:red;ba2'>test - bad2</a><a href=test'&nbsp;style='color:red;bad3'>test - bad3</a><a href = test'&nbsp;style='color:red;bad4'  >test - bad4</a>r    r   N)rg  ztest'style='color:red;bad1')r   ztest - bad1r   )rg  ztest'+style='color:red;ba2')r   ztest - bad2)rg  u   test' style='color:red;bad3')r   ztest - bad3)rg  u   test' style='color:red;bad4')r   ztest - bad4r   r  s   &  r   test_malformed_attributes,AttributesTestCase.test_malformed_attributes  st    L 	 FGH#FGH#JKL#JKL#
 	'r   c                z    V P                  R RR. 3RRRR.3R	.4       V P                  RRR. 3RRRR
.3R	.4       R# )z<x><y z=""o"" /></x>r    r*  r)   r  Nz<x><y z="""" /></x>)zr   )zo""N)r.   r*  )z""Nr   rl   s   &r   "test_malformed_adjacent_attributes5AttributesTestCase.test_malformed_adjacent_attributes  sd    .$c2.*C)]1KL+-	. 	-$c2.*C)\1JK+-	.r   c                f    V P                  R RRRR.3.4       V P                  RRRRR.3.4       R# )	z<a width="100%"cellspacing=0>r    r   z<a id="foo"class="bar">NrG  z100%cellspacing0)idr   classrO  r   rl   s   &r   test_adjacent_attributes+AttributesTestCase.test_adjacent_attributes(  sT    7$c,.ABD E	F 	1$c(/:< =	>r   c                4    V P                  R RRR.3.4       R# )z<a v=>r    r   N)r  r   r   rl   s   &r   test_missing_attribute_value/AttributesTestCase.test_missing_attribute_value1  s    $cI;78	:r   c                4    V P                  R RRR.3.4       R# )z-<a href=javascript:popup('/popup/help.html')>r    r   N)rg  z$javascript:popup('/popup/help.html')r   rl   s   &r   test_javascript_attribute_value2AttributesTestCase.test_javascript_attribute_value5  s)    G$cKLN O	Pr   c                8    V P                  R RRR.3RR.4       R# )z-<a href='http://www.example.org/">;'>spam</a>r    r   N)rg  zhttp://www.example.org/">;)r   spamr   r   rl   s   &r   test_end_tag_in_attribute_value2AttributesTestCase.test_end_tag_in_attribute_value:  s,    H$cBCE)?<	=r   c                    R pRR. 3RRRR.3RR. RO3RR. 3RRR.3RRR.3RRRR.3RR	R.3RRRRRRR.3RR	R.3RRRR.pV P                  W4       R
# )z<html><body bgcolor=d0ca90 text='181008'><table cellspacing=0 cellpadding=1 width=100% ><tr><td align=left><font size=-1>- <a href=/rabota/><span class=en> software-and-i</span></a>- <a href='/1/'><span class=en> library</span></a></table>r    r   bodytabletrtdfontr   re  N)bgcolord0ca90)r)  181008)r  )cellpaddingr   r  )alignleft)sizez-1)r   z- )rg  z/rabota/)r  en)r   z software-and-irm  r   )rg  z/1/)r   z library)r.   r  r   r  s   &  r   test_with_unquoted_attributes0AttributesTestCase.test_with_unquoted_attributesA  s    M $"79K!LMOQr" 123.!12Z/C.DE/!235PZ.?@/!235I1D
 	'r   c                    R pRRR.3RRRR.3RRRR.3RR. R
O3RRRR	.3RRRR.3RRRR.3RRRR.3RRRR.3.	pV P                  W4       R# )z<div class=bar,baz=asd><div class="bar",baz="asd"><div class=bar, baz=asd,><div class="bar", baz="asd",><div class="bar",><div class=,bar baz=,asd><div class=,"bar" baz=,"asd"><div ,class=bar ,baz=asd><div class,="bar" baz,="asd">r    r   N)r  zbar,baz=asdr  )z,bazasd)r  zbar,)bazzasd,rn  )r  rn  )r	  r  rn  )r  z,bar)r	  z,asd)r  z,"bar")r	  z,"asd")z,classrO  )zclass,rO  )zbaz,r  r   r  s   &  r   test_comma_between_attributes0AttributesTestCase.test_comma_between_attributesY  s    0 !9 ;<!1? CD!2O DE !> ?!1; ?@!2O DE!46G HI!2O DE!2O DE
 	'r   c                4    V P                  R RRR.3.4       R# )z<form action=bogus|&#()value>r    formN)actionzbogus|&#()valuer   rl   s   &r   -test_weird_chars_in_unquoted_attribute_values@AttributesTestCase.test_weird_chars_in_unquoted_attribute_valuesu  s)    7'!> ?A:B 	Cr   r]   N)rO   rP   rQ   rR   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r
  r  rS   rT   rU   s   @r   r  r    sh     VG&H4
M
I0B(0	.>:P
=(0(8C Cr   r  c                   R   a  ] tR tRt o ]! R4      ]! R4      R 4       4       tRtV tR# )TestInheritancei{  z_markupbase.ParserBase.__init__z_markupbase.ParserBase.resetc                    \        R 4      ;_uu_ 4       p\        4        VP                  4        VP                  4        RRR4       R#   + '       g   i     R# ; i)z_markupbase.ParserBaseN)r   r   assert_called_once)r   super_reset_methodsuper_init_methodparser_bases   &&& r   test_base_class_methods_called.TestInheritance.test_base_class_methods_called}  s?     +,,002113 -,,,s   +A		A	r]   N)rO   rP   rQ   rR   r   r  rS   rT   rU   s   @r   r  r  {  s+     
,-
)*4 + .4r   r  __main__)html.parserr   ry   unittestunittest.mockr   testr   r   r   r   rX   r_   ri   TestCasero   r   r  r  rO   mainr]   r   r   <module>r!     s        =,T[[++ =,@A. AL^ L 
E8$$ E0s$ s$lHC HCV4h'' 4 zMMO r   