Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /opt/cppython/lib/python3.8/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : //opt/cppython/lib/python3.8/test/__pycache__/test_htmlparser.cpython-38.opt-2.pyc
U

>��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)�EventCollectorcOs*g|_|jj|_tjjj|f|�|�dS�N)�events�append�html�parser�
HTMLParser�__init__)�self�args�kw�r
�3/opt/cppython/lib/python3.8/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
�tagZattrsr
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.r/rr
r
r
rr0Asr0c@seZdZdd�Zdd�ZdS)�EventCollectorCharrefscCs|�d�dS�Nz6This should never be called with convert_charrefs=True��failr r
r
rr#Jsz%EventCollectorCharrefs.handle_charrefcCs|�d�dSr3r4r r
r
rr(Msz'EventCollectorCharrefs.handle_entityrefN)r-r.r/r#r(r
r
r
rr2Hsr2c@s&eZdZdd�Zddd�Zdd�ZdS)	�TestCaseBasecCs
tdd�S�NF��convert_charrefs)r�r
r
r
r�
get_collectorSszTestCaseBase.get_collectorNcCsr|dkr|��}|}|D]}|�|�q|��|��}||krn|�dt|�dt�|�dt�|��dS)Nz6received events did not match expected events
Source:
z
Expected:
z
Received:
)r;�feed�closerr5�repr�pprintZpformat)r
�sourceZexpected_events�	collectorr�srr
r
r�
_run_checkVs&�����zTestCaseBase._run_checkcCs|�||tdd��dSr7)rCr0)r
r@rr
r
r�_run_check_extrads�zTestCaseBase._run_check_extra)N)r-r.r/r;rCrDr
r
r
rr6Qs
r6c@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;d<�Z d=S)>�HTMLParserTestCasecCs |�ddg�|�ddg�dS)Nz<?processing instruction>)r)zprocessing instructionz<?processing instruction ?>)r)zprocessing instruction ?�rCr: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)rz4comment1a
-></foo><bar>&lt;<?pi?></foo<bar
comment1b�img)�srcZBar)ZismapN)rzsample
text
)r"Zx201C)rzcomment2a-- --comment2b�rrrFr:r
r
r�test_simple_htmlss(��z#HTMLParserTestCase.test_simple_htmlcCs6|�dddgfddg�|�dgddgfddg�dS)	Nz
<p>&#bad;</p>r�p)rz&#bad;�rrNz<div>&#bad;</div>�div�rrPrFr:r
r
r�test_malformatted_charref�s��z,HTMLParserTestCase.test_malformatted_charrefcCs|�dddg�dS)Nz&entityref foo)r'r')rz foorFr:r
r
r�test_unclosed_entityref�s�z*HTMLParserTestCase.test_unclosed_entityrefcCs$|�dddgfddgfddg�dS)Nz<a><b></a></b>r�a�b�rrT�rrUrFr:r
r
r�test_bad_nesting�s�z#HTMLParserTestCase.test_bad_nestingcCs|�ddg�dS)N�#this text & contains & ampersands &)rrYrFr:r
r
r�test_bare_ampersands�s�z'HTMLParserTestCase.test_bare_ampersandscCs|�ddg�dS)N�.this < text > contains < bare>pointy< brackets)rr[rFr:r
r
r�test_bare_pointy_brackets�s�z,HTMLParserTestCase.test_bare_pointy_bracketscCs0|�ddddgfg�|�ddddgfg�dS)N�	<a b='<'>rrT�rU�<�	<a b='>'>�rU�>rFr: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)*NrrTr^r]z<a zb='<'>z<a bz='<'>z<a b=z'<'>z<a b='<z'>z<a b='<'rbrar`zb='>'>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--rF�r
�outputr
r
r�test_buffer_artefacts�s4z(HTMLParserTestCase.test_buffer_artefactsc
Cs@ddddddddd	d
g
}|D]}|�d|dd
|fg�qdS)NZHTMLzOHTML 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 rF)r
ZdtdsZdtdr
r
r�test_valid_doctypes�s�
�z&HTMLParserTestCase.test_valid_doctypescCsN|�dddgfg�|�dddgfdg�|�dddgfddd	gfdg�dS)
Nz<p/>rrNz<p></p>rrOz<p><img src='foo' /></p>rJ)rK�foorFr: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�2r1)rD)r
rBr
r
r�test_get_starttag_texts
�z)HTMLParserTestCase.test_get_starttag_textcCsxddddddddd	d
dg}dd
ddddg}|D]D}|D]:}|��}dj||d�}|�|d|gfd|fd|fg�q6q.dS)Nz*<!-- 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�formatrC)r
�contents�elementsrtrs�
element_lowerrBr
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.r/rr
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}>rrrrrFr8�rA)rru�striprvrC)r
r{rtrsryrBr
r
r�test_cdata_with_closing_tags(s���z/HTMLParserTestCase.test_cdata_with_closing_tagscCs&d}dddddddg}|�||�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! -->)rz I'm a valid comment )rzme too!)rz--�rre)rz--I have many hyphens--)rz I have a > in the middle )rz and I have -- in the middle! rF�r
r�expectedr
r
r�
test_comments>s�z HTMLParserTestCase.test_commentscCsd}dddg}|�||�dS)Nzs<!--[if IE & !(lte IE 8)]>aren't<![endif]--><!--[if IE 8]>condcoms<![endif]--><!--[if lte IE 7]>pretty?<![endif]-->)rz%[if IE & !(lte IE 8)]>aren't<![endif])rzf IE 8]>condcoms<![endif])rz[if lte IE 7]>pretty?<![endif]rFr�r
r
r�
test_condcomsOs�z HTMLParserTestCase.test_condcomsc
CsNdd�}|�|�j�ddddddg}d	d
dgfdd
g}|D]}|jd�|�||�d�q<dd	d
dddgfdd
dg}|D]}|jd�|�||�d�qx|D]X}d�|gd�}dd	dgfd|fddd	dgfd|fddg	}|jd�||�||�d�q�d}tdt|��D].}|j|d|�d|d|�fg|�d��q|jdd g|�d�dS)!NcSst�Sr)r2r
r
r
r�<lambda>Z�z:HTMLParserTestCase.test_convert_charrefs.<locals>.<lambda>z&quot;z&#34;z&#x22;z&quotz&#34z&#x22rrT)�hrefzfoo"zar)rza"zrVz<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�rpr)rrprq)rrqz/{1}<script>{0}</script>{1}<style>{0}</style>{1}z&quo &# &#xr�no charrefs here)rr�)Z
assertTruer9rCrv�join�range�len)r
rAZcharrefsr�r"�textrr�r
r
r�test_convert_charrefsXsh
���������

�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'rT)rr_zbc<)rTNrL)rz
<img src="URL>)rz/img)rzhtml<rFr: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�rf)rrf�<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  />rFr:r
r
r�test_starttag_junk_chars�s"z+HTMLParserTestCase.test_starttag_junk_charsc
Cs�|�ddddgfg�d}ddddd	d
ddd
dgfg}|�||�d}dddddgfdddddgfg}|�||�d}ddgfddgfddgfddgfddgfddgfddgfddgfg}|�||�dS)Nz<a foo="var"/>rrT)rk�varzj<img width=902 height=250px src="/sites/default/files/images/homepage/foo.jpg" /*what am I doing here*/ />rJ)�widthZ902)ZheightZ250px)rKz,/sites/default/files/images/homepage/foo.jpg)z*whatN)�amN)�iN)ZdoingN)zhere*Nz9<a / /foo/ / /=/ / /bar/ / /><a / /foo/ / /=/ / /bar/ / >)rkN)�=N)�barNrzD<meta><meta / ><meta // ><meta / / ><meta/><meta /><meta //><meta//>�metarFr�r
r
r�test_slashes_in_starttag�s<����z+HTMLParserTestCase.test_slashes_in_starttagcCs|�ddg�dS)Nz<!DOCTYPE foo $ >)r%zDOCTYPE foo $ rFr:r
r
r�test_declaration_junk_chars�sz.HTMLParserTestCase.test_declaration_junk_charscCs|�ddg�dS)Nz"<!spacer type="block" height="25">)rzspacer type="block" height="25"rFr: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<rQ)rz<h4)rZlirFr�r
r
r�test_invalid_end_tags�s�z(HTMLParserTestCase.test_invalid_end_tagscCs&d}ddgfdddg}|�||�dS)Nz(<b>This</b attr=">"> confuses the parserrrU)rZThisrW)rz"> confuses the parserrFr�r
r
r�test_broken_invalid_end_tag�s�z.HTMLParserTestCase.test_broken_invalid_end_tagcCs�d}dddgfddgfddddgfd	d
ddd
gfdddgfddddg}|�||�d}dddddgfddgfddddgfd	d
g}|�||�dS)Nz[<div style=""    ><b>The <a href="some_url">rain</a> <br /> in <span>Spain</span></b></div>rrP)rqrerU)rzThe rT)r�Zsome_url)rZrainrV�r� rr�)rz in �span)rZSpain�rr�rWrQz><div style="", foo = "bar" ><b>The <a href="some_url">rain</a>��,N)rkr�rFr�r
r
r�$test_correct_detection_of_start_tags�s4

�
�z7HTMLParserTestCase.test_correct_detection_of_start_tagscCsHddgfddgfddddgfd	ddgfg}|D]\}}|�||�q.dS)
N�a&)rr�za&b)r�abza&b )rrT)r'rUr�za&b;rF)r
rrr�r
r
r�test_EOF_in_charrefs
�z&HTMLParserTestCase.test_EOF_in_charrefc	CsHddlm}|��}|�t�� d}|�|�|�||��W5QRXdS)Nr)�unescapez%&quot;&#34;&#x22;&quot&#34&#x22&#bad;)rr�r;ZassertWarns�DeprecationWarning�assertEqual)r
r�rNrBr
r
r�test_unescape_methods
z'HTMLParserTestCase.test_unescape_methodcCs$d}ddddddg}|�||�dS)Nz�<! not really a comment ><! not a comment either --><! -- close enough --><!><!<-- this was an empty comment><!!! another bogus comment !!!>)rz not really a comment )rz not a comment either --)rz -- close enough --r)rz<-- this was an empty comment)rz!! another bogus comment !!!rFr�r
r
r�test_broken_comments#s�z'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 6rJ)rKzfirefox.png)r+zif !ie 6rrU)rrkrW)r+zif (!IE)|(lt IE 9))rKzmammoth.bmprFr�r
r
r�test_broken_condcoms3s(


�z'HTMLParserTestCase.test_broken_condcomscCs8tdd�}|�d�|�|��dddgfddd	g�dS)
NTr8zfoo <a>link</a> bar &amp; baz)rzfoo rrT)rr�rV)rz
 bar & baz)rr<r�r)r
rr
r
r�"test_convert_charrefs_dropped_textTs

��z5HTMLParserTestCase.test_convert_charrefs_dropped_textN)!r-r.r/rGrMrRrSrXrZr\rcrirjrlrorzr~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r
r
r
rrEis< 
	)
!!rEc@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#S)$�AttributesTestCasecCsHddddddgfg}|�d|�|�d|�|�d	|�|�d
|�dS)NrrT)rU�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>rFrgr
r
r�test_attr_syntaxcs�z#AttributesTestCase.test_attr_syntaxcCsb|�ddddddgfg�|�ddddd	gfg�|�d
dddgfg�|�d
dddgfg�dS)Nz'<a b='xxx
	xxx' c="yyy	
yyy" d='	xyz
'>rrT)rUzxxx
	xxx)r�zyyy	
yyy)r�z	xyz
z
<a b='' c="">)rUre)r�rez<e a=rgb(1,2,3)>r�)rTz
rgb(1,2,3)z<a href=mailto:xyz@example.com>)r�zmailto:xyz@example.comrFr:r
r
r�test_attr_valuesls �����z#AttributesTestCase.test_attr_valuescCsL|�dddddgfg�|�ddddd	gfg�|�d
dddd	gfg�dS)Nu!<img src=/foo/bar.png alt=中文>rrJ)rKz/foo/bar.png)Zaltu中文u+<a title='テスト' href='テスト.html'>rT)�titleu	テスト)r�uテスト.htmlu+<a title="テスト" href="テスト.html">rFr:r
r
r�test_attr_nonascii{s$������z%AttributesTestCase.test_attr_nonasciicCs|�ddddgfg�dS)Nz!<a b='&amp;&gt;&lt;&quot;&apos;'>rrT)rUz&><"'rFr:r
r
r�test_attr_entity_replacement�s�z/AttributesTestCase.test_attr_entity_replacementcCs|�ddddddgfg�dS)Nz<a a.b='v' c:d=v e-f=v>rrT)za.br�)zc:dr�)ze-fr�rFr: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)rku€&aa&unsupported;rFr:r
r
r�test_entityrefs_in_attributes�s�z0AttributesTestCase.test_entityrefs_in_attributescCs.|�ddddgfdddgfdddgfg�dS)	Nz<a $><b $=%><c \=/>rrT)r�NrU)r��%r�)�\�/rFr: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">rrT)r�r�z
<a href='%s'>z<a href=%s>rF)r
rIr
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>rrT)r�ztest'style='color:red;bad1')rztest - bad1rV)r�ztest'+style='color:red;ba2')rztest - bad2)r�utest' style='color:red;bad3')rztest - bad3)r�utest' style='color:red;bad4')rztest - bad4rFr�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�re)zo""N)rr�z<x><y z="""" /></x>)z""NrFr:r
r
r�"test_malformed_adjacent_attributes�s����z5AttributesTestCase.test_malformed_adjacent_attributescCs4|�dddddgfg�|�dddddgfg�dS)	Nz<a width="100%"cellspacing=0>rrT�r�z100%�Zcellspacing�0z<a id="foo"class="bar">)�idrk��classr�rFr:r
r
r�test_adjacent_attributes�s����z+AttributesTestCase.test_adjacent_attributescCs|�ddddgfg�dS)Nz<a v=>rrT)r�rerFr:r
r
r�test_missing_attribute_value�s�z/AttributesTestCase.test_missing_attribute_valuecCs|�ddddgfg�dS)Nz-<a href=javascript:popup('/popup/help.html')>rrT)r�z$javascript:popup('/popup/help.html')rFr:r
r
r�test_javascript_attribute_value�s
��z2AttributesTestCase.test_javascript_attribute_valuecCs|�ddddgfddg�dS)Nz-<a href='http://www.example.org/">;'>spam</a>rrT)r�zhttp://www.example.org/">;)rZspamrVrFr:r
r
r�test_end_tag_in_attribute_value�s���z2AttributesTestCase.test_end_tag_in_attribute_valuecCs�d}ddgfddddgfdddd	d
gfddgfddd
gfdddgfddddgfdddgfdddddddgfdddgfddddg}|�||�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>rrZbody)ZbgcolorZd0ca90)r�Z181008�tabler�)Zcellpaddingrmr��trZtd)Zalign�leftZfont)�sizez-1)rz- rT)r�z/rabota/r�)r��en)rz software-and-ir�rV)r�z/1/)rz library)rr�rFr�r
r
r�test_with_unquoted_attributes�s0�





�z0AttributesTestCase.test_with_unquoted_attributescCs�d}dddgfddddgfddddgfdddd	d
d	gfdddd	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">rrP)r�zbar,baz=asdr�)z,baz�asd)r�zbar,)�bazzasd,r�)r�r�)r�z,bar)r�z,asd)r�z,"bar")r�z,"asd")z,classr�)zclass,r�)zbaz,r�rFr�r
r
r�test_comma_between_attributes�s
��z0AttributesTestCase.test_comma_between_attributescCs|�ddddgfg�dS)Nz<form action=bogus|&#()value>rZform)�actionzbogus|&#()valuerFr:r
r
r�-test_weird_chars_in_unquoted_attribute_valuess
��z@AttributesTestCase.test_weird_chars_in_unquoted_attribute_valuesN)r-r.r/r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r
r
r
rr�as"	
	r��__main__)Zhtml.parserrr?Zunittestrrrr0r2ZTestCaser6rEr�r-�mainr
r
r
r�<module>s9	{=

F1le Man4ger