ó
‹wÛjc           @   sÑ   d  Z  d d l Z d d l Z d d l Z d d l m Z d e j f d „  ƒ  YZ d e f d „  ƒ  YZ d e j f d	 „  ƒ  YZ	 d
 e	 f d „  ƒ  YZ
 d e	 f d „  ƒ  YZ d „  Z e d k rÍ e ƒ  n  d S(   s   Tests for HTMLParser.py.iÿÿÿÿN(   t   test_supportt   EventCollectorc           B   st   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z RS(   c         C   s,   g  |  _  |  j  j |  _ t j j |  ƒ d  S(   N(   t   eventst   appendt
   HTMLParsert   __init__(   t   self(    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyR      s    	c         C   s‰   g  } d  } xm |  j D]b } | d } | | k o= d k n re d | d d | d f | d <n | j | ƒ | } q W| |  _ | S(   Ni    t   dataiÿÿÿÿi   (   t   NoneR   R   (   R   t   Lt   prevtypet   eventt   type(    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt
   get_events   s    
#
	c         C   s   |  j  d | | f ƒ d  S(   Nt   starttag(   R   (   R   t   tagt   attrs(    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   handle_starttag!   s    c         C   s   |  j  d | | f ƒ d  S(   Nt   startendtag(   R   (   R   R   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   handle_startendtag$   s    c         C   s   |  j  d | f ƒ d  S(   Nt   endtag(   R   (   R   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   handle_endtag'   s    c         C   s   |  j  d | f ƒ d  S(   Nt   comment(   R   (   R   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   handle_comment,   s    c         C   s   |  j  d | f ƒ d  S(   Nt   charref(   R   (   R   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   handle_charref/   s    c         C   s   |  j  d | f ƒ d  S(   NR   (   R   (   R   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   handle_data2   s    c         C   s   |  j  d | f ƒ d  S(   Nt   decl(   R   (   R   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   handle_decl5   s    c         C   s   |  j  d | f ƒ d  S(   Nt	   entityref(   R   (   R   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   handle_entityref8   s    c         C   s   |  j  d | f ƒ d  S(   Nt   pi(   R   (   R   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt	   handle_pi;   s    c         C   s   |  j  d | f ƒ d  S(   Ns   unknown decl(   R   (   R   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   unknown_decl>   s    (   t   __name__t
   __module__R   R   R   R   R   R   R   R   R   R   R    R!   (    (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyR   	   s   											t   EventCollectorExtrac           B   s   e  Z d  „  Z RS(   c         C   s0   t  j |  | | ƒ |  j d |  j ƒ  f ƒ d  S(   Nt   starttag_text(   R   R   R   t   get_starttag_text(   R   R   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyR   D   s    (   R"   R#   R   (    (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyR$   B   s   t   TestCaseBasec           B   s&   e  Z e d  „ Z d „  Z d „  Z RS(   c         C   s{   | ƒ  } x | D] } | j  | ƒ q W| j ƒ  | j ƒ  } | | k rw |  j d t j | ƒ d t j | ƒ ƒ n  d  S(   Ns8   received events did not match expected events
Expected:
s   
Received:
(   t   feedt   closeR   t   failt   pprintt   pformat(   R   t   sourcet   expected_eventst	   collectort   parsert   sR   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt
   _run_checkK   s    	
c         C   s   |  j  | | t ƒ d  S(   N(   R2   R$   (   R   R-   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   _run_check_extraV   s    c         C   s#   | d „ } |  j  t j | ƒ d  S(   Nc         S   s'   t  j  ƒ  } | j |  ƒ | j ƒ  d  S(   N(   R   R(   R)   (   R-   R0   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   parseZ   s    (   t   assertRaisesR   t   HTMLParseError(   R   R-   R4   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   _parse_errorY   s    (   R"   R#   R   R2   R3   R7   (    (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyR'   I   s   	t   HTMLParserTestCasec           B   sÅ   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s*   |  j  d d g ƒ |  j  d d g ƒ d  S(   Ns   <?processing instruction>R   s   processing instructions   <?processing instruction ?>s   processing instruction ?(   R   s   processing instruction(   R   s   processing instruction ?(   R2   (   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt    test_processing_instruction_onlyc   s    	
	c         C   s_   |  j  d d d d d d g  f d d d d d d d d d g f d  d! d" d# d$ d% d& g ƒ d  S('   Ns¿   
<!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   s   
R   s   DOCTYPE html PUBLIC 'foo'R   t   htmlR   t   entityR   t   32R   s4   comment1a
-></foo><bar>&lt;<?pi?></foo<bar
comment1bt   imgt   srct   Bart   ismaps   sample
text
t   x201Cs   comment2a-- --comment2bR   (   R   s   
(   R   s   DOCTYPE html PUBLIC 'foo'(   R   s   
(   R   R;   (   R   R<   (   R   s   
(   R   s4   comment1a
-></foo><bar>&lt;<?pi?></foo<bar
comment1b(   R   s   
(   R>   R?   (   R@   N(   R   s   sample
text
(   R   RA   (   R   s   
(   R   s   comment2a-- --comment2b(   R   s   
(   R   R:   (   R   s   
(   R2   R   (   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_simple_htmlk   s&    c         C   s   |  j  d d d g ƒ d  S(   Ns   &entityref fooR   R   s    foo(   R   R   (   R   s    foo(   R2   (   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_unclosed_entityref‹   s    	c         C   s2   |  j  d d d g  f d d g  f d d g ƒ d  S(   Ns   <a><b></a></b>R   t   at   bR   (   R   RD   (   R   RE   (   R2   (   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_bad_nesting‘   s
    	c         C   s   |  j  d d g ƒ d  S(   Ns#   this text & contains & ampersands &R   (   R   s#   this text & contains & ampersands &(   R2   (   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_bare_ampersandsœ   s    	c         C   s   |  j  d d g ƒ d  S(   Ns.   this < text > contains < bare>pointy< bracketsR   (   R   s.   this < text > contains < bare>pointy< brackets(   R2   (   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_bare_pointy_brackets¡   s    	c         C   s   |  j  d d g ƒ d  S(   Ns"   <!spacer type="block" height="25">R   s   spacer type="block" height="25"(   R   s   spacer type="block" height="25"(   R2   (   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_illegal_declarations¦   s    	c         C   sB   |  j  d d d d g f g ƒ |  j  d d d d	 g f g ƒ d  S(
   Ns	   <a b='<'>R   RD   RE   t   <s	   <a b='>'>t   >(   RE   RJ   (   RE   RK   (   R2   (   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_starttag_end_boundaryª   s    c         C   s+  d d d* g f g } |  j  d g | ƒ |  j  d d g | ƒ |  j  d d	 g | ƒ |  j  d
 d g | ƒ |  j  d d g | ƒ |  j  d d g | ƒ d d d+ g f g } |  j  d g | ƒ |  j  d d g | ƒ |  j  d d g | ƒ |  j  d
 d g | ƒ |  j  d d g | ƒ |  j  d d g | ƒ d, g } |  j  d d g | ƒ |  j  d d g | ƒ |  j  d d g | ƒ |  j  d d g | ƒ |  j  d d  g | ƒ |  j  d! d" g | ƒ |  j  d# d$ g | ƒ |  j  d% d& g | ƒ |  j  d' d( g | ƒ |  j  d) d g | ƒ |  j  d d g | ƒ d  S(-   NR   RD   RE   RJ   s	   <a b='<'>s   <a s   b='<'>s   <a bs   ='<'>s   <a b=s   '<'>s   <a b='<s   '>s   <a b='<'RK   s	   <a b='>'>s   b='>'>s   ='>'>s   '>'>s   <a b='>s   <a b='>'R   t   abct    s
   <!--abc-->s	   !--abc-->s   <!s   --abc-->s   <!-s   -abc-->s   <!--s   abc-->s   <!--as   bc-->s   <!--abs   c-->s   <!--abcs   -->s   <!--abc-s   ->s	   <!--abc--(   RE   RJ   (   RE   RK   (   R   RM   (   R2   (   R   t   output(    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_buffer_artefacts®   s4    	c         C   sz  |  j  d g  ƒ |  j  d d g ƒ |  j  d d g ƒ |  j  d d g ƒ |  j  d d	 d
 g  f g ƒ |  j  d d g ƒ |  j  d d g ƒ |  j  d d  g ƒ |  j  d d! g ƒ |  j  d d" g ƒ |  j  d d# g ƒ |  j  d d$ g ƒ |  j  d d	 d g  f g ƒ |  j  d d	 d g  f g ƒ |  j  d d d g  f g ƒ |  j  d d	 d g  f g ƒ |  j  d d d g  f g ƒ d  S(%   Ns   </>s   </$>R   t   $s   </R   s   </as   <a<a>R   s   a<as   </a<a>R   s   <!s   <as   <a foo='bar's   <a foo='bars
   <a foo='>'s	   <a foo='>s   <a$>s   a$s   <a$b>s   a$bs   <a$b/>R   s   <a$b  >s   <a$b  />(   R   RQ   (   R   s   </(   R   s   </a(   R   s   a<a(   R   s   <!(   R   s   <a(   R   s   <a foo='bar'(   R   s   <a foo='bar(   R   s
   <a foo='>'(   R   s	   <a foo='>(   R2   (   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_starttag_junk_charsÌ   s"    c      
   C   sZ   d d d d d d d d d	 d
 g
 } x/ | D]' } |  j  d | d d | f g ƒ q+ Wd  S(   Nt   HTMLsO   HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"s[   HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"sb   html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"sf   html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"sY   math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd"s‚   html 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"sW   svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"s'   html PUBLIC "-//IETF//DTD HTML 2.0//EN"s,   html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"s   <!DOCTYPE %s>R   s   DOCTYPE (   R2   (   R   t   dtdst   dtd(    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_valid_doctypesß   s    	c         C   s%  |  j  d d d d g f g ƒ d } d d d d d d d d d  d! g f g } |  j  | | ƒ d } d d d" d# d$ g f d d d% d& d' g f g } |  j  | | ƒ d } d d g  f d d g  f d d g  f d d g  f d d g  f d d g  f d d g  f d d g  f g } |  j  | | ƒ d  S((   Ns   <a foo="var"/>R   RD   t   foot   varsj   <img width=902 height=250px src="/sites/default/files/images/homepage/foo.jpg" /*what am I doing here*/ />R=   t   widtht   902t   heightt   250pxR>   s,   /sites/default/files/images/homepage/foo.jpgs   *whatt   amt   it   doings   here*s9   <a / /foo/ / /=/ / /bar/ / /><a / /foo/ / /=/ / /bar/ / >t   =t   barR   sD   <meta><meta / ><meta // ><meta / / ><meta/><meta /><meta //><meta//>t   meta(   RW   RX   (   RY   RZ   (   R[   R\   (   R>   s,   /sites/default/files/images/homepage/foo.jpg(   s   *whatN(   R]   N(   R^   N(   R_   N(   s   here*N(   RW   N(   R`   N(   Ra   N(   RW   N(   R`   N(   Ra   N(   R2   R   (   R   R:   t   expected(    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_slashes_in_starttag÷   s$    	c         C   s   |  j  d d g ƒ d  S(   Ns   <!DOCTYPE foo $ >R   s   DOCTYPE foo $ (   R   s   DOCTYPE foo $ (   R2   (   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_declaration_junk_chars  s    c         C   sm   |  j  d d d g  f g ƒ |  j  d d d g  f d g ƒ |  j  d d d g  f d d d g f d g ƒ d  S(   Ns   <p/>R   t   ps   <p></p>R   R   s   <p><img src='foo' /></p>R=   R>   RW   (   R   Rf   (   R>   RW   (   R   Rf   (   R2   (   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_startendtag  s    		
	c         C   sƒ   d } d d g  f d
 d d g  f d d d g  f d d d g  f d d d g  f d d d g  f d d g  f g } |  j  | | ƒ d  S(   Nsn   <br></label</p><br></div end tmAd-leaderBoard><br></<h4><br></li class="unit"><br></li
						</ul><br></><br>R   t   brR   s   label<t   divR   s   <h4t   li(   R   s   label<(   R   Ri   (   R   s   <h4(   R   Rj   (   R   Rj   (   R2   (   R   R:   Rc   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_invalid_end_tags'  s    c         C   s5   d } d d g  f d d	 d
 g } |  j  | | ƒ d  S(   Ns(   <b>This</b attr=">"> confuses the parserR   RE   R   t   ThisR   s   "> confuses the parser(   R   Rl   (   R   RE   (   R   s   "> confuses the parser(   R2   (   R   R:   Rc   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_broken_invalid_end_tagA  s    	c         C   s5   d } |  j  | d d d	 d
 g f d | f g ƒ d  S(   Ns    <foo:bar   
   one="1"	two=2   >R   s   foo:bart   onet   1t   twot   2R%   (   Rn   Ro   (   Rp   Rq   (   R3   (   R   R1   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_get_starttag_textM  s    	c         C   s·   d d d d d d d d d	 d
 d g } d d d d d d g } xq | D]i } x` | D]X } | j  ƒ  } d j d | d | ƒ } |  j | d | g  f d | f d | f g ƒ qS WqF Wd  S(   Ns*   <!-- not a comment --> &not-an-entity-ref;s   <not a='start tag'>s   <a href="" /> <p> <span></span>s   foo = "</scr" + "ipt>";s   foo = "</SCRIPT" + ">";s   foo = <
/script> s*   <!-- document.write("</scr" + "ipt>"); -->s�   
//<![CDATA[
document.write('<s'+'cript type="text/javascript" src="http://www.example.org/r='+new Date().getTime()+'"><\/s'+'cript>');
//]]>s    
<!-- //
var foo = 3.14;
// -->
s   foo = "</sty" + "le>";u   <!-- â˜ƒ -->t   scriptt   stylet   SCRIPTt   STYLEt   Scriptt   Styleu    <{element}>{content}</{element}>t   elementt   contentR   R   R   (   t   lowert   formatR2   (   R   t   contentst   elementsRz   Ry   t   element_lowerR1   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_cdata_contentS  s(    			c         C   s‰   d t  f d „  ƒ  Y} d } xf d d d d d d	 g D]L } d
 j d | d | ƒ } |  j | d d g  f d | f d g d | ƒq5 Wd  S(   Nt	   Collectorc           B   s   e  Z d  „  Z RS(   c         S   s   |  j  S(   N(   R   (   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyR   x  s    (   R"   R#   R   (    (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyR�   w  s   s®   <!-- not a comment --> &not-an-entity-ref;
                  <a href="" /> </p><p> &amp; <span></span></style>
                  '</script' + '>' </html> </head> </scripter>!s    scripts   script s    script s   
scripts   script
s   
script
u   <script>{content}</{element}>Ry   Rz   R   Rs   R   R   R/   (   R   Rs   (   R   R|   R2   (   R   R�   Rz   Ry   R1   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_cdata_with_closing_tagsr  s    			c         C   sK   |  j  d d d g  f d	 d
 g ƒ |  j  d g d d g  f d d g ƒ d  S(   Ns   <p>&#bad;</p>R   Rf   R   s   &#bad;R   s   <div>&#bad;</div>Ri   (   R   s   &#bad;(   R   Rf   (   R   s   &#bad;(   R   Ri   (   R2   (   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_malformatted_charref‡  s    	
c         C   sB   t  j  ƒ  } |  j | j d ƒ d ƒ |  j | j d ƒ d ƒ d  S(   Ns   &#bad;s   &#0038;t   &(   R   t   assertEqualt   unescape(   R   R0   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_unescape_function”  s    (   R"   R#   R9   RB   RC   RF   RG   RH   RI   RL   RP   RR   RV   Rd   Re   Rg   Rk   Rm   Rr   R€   R‚   Rƒ   R‡   (    (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyR8   a   s*   		 																		t   AttributesTestCasec           B   s¡   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   sb   d d d d d d g f g } |  j d | ƒ |  j d	 | ƒ |  j d
 | ƒ |  j d | ƒ d  S(   NR   RD   RE   t   vt   ct   dt   es   <a b='v' c="v" d=v e>s   <a  b = 'v' c = "v" d = v e>s   <a
b
=
'v'
c
=
"v"
d
=
v
e>s   <a	b	=	'v'	c	=	"v"	d	=	v	e>(   RE   R‰   (   RŠ   R‰   (   R‹   R‰   (   RŒ   N(   R   R2   (   R   RO   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_attr_syntax�  s
    c         C   s‰   |  j  d d d d d d g f g ƒ |  j  d
 d d d d g f g ƒ |  j  d d d d g f g ƒ |  j  d d d d g f g ƒ d  S(   Ns'   <a b='xxx
	xxx' c="yyy	
yyy" d='	xyz
'>R   RD   RE   s   xxx
	xxxRŠ   s   yyy	
yyyR‹   s   	xyz
s   <a b='' c="">RN   s   <e a=rgb(1,2,3)>RŒ   s
   rgb(1,2,3)s   <a href=mailto:xyz@example.com>t   hrefs   mailto:xyz@example.com(   RE   s   xxx
	xxx(   RŠ   s   yyy	
yyy(   R‹   s   	xyz
(   RE   RN   (   RŠ   RN   (   RD   s
   rgb(1,2,3)(   RŽ   s   mailto:xyz@example.com(   R2   (   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_attr_values¦  s    				c         C   sj   |  j  d d d d d g f g ƒ |  j  d d d	 d d g f g ƒ |  j  d d d	 d d g f g ƒ d  S(   Nu!   <img src=/foo/bar.png alt=ä¸­æ–‡>R   R=   R>   s   /foo/bar.pngt   altu   ä¸­æ–‡u+   <a title='ãƒ†ã‚¹ãƒˆ' href='ãƒ†ã‚¹ãƒˆ.html'>RD   t   titleu	   ãƒ†ã‚¹ãƒˆRŽ   u   ãƒ†ã‚¹ãƒˆ.htmlu+   <a title="ãƒ†ã‚¹ãƒˆ" href="ãƒ†ã‚¹ãƒˆ.html">(   R>   s   /foo/bar.png(   R�   u   ä¸­æ–‡(   R‘   u	   ãƒ†ã‚¹ãƒˆ(   RŽ   u   ãƒ†ã‚¹ãƒˆ.html(   R‘   u	   ãƒ†ã‚¹ãƒˆ(   RŽ   u   ãƒ†ã‚¹ãƒˆ.html(   R2   (   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_attr_nonasciiµ  s    			c         C   s#   |  j  d d d d g f g ƒ d  S(   Ns!   <a b='&amp;&gt;&lt;&quot;&apos;'>R   RD   RE   s   &><"'(   RE   s   &><"'(   R2   (   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_attr_entity_replacementÄ  s    c         C   sf   |  j  d d d d d d g f g ƒ |  j  d d d d g f d d
 d g f d d d g f g ƒ d  S(   Ns   <a a.b='v' c:d=v e-f=v>R   RD   s   a.bR‰   s   c:ds   e-fs   <a $><b $=%><c \=/>RQ   RE   t   %RŠ   s   \t   /(   s   a.bR‰   (   s   c:dR‰   (   s   e-fR‰   (   RQ   N(   RQ   R”   (   s   \R•   (   R2   R   (   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_attr_funky_namesÉ  s    c         C   s#   |  j  d d d d g f g ƒ d  S(   Ns0   <html foo='&euro;&amp;&#97;&#x61;&unsupported;'>R   R:   RW   u   â‚¬&aa&unsupported;(   RW   u   â‚¬&aa&unsupported;(   R2   (   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_entityrefs_in_attributesÓ  s    c         C   sŠ   xƒ d d d d g D]o } |  j  d | d d d g f g ƒ |  j  d	 | d d d g f g ƒ |  j  d
 | d d d g f g ƒ q Wd  S(   NR„   s   &amp;s   &#38;s   &#x26;s   <a href="%s">R   RD   RŽ   s   <a href='%s'>s   <a href=%s>(   RŽ   R„   (   RŽ   R„   (   RŽ   R„   (   R2   (   R   R;   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt    test_entities_in_attribute_valueØ  s    c         C   st   d } d d d g f d d d d d g f d d d d d g f d d d d d g f d d g } |  j  | | ƒ d  S(   NsÜ   <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   RD   RŽ   s   test'style='color:red;bad1'R   s   test - bad1R   s   test'+style='color:red;ba2's   test - bad2u   test'Â style='color:red;bad3's   test - bad3u   test'Â style='color:red;bad4's   test - bad4(   RŽ   s   test'style='color:red;bad1'(   R   s   test - bad1(   R   RD   (   RŽ   s   test'+style='color:red;ba2'(   R   s   test - bad2(   R   RD   (   RŽ   u   test'Â style='color:red;bad3'(   R   s   test - bad3(   R   RD   (   RŽ   u   test'Â style='color:red;bad4'(   R   s   test - bad4(   R   RD   (   R2   (   R   R:   Rc   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_malformed_attributesâ  s    c         C   sf   |  j  d d d g  f d d d d g f d g ƒ |  j  d
 d d g  f d d d d g f d g ƒ d  S(   Ns   <x><y z=""o"" /></x>R   t   xR   t   yt   zRN   s   o""R   s   <x><y z="""" /></x>s   ""(   Rœ   RN   (   s   o""N(   R   Rš   (   Rœ   RN   (   s   ""N(   R   Rš   (   R2   R   (   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt"   test_malformed_adjacent_attributesö  s    	
	c         C   sH   |  j  d d d d d g f g ƒ |  j  d d d d d g f g ƒ d  S(   Ns   <a width="100%"cellspacing=0>R   RD   RY   s   100%t   cellspacingt   0s   <a id="foo"class="bar">t   idRW   t   classRa   (   RY   s   100%(   Rž   RŸ   (   R    RW   (   R¡   Ra   (   R2   (   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_adjacent_attributes  s    		c         C   s#   |  j  d d d d g f g ƒ d  S(   Ns   <a v=>R   RD   R‰   RN   (   R‰   RN   (   R2   (   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_missing_attribute_value  s    	c         C   s#   |  j  d d d d g f g ƒ d  S(   Ns-   <a href=javascript:popup('/popup/help.html')>R   RD   RŽ   s$   javascript:popup('/popup/help.html')(   RŽ   s$   javascript:popup('/popup/help.html')(   R2   (   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_javascript_attribute_value  s    	c         C   s)   |  j  d d d d	 g f d
 d g ƒ d  S(   Ns-   <a href='http://www.example.org/">;'>spam</a>R   RD   RŽ   s   http://www.example.org/">;R   t   spamR   (   RŽ   s   http://www.example.org/">;(   R   R¥   (   R   RD   (   R2   (   R   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_end_tag_in_attribute_value  s    		c         C   s5   d } d
 d d d d d d g } |  j  | | ƒ d  S(   Nsž   <!-- I'm a valid comment --><!--me too!--><!------><!----><!----I have many hyphens----><!-- I have a > in the middle --><!-- and I have -- in the middle! -->R   s    I'm a valid comment s   me too!s   --RN   s   --I have many hyphens--s    I have a > in the middle s    and I have -- in the middle! (   R   s    I'm a valid comment (   R   s   me too!(   R   s   --(   R   RN   (   R   s   --I have many hyphens--(   R   s    I have a > in the middle (   R   s    and I have -- in the middle! (   R2   (   R   R:   Rc   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_comments  s    	c         C   s2   d } d	 d
 d d d d g } |  j  | | ƒ d  S(   NsŒ   <! not really a comment ><! not a comment either --><! -- close enough --><!><!<-- this was an empty comment><!!! another bogus comment !!!>R   s    not really a comment s    not a comment either --s    -- close enough --RN   s   <-- this was an empty comments   !! another bogus comment !!!(   R   s    not really a comment (   R   s    not a comment either --(   R   s    -- close enough --(   R   RN   (   R   s   <-- this was an empty comment(   R   s   !! another bogus comment !!!(   R2   (   R   R:   Rc   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_broken_comments,  s    	c         C   s)   d } d d d g } |  j  | | ƒ d  S(	   Nss   <!--[if IE & !(lte IE 8)]>aren't<![endif]--><!--[if IE 8]>condcoms<![endif]--><!--[if lte IE 7]>pretty?<![endif]-->R   s%   [if IE & !(lte IE 8)]>aren't<![endif]s   [if IE 8]>condcoms<![endif]s   [if lte IE 7]>pretty?<![endif](   R   s%   [if IE & !(lte IE 8)]>aren't<![endif](   R   s   [if IE 8]>condcoms<![endif](   R   s   [if lte IE 7]>pretty?<![endif](   R2   (   R   R:   Rc   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_condcoms<  s
    	c         C   s€   d } d d d d d d	 d g f d d d d d g f d d  d d g  f d! d" d# d$ d d d% g f d& g } |  j  | | ƒ d  S('   Nsá   <![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]>s   unknown decls   if !(IE)R   s   broken condcomt   endifs   if ! IER   t   linkRŽ   s   favicon.tiffs   if !IE 6R=   R>   s   firefox.pngs   if !ie 6R   RE   RW   R   s   if (!IE)|(lt IE 9)s   mammoth.bmp(   s   unknown decls   if !(IE)(   R   s   broken condcom(   s   unknown declRª   (   s   unknown decls   if ! IE(   RŽ   s   favicon.tiff(   s   unknown declRª   (   s   unknown decls   if !IE 6(   R>   s   firefox.png(   s   unknown declRª   (   s   unknown decls   if !ie 6(   R   RW   (   R   RE   (   s   unknown declRª   (   s   unknown decls   if (!IE)|(lt IE 9)(   R>   s   mammoth.bmp(   s   unknown declRª   (   R2   (   R   R:   Rc   (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   test_broken_condcomsE  s&    	(   R"   R#   R�   R�   R’   R“   R–   R—   R˜   R™   R�   R¢   R£   R¤   R¦   R§   R¨   R©   R¬   (    (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyRˆ   ›  s"   						
		
											c           C   s   t  j t t ƒ d  S(   N(   R    t   run_unittestR8   Rˆ   (    (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt	   test_maing  s    t   __main__(   t   __doc__R   R+   t   unittestt   testR    R   R$   t   TestCaseR'   R8   Rˆ   R®   R"   (    (    (    sŠ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_htmlparser.pyt   <module>   s   9ÿ ;Ì	