Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.9/test/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.9/test/__pycache__/test_htmlparser.cpython-39.opt-2.pyc

a

��g ��@s�ddlZddlZddlZGdd�dejj�ZGdd�de�ZGdd�de�ZGdd	�d	ej	�Z
Gd
d�de
�ZGdd
�d
e
�Ze
dkr�e��dS)�Nc@sleZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�EventCollectorcOs0g|_|jj|_tjjj|g|�Ri|��dS�N)�events�append�html�parser�
HTMLParser�__init__)�self�args�kw�r
�0/usr/local/lib/python3.9/test/test_htmlparser.pyr	
s
zEventCollector.__init__cCsjg}d}|jD]P}|d}||kr.dkrPnnd|dd|df|d<n
|�|�|}q||_|S)Nr�data����)rr)r
�LZprevtype�event�typer
r
r�
get_eventss

zEventCollector.get_eventscCs|�d||f�dS)N�starttag�r�r
�tag�attrsr
r
r�handle_starttag szEventCollector.handle_starttagcCs|�d||f�dS)N�startendtagrrr
r
r�handle_startendtag#sz!EventCollector.handle_startendtagcCs|�d|f�dS)N�endtagr)r
rr
r
r�
handle_endtag&szEventCollector.handle_endtagcCs|�d|f�dS)N�commentr�r
rr
r
r�handle_comment+szEventCollector.handle_commentcCs|�d|f�dS)N�charrefrr!r
r
r�handle_charref.szEventCollector.handle_charrefcCs|�d|f�dS)Nrrr!r
r
r�handle_data1szEventCollector.handle_datacCs|�d|f�dS)N�declrr!r
r
r�handle_decl4szEventCollector.handle_declcCs|�d|f�dS)N�	entityrefrr!r
r
r�handle_entityref7szEventCollector.handle_entityrefcCs|�d|f�dS)N�pirr!r
r
r�	handle_pi:szEventCollector.handle_picCs|�d|f�dS)N�unknown declr)r
r&r
r
r�unknown_decl=szEventCollector.unknown_declN)�__name__�
__module__�__qualname__r	rrrrr"r$r%r'r)r+r-r
r
r
rrsrc@seZdZdd�ZdS)�EventCollectorExtracCs$t�|||�|�d|��f�dS)N�
starttag_text)rrrZget_starttag_textrr
r
rrCsz#EventCollectorExtra.handle_starttagN)r.r/r0rr
r
r
rr1Asr1c@seZdZdd�Zdd�ZdS)�EventCollectorCharrefscCs|�d�dS�Nz6This should never be called with convert_charrefs=True��failr!r
r
rr$Jsz%EventCollectorCharrefs.handle_charrefcCs|�d�dSr4r5r!r
r
rr)Msz'EventCollectorCharrefs.handle_entityrefN)r.r/r0r$r)r
r
r
rr3Hsr3c@s&eZdZdd�Zddd�Zdd�ZdS)	�TestCaseBasecCs
tdd�S�NF��convert_charrefs)r�r
r
r
r�
get_collectorSszTestCaseBase.get_collectorNcCsr|dur|��}|}|D]}|�|�q|��|��}||krn|�dt|�dt�|�dt�|��dS)Nz6received events did not match expected events
Source:
z
Expected:
z
Received:
)r<�feed�closerr6�repr�pprintZpformat)r
�sourceZexpected_events�	collectorr�srr
r
r�
_run_checkVs&�����zTestCaseBase._run_checkcCs|�||tdd��dSr8)rDr1)r
rArr
r
r�_run_check_extrads�zTestCaseBase._run_check_extra)N)r.r/r0r<rDrEr
r
r
rr7Qs
r7c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;S)<�HTMLParserTestCasecCs |�ddg�|�ddg�dS)Nz<?processing instruction>)r*zprocessing instructionz<?processing instruction ?>)r*zprocessing instruction ?�rDr;r
r
r� test_processing_instruction_onlyks��z3HTMLParserTestCase.test_processing_instruction_onlycCsB|�ddddddgfddddddd	d
dgfdd
dddddg�dS)Nz�
<!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&zDOCTYPE html PUBLIC 'foo'rr)r(�entity)r#Z32)r z4comment1a
-></foo><bar>&lt;<?pi?></foo<bar
comment1b�img)�srcZBar)ZismapN)rzsample
text
)r#Zx201C)r zcomment2a-- --comment2b�rrrGr;r
r
r�test_simple_htmlss(��z#HTMLParserTestCase.test_simple_htmlcCs6|�dddgfddg�|�dgddgfddg�dS)	Nz
<p>&#bad;</p>r�p)rz&#bad;�rrOz<div>&#bad;</div>�div�rrQrGr;r
r
r�test_malformatted_charref�s��z,HTMLParserTestCase.test_malformatted_charrefcCs|�dddg�dS)Nz&entityref foo)r(r()rz foorGr;r
r
r�test_unclosed_entityref�s�z*HTMLParserTestCase.test_unclosed_entityrefcCs$|�dddgfddgfddg�dS)Nz<a><b></a></b>r�a�b�rrU�rrVrGr;r
r
r�test_bad_nesting�s�z#HTMLParserTestCase.test_bad_nestingcCs|�ddg�dS)N�#this text & contains & ampersands &)rrZrGr;r
r
r�test_bare_ampersands�s�z'HTMLParserTestCase.test_bare_ampersandscCs|�ddg�dS)N�.this < text > contains < bare>pointy< brackets)rr\rGr;r
r
r�test_bare_pointy_brackets�s�z,HTMLParserTestCase.test_bare_pointy_bracketscCs0|�ddddgfg�|�ddddgfg�dS)N�	<a b='<'>rrU�rV�<�	<a b='>'>�rV�>rGr;r
r
r�test_starttag_end_boundary�sz-HTMLParserTestCase.test_starttag_end_boundarycCs�dddgfg}|�dg|�|�ddg|�|�ddg|�|�d	d
g|�|�ddg|�|�d
dg|�dddgfg}|�dg|�|�ddg|�|�ddg|�|�d	dg|�|�ddg|�|�ddg|�dg}|�ddg|�|�ddg|�|�ddg|�|�ddg|�|�dd g|�|�d!d"g|�|�d#d$g|�|�d%d&g|�|�d'd(g|�|�d)dg|�|�ddg|�dS)*NrrUr_r^z<a zb='<'>z<a bz='<'>z<a b=z'<'>z<a b='<z'>z<a b='<'rcrbrazb='>'>z='>'>z'>'>z<a b='>z<a b='>')r �abc�z
<!--abc-->r`z	!--abc-->�<!z--abc-->z<!-z-abc-->z<!--zabc-->z<!--azbc-->z<!--abzc-->z<!--abcz-->z<!--abc-z->z	<!--abc--rG�r
�outputr
r
r�test_buffer_artefacts�s4z(HTMLParserTestCase.test_buffer_artefactscCs0gd�}|D]}|�d|dd|fg�qdS)N)
ZHTMLzOHTML 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"z�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"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"z
<!DOCTYPE %s>r&zDOCTYPE rG)r
ZdtdsZdtdr
r
r�test_valid_doctypes�s

�z&HTMLParserTestCase.test_valid_doctypescCsN|�dddgfg�|�dddgfdg�|�dddgfddd	gfdg�dS)
Nz<p/>rrOz<p></p>rrPz<p><img src='foo' /></p>rK)rL�foorGr;r
r
r�test_startendtag�s��
�z#HTMLParserTestCase.test_startendtagcCs&d}|�|ddddgfd|fg�dS)Nz <foo:bar   
   one="1"	two=2   >rzfoo:bar)Zone�1)Ztwo�2r2)rE)r
rCr
r
r�test_get_starttag_texts
�z)HTMLParserTestCase.test_get_starttag_textc	Cs^gd�}gd�}|D]D}|D]:}|��}dj||d�}|�|d|gfd|fd|fg�qqdS)N)z*<!-- not a comment --> &not-an-entity-ref;z<not a='start tag'>z<a href="" /> <p> <span></span>zfoo = "</scr" + "ipt>";zfoo = "</SCRIPT" + ">";zfoo = <
/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;
// -->
zfoo = "</sty" + "le>";u<!-- ☃ -->)�script�styleZSCRIPTZSTYLEZScriptZStylez <{element}>{content}</{element}>��element�contentrrr)�lower�formatrD)r
�contents�elementsrurt�
element_lowerrCr
r
r�test_cdata_content	s��z%HTMLParserTestCase.test_cdata_contentcCsfGdd�dt�}d}dD]H}|����}dj||d�}|j|d|gfd|fd	|fg|d
d�d�qdS)
Nc@seZdZdd�ZdS)zBHTMLParserTestCase.test_cdata_with_closing_tags.<locals>.CollectorcSs|jSr)rr;r
r
rr.szMHTMLParserTestCase.test_cdata_with_closing_tags.<locals>.Collector.get_eventsN)r.r/r0rr
r
r
r�	Collector-sr|z�<!-- not a comment --> &not-an-entity-ref;
                  <a href="" /> </p><p> <span></span></style>
                  '</script' + '>')z scriptzscript z script z
scriptzscript
z
script
z<script>{content}</{element}>rsrrrFr9�rB)rrv�striprwrD)r
r|rurtrzrCr
r
r�test_cdata_with_closing_tags(s���z/HTMLParserTestCase.test_cdata_with_closing_tagscCsd}gd�}|�||�dS)Nz�<!-- I'm a valid comment --><!--me too!--><!------><!----><!----I have many hyphens----><!-- I have a > in the middle --><!-- and I have -- in the middle! -->))r z I'm a valid comment )r zme too!)r z--�r rf)r z--I have many hyphens--)r z I have a > in the middle )r z and I have -- in the middle! rG�r
r�expectedr
r
r�
test_comments>sz HTMLParserTestCase.test_commentscCsd}gd�}|�||�dS)Nzs<!--[if IE & !(lte IE 8)]>aren't<![endif]--><!--[if IE 8]>condcoms<![endif]--><!--[if lte IE 7]>pretty?<![endif]-->))r z%[if IE & !(lte IE 8)]>aren't<![endif])r zf IE 8]>condcoms<![endif])r z[if lte IE 7]>pretty?<![endif]rGr�r
r
r�
test_condcomsOsz HTMLParserTestCase.test_condcomsc
CsBdd�}|�|�j�gd�}dddgfddg}|D]}|jd	�|�||�d
�q4dddgd�fdddg}|D]}|jd
�|�||�d
�qn|D]X}d�|gd�}dddgfd|fddddgfd|fddg	}|jd�||�||�d
�q�d}tdt|��D],}|j|d|�d|d|�fg|�d
�q�|jddg|�d
�dS)NcSst�Sr)r3r
r
r
r�<lambda>Z�z:HTMLParserTestCase.test_convert_charrefs.<locals>.<lambda>)z&quot;z&#34;z&#x22;z&quotz&#34z&#x22rrU)�hrefzfoo"zar)rza"zrWz<a href="foo{0}zar">a{0}z</a>r})r�"))�xr�)�yz"X)�zzX"z*{0}<a x="{0}" y="{0}X" z="X{0}">{0}</a>{0}�X�rqr)rrqrr)rrrz/{1}<script>{0}</script>{1}<style>{0}</style>{1}z&quo &# &#xr�no charrefs here)rr�)Z
assertTruer:rDrw�join�range�len)r
rBZcharrefsr�r#�textrr�r
r
r�test_convert_charrefsXsR
���������
�z(HTMLParserTestCase.test_convert_charrefscCs2|�ddddgfdddddd	gfd
ddd
g	�dS)NzF<html <html>te>>xt&a<<bc</a></html>
<img src="URL><//img></html</html>rr)z<htmlN)rzte>>xt)r(rU)rr`zbc<)rUNrM)rz
<img src="URL>)r z/img)rzhtml<rGr;r
r
r�test_tolerant_parsing�s

��z(HTMLParserTestCase.test_tolerant_parsingcCs|�dg�|�ddg�|�ddg�|�ddg�|�dd	d
gfg�|�ddg�|�d
dg�|�ddg�|�ddg�|�ddg�|�ddg�|�ddg�|�dd	dgfg�|�dd	dgfg�|�dddgfg�|�dd	dgfg�|�d ddgfg�dS)!Nz</>z</$>)r �$�</)rr��</a)rr�z<a<a>r�a<az</a<a>)rr�rg)rrg�<a)rr��<a foo='bar')rr��<a foo='bar)rr��
<a foo='>')rr��	<a foo='>)rr�z<a$>za$z<a$b>za$bz<a$b/>rz<a$b  >z<a$b  />rGr;r
r
r�test_starttag_junk_chars�s"z+HTMLParserTestCase.test_starttag_junk_charsc
Cs�|�ddddgfg�d}ddgd�fg}|�||�d}ddgd	�fd
dgd	�fg}|�||�d}d
dgfd
dgfd
dgfd
dgfddgfddgfddgfddgfg}|�||�dS)
Nz<a foo="var"/>rrU)rl�varzj<img width=902 height=250px src="/sites/default/files/images/homepage/foo.jpg" /*what am I doing here*/ />rK))�widthZ902)ZheightZ250px)rLz,/sites/default/files/images/homepage/foo.jpg)z*whatN)�amN)�iN)ZdoingN)zhere*Nz9<a / /foo/ / /=/ / /bar/ / /><a / /foo/ / /=/ / /bar/ / >))rlN)�=N)�barNrzD<meta><meta / ><meta // ><meta / / ><meta/><meta /><meta //><meta//>�metarGr�r
r
r�test_slashes_in_starttag�s$���z+HTMLParserTestCase.test_slashes_in_starttagcCs|�ddg�dS)Nz<!DOCTYPE foo $ >)r&zDOCTYPE foo $ rGr;r
r
r�test_declaration_junk_chars�sz.HTMLParserTestCase.test_declaration_junk_charscCs|�ddg�dS)Nz"<!spacer type="block" height="25">)r zspacer type="block" height="25"rGr;r
r
r�test_illegal_declarations�s�z,HTMLParserTestCase.test_illegal_declarationscCsZd}ddgfdddgfdddgfdddgfdddgfdddgfddgfg}|�||�dS)Nzn<br></label</p><br></div end tmAd-leaderBoard><br></<h4><br></li class="unit"><br></li
						</ul><br></><br>r�br)rzlabel<rR)r z<h4)rZlirGr�r
r
r�test_invalid_end_tags�s�z(HTMLParserTestCase.test_invalid_end_tagscCs&d}ddgfdddg}|�||�dS)Nz(<b>This</b attr=">"> confuses the parserrrV)rZThisrX)rz"> confuses the parserrGr�r
r
r�test_broken_invalid_end_tag�s�z.HTMLParserTestCase.test_broken_invalid_end_tagcCs�d}dddgfddgfddddgfd	d
ddd
gfdddgfddddg}|�||�d}ddgd�fddgfddddgfd	d
g}|�||�dS)Nz[<div style=""    ><b>The <a href="some_url">rain</a> <br /> in <span>Spain</span></b></div>rrQ�rrrfrV)rzThe rU)r�Zsome_url)rZrainrW�r� rr�)rz in �span)rZSpain�rr�rXrRz><div style="", foo = "bar" ><b>The <a href="some_url">rain</a>)r���,N)rlr�rGr�r
r
r�$test_correct_detection_of_start_tags�s4

�
�z7HTMLParserTestCase.test_correct_detection_of_start_tagscCsFddgfddgfdgd�fddd	gfg}|D]\}}|�||�q,dS)
N�a&)rr�za&b)r�abza&b )�rrU�r(rVr�za&b;r�r�rG)r
rrr�r
r
r�test_EOF_in_charrefs

�z&HTMLParserTestCase.test_EOF_in_charrefcCsd}gd�}|�||�dS)Nz�<! not really a comment ><! not a comment either --><! -- close enough --><!><!<-- this was an empty comment><!!! another bogus comment !!!>))r z not really a comment )r z not a comment either --)r z -- close enough --r�)r z<-- this was an empty comment)r z!! another bogus comment !!!rGr�r
r
r�test_broken_commentssz'HTMLParserTestCase.test_broken_commentscCsXd}dddddddgfdd	dd
dgfddd
dgfdddddd
dgfdg}|�||�dS)Nz�<![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,zif !(IE))rzbroken condcom)r,Zendif)r,zif ! IEr�link)r�zfavicon.tiff)r,zif !IE 6rK)rLzfirefox.png)r,zif !ie 6rrV)rrlrX)r,zif (!IE)|(lt IE 9))rLzmammoth.bmprGr�r
r
r�test_broken_condcoms,s(


�z'HTMLParserTestCase.test_broken_condcomscCs8tdd�}|�d�|�|��dddgfddd	g�dS)
NTr9zfoo <a>link</a> bar &amp; baz)rzfoo rrU)rr�rW)rz
 bar & baz)rr=�assertEqualr)r
rr
r
r�"test_convert_charrefs_dropped_textMs

��z5HTMLParserTestCase.test_convert_charrefs_dropped_textN) r.r/r0rHrNrSrTrYr[r]rdrjrkrmrpr{rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r
r
r
rrFis: 
	)
!!rFc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'S)(�AttributesTestCasecCsDddgd�fg}|�d|�|�d|�|�d|�|�d|�dS)NrrU))rV�v)�cr�)�dr�)�eNz<a b='v' c="v" d=v e>z<a  b = 'v' c = "v" d = v e>z<a
b
=
'v'
c
=
"v"
d
=
v
e>z<a	b	=	'v'	c	=	"v"	d	=	v	e>rGrhr
r
r�test_attr_syntax\s�z#AttributesTestCase.test_attr_syntaxcCs`|�dddgd�fg�|�dddddgfg�|�ddd	d
gfg�|�ddddgfg�dS)
Nz'<a b='xxx
	xxx' c="yyy	
yyy" d='	xyz
'>rrU))rVzxxx
	xxx)r�zyyy	
yyy)r�z	xyz
z
<a b='' c="">)rVrf)r�rfz<e a=rgb(1,2,3)>r�)rUz
rgb(1,2,3)z<a href=mailto:xyz@example.com>)r�zmailto:xyz@example.comrGr;r
r
r�test_attr_valueses����z#AttributesTestCase.test_attr_valuescCsL|�dddddgfg�|�ddddd	gfg�|�d
dddd	gfg�dS)Nu!<img src=/foo/bar.png alt=中文>rrK)rLz/foo/bar.png)Zaltu中文u+<a title='テスト' href='テスト.html'>rU)�titleu	テスト)r�uテスト.htmlu+<a title="テスト" href="テスト.html">rGr;r
r
r�test_attr_nonasciits$������z%AttributesTestCase.test_attr_nonasciicCs|�ddddgfg�dS)Nz!<a b='&amp;&gt;&lt;&quot;&apos;'>rrU)rVz&><"'rGr;r
r
r�test_attr_entity_replacement�s�z/AttributesTestCase.test_attr_entity_replacementcCs|�dddgd�fg�dS)Nz<a a.b='v' c:d=v e-f=v>rrU))za.br�)zc:dr�)ze-fr�rGr;r
r
r�test_attr_funky_names�s�z(AttributesTestCase.test_attr_funky_namescCs|�ddddgfg�dS)Nz0<html foo='&euro;&amp;&#97;&#x61;&unsupported;'>rr)rlu€&aa&unsupported;rGr;r
r
r�test_entityrefs_in_attributes�s�z0AttributesTestCase.test_entityrefs_in_attributescCs.|�ddddgfdddgfdddgfg�dS)	Nz<a $><b $=%><c \=/>rrU)r�NrV)r��%r�)�\�/rGr;r
r
r�test_attr_funky_names2�s


��z)AttributesTestCase.test_attr_funky_names2cCs\dD]R}|�d|dddgfg�|�d|dddgfg�|�d|dddgfg�qdS)N)�&z&amp;z&#38;z&#x26;z
<a href="%s">rrU)r�r�z
<a href='%s'>z<a href=%s>rG)r
rJr
r
r� test_entities_in_attribute_value�s
�
�
�z3AttributesTestCase.test_entities_in_attribute_valuecCsPd}dddgfdddddgfddddd	gfd
ddddgfddg}|�||�dS)
Nz�<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>rrU)r�ztest'style='color:red;bad1')rztest - bad1rW)r�ztest'+style='color:red;ba2')rztest - bad2)r�utest' style='color:red;bad3')rztest - bad3)r�utest' style='color:red;bad4')rztest - bad4rGr�r
r
r�test_malformed_attributes�s�



�
z,AttributesTestCase.test_malformed_attributescCsH|�dddgfddddgfdg�|�d	ddgfdddd
gfdg�dS)Nz<x><y z=""o"" /></x>rr�rr�)r�rf)zo""N)rr�z<x><y z="""" /></x>)z""NrGr;r
r
r�"test_malformed_adjacent_attributes�s����z5AttributesTestCase.test_malformed_adjacent_attributescCs4|�dddddgfg�|�dddddgfg�dS)	Nz<a width="100%"cellspacing=0>rrU�r�z100%�Zcellspacing�0z<a id="foo"class="bar">)�idrl��classr�rGr;r
r
r�test_adjacent_attributes�s����z+AttributesTestCase.test_adjacent_attributescCs|�ddddgfg�dS)Nz<a v=>rrU)r�rfrGr;r
r
r�test_missing_attribute_value�s�z/AttributesTestCase.test_missing_attribute_valuecCs|�ddddgfg�dS)Nz-<a href=javascript:popup('/popup/help.html')>rrU)r�z$javascript:popup('/popup/help.html')rGr;r
r
r�test_javascript_attribute_value�s
��z2AttributesTestCase.test_javascript_attribute_valuecCs|�ddddgfddg�dS)Nz-<a href='http://www.example.org/">;'>spam</a>rrU)r�zhttp://www.example.org/">;)rZspamrWrGr;r
r
r�test_end_tag_in_attribute_value�s���z2AttributesTestCase.test_end_tag_in_attribute_valuecCs�d}ddgfddddgfddgd�fdd	gfdd
dgfddd
gfddddgfdddgfdddddddgfdddgfddddg}|�||�dS)Nz�<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>rr�body)ZbgcolorZd0ca90)r�Z181008�table)r�)Zcellpaddingrnr��trZtd)Zalign�leftZfont)�sizez-1)rz- rU)r�z/rabota/r�)r��en)rz software-and-ir�rW)r�z/1/)rz library)rr�rGr�r
r
r�test_with_unquoted_attributes�s"�

�z0AttributesTestCase.test_with_unquoted_attributescCs�d}dddgfddddgfddddgfddgd	�fdddd
gfddddgfddd
dgfddddgfddddgfg	}|�||�dS)Nz�<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">rrQ)r�zbar,baz=asdr�)z,baz�asd)r�zbar,)�bazzasd,)r�r�)r�r�r�r�)r�z,bar)r�z,asd)r�z,"bar")r�z,"asd")z,classr�)zclass,r�)zbaz,r�rGr�r
r
r�test_comma_between_attributes�s
�z0AttributesTestCase.test_comma_between_attributescCs|�ddddgfg�dS)Nz<form action=bogus|&#()value>rZform)�actionzbogus|&#()valuerGr;r
r
r�-test_weird_chars_in_unquoted_attribute_valuess
��z@AttributesTestCase.test_weird_chars_in_unquoted_attribute_valuescsfGdd�dt��G�fdd�dtjj�}|�}|����|�d�Wd�n1sX0YdS)Nc@seZdZdS)zWAttributesTestCase.test_invalid_keyword_error_exception.<locals>.InvalidMarkupExceptionN)r.r/r0r
r
r
r�InvalidMarkupExceptionsr�cseZdZ�fdd�ZdS)zMAttributesTestCase.test_invalid_keyword_error_exception.<locals>.MyHTMLParsercs�|��dSrr
�r
�message�r�r
r�errorszSAttributesTestCase.test_invalid_keyword_error_exception.<locals>.MyHTMLParser.errorN�r.r/r0r�r
r�r
r�MyHTMLParsersr��<![invalid>)�	ExceptionrrrZassertRaisesr=�r
r�rr
r�r�$test_invalid_keyword_error_exceptions
z7AttributesTestCase.test_invalid_keyword_error_exceptioncCs0Gdd�dtjj�}|�}|�|�d�d�dS)Nc@seZdZdd�ZdS)zHAttributesTestCase.test_invalid_keyword_error_pass.<locals>.MyHTMLParsercSsdSrr
r�r
r
rr�&szNAttributesTestCase.test_invalid_keyword_error_pass.<locals>.MyHTMLParser.errorNr�r
r
r
rr�%sr�r�)rrrr�r=r�r
r
r�test_invalid_keyword_error_pass"sz2AttributesTestCase.test_invalid_keyword_error_passN)r.r/r0r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r
r
r
rr�Zs&	
	r��__main__)Zhtml.parserrr@Zunittestrrrr1r3ZTestCaser7rFr�r.�mainr
r
r
r�<module>s9	tS

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists