HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/test/__pycache__/test_htmlparser.cpython-310.opt-2.pyc
o

�i���@s�	ddlZddlZddlZGdd�dejj�ZGdd�de�ZGdd�de�ZGdd	�d	ej	�Z
Gd
d�de
�ZGdd
�d
e
�Ze
dkrJe��dSdS)�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
�1/usr/local/lib/python3.10/test/test_htmlparser.pyr	
s
 zEventCollector.__init__cCsjg}d}|jD](}|d}||krdkr(nnd|dd|df|d<n|�|�|}q||_|S)Nr�data����)rr)r
�LZprevtype�event�typer
r
r�
get_eventss

zEventCollector.get_eventscC�|�d||f�dS)N�starttag�r�r
�tagZattrsr
r
r�handle_starttag �zEventCollector.handle_starttagcCr)N�startendtagrrr
r
r�handle_startendtag#rz!EventCollector.handle_startendtagcC�|�d|f�dS)N�endtagr)r
rr
r
r�
handle_endtag&�zEventCollector.handle_endtagcCr)N�commentr�r
rr
r
r�handle_comment+r"zEventCollector.handle_commentcCr)N�charrefrr$r
r
r�handle_charref.r"zEventCollector.handle_charrefcCr)Nrrr$r
r
r�handle_data1r"zEventCollector.handle_datacCr)N�declrr$r
r
r�handle_decl4r"zEventCollector.handle_declcCr)N�	entityrefrr$r
r
r�handle_entityref7r"zEventCollector.handle_entityrefcCr)N�pirr$r
r
r�	handle_pi:r"zEventCollector.handle_picCr)N�unknown declr)r
r)r
r
r�unknown_decl=r"zEventCollector.unknown_declN)�__name__�
__module__�__qualname__r	rrrr!r%r'r(r*r,r.r0r
r
r
rrsrc@�eZdZdd�ZdS)�EventCollectorExtracCs$t�|||�|�d|��f�dS)N�
starttag_text)rrrZget_starttag_textrr
r
rrCsz#EventCollectorExtra.handle_starttagN)r1r2r3rr
r
r
rr5Asr5c@seZdZdd�Zdd�ZdS)�EventCollectorCharrefscC�|�d�dS�Nz6This should never be called with convert_charrefs=True��failr$r
r
rr'J�z%EventCollectorCharrefs.handle_charrefcCr8r9r:r$r
r
rr,Mr<z'EventCollectorCharrefs.handle_entityrefN)r1r2r3r'r,r
r
r
rr7Hsr7c@s&eZdZdd�Zddd�Zdd�ZdS)	�TestCaseBasecCs
tdd�S�NF��convert_charrefs)r�r
r
r
r�
get_collectorSs
zTestCaseBase.get_collectorNcCsv|dur|��}|}|D]}|�|�q|��|��}||kr9|�dt|�dt�|�dt�|��dSdS)Nz6received events did not match expected events
Source:
z
Expected:
z
Received:
)rB�feed�closerr;�repr�pprintZpformat)r
�sourceZexpected_events�	collectorr�srr
r
r�
_run_checkVs(����
��zTestCaseBase._run_checkcCs|�||tdd��dSr>)rJr5)r
rGrr
r
r�_run_check_extrads�zTestCaseBase._run_check_extrar)r1r2r3rBrJrKr
r
r
rr=Qs
r=c@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 ?�rJrAr
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�r rrMrAr
r
r�test_simple_htmlss(��z#HTMLParserTestCase.test_simple_htmlcCs6|�dddgfddg�|�dgddgfddg�dS)	Nz
<p>&#bad;</p>r�p)rz&#bad;�r rUz<div>&#bad;</div>�div�r rWrMrAr
r
r�test_malformatted_charref�s�
�z,HTMLParserTestCase.test_malformatted_charrefcCs|�dddg�dS)Nz&entityref foo)r+r+)rz foorMrAr
r
r�test_unclosed_entityref�s
�z*HTMLParserTestCase.test_unclosed_entityrefcCs$|�dddgfddgfddg�dS)Nz<a><b></a></b>r�a�b�r r[�r r\rMrAr
r
r�test_bad_nesting�s
�z#HTMLParserTestCase.test_bad_nestingcC�|�ddg�dS)N�#this text & contains & ampersands &)rrarMrAr
r
r�test_bare_ampersands��
�z'HTMLParserTestCase.test_bare_ampersandscCr`)N�.this < text > contains < bare>pointy< brackets)rrdrMrAr
r
r�test_bare_pointy_brackets�rcz,HTMLParserTestCase.test_bare_pointy_bracketscCs0|�ddddgfg�|�ddddgfg�dS)N�	<a b='<'>rr[�r\�<�	<a b='>'>�r\�>rMrAr
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)*Nrr[rgrfz<a zb='<'>z<a bz='<'>z<a b=z'<'>z<a b='<z'>z<a b='<'rkrjrizb='>'>z='>'>z'>'>z<a b='>z<a b='>')r#�abc�z
<!--abc-->rhz	!--abc-->�<!z--abc-->z<!-z-abc-->z<!--zabc-->z<!--azbc-->z<!--abzc-->z<!--abcz-->z<!--abc-z->z	<!--abc--rM�r
�outputr
r
r�test_buffer_artefacts�s4z(HTMLParserTestCase.test_buffer_artefactscCs0gd�}|D]}|�d|dd|fg�qdS)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 rM)r
ZdtdsZdtdr
r
r�test_valid_doctypes�s
��z&HTMLParserTestCase.test_valid_doctypescCsN|�dddgfg�|�dddgfdg�|�dddgfddd	gfdg�dS)
Nz<p/>rrUz<p></p>rrVz<p><img src='foo' /></p>rQ)rR�foorMrAr
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�2r6)rK)r
rIr
r
r�test_get_starttag_texts

�z)HTMLParserTestCase.test_get_starttag_textc	Cs^gd�}gd�}|D]"}|D]}|��}dj||d�}|�|d|gfd|fd|fg�qq
dS)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�formatrJ)r
�contents�elementsr}r|�
element_lowerrIr
r
r�test_cdata_content	s����z%HTMLParserTestCase.test_cdata_contentcCsfGdd�dt�}d}dD]$}|����}dj||d�}|j|d|gfd|fd	|fg|d
d�d�qdS)
Nc@r4)zBHTMLParserTestCase.test_cdata_with_closing_tags.<locals>.CollectorcSs|jSr)rrAr
r
rr.szMHTMLParserTestCase.test_cdata_with_closing_tags.<locals>.Collector.get_eventsN)r1r2r3rr
r
r
r�	Collector-sr�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}>r{rrr Fr?�rH)rr~�striprrJ)r
r�r}r|r�rIr
r
r�test_cdata_with_closing_tags(s����z/HTMLParserTestCase.test_cdata_with_closing_tagscC�d}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#rn)r#z--I have many hyphens--)r#z I have a > in the middle )r#z and I have -- in the middle! rM�r
r�expectedr
r
r�
test_comments>sz HTMLParserTestCase.test_commentscCr�)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]rMr�r
r
r�
test_condcomsOsz HTMLParserTestCase.test_condcomsc
CsBdd�}|�|�j�gd�}dddgfddg}|D]}|jd	�|�||�d
�qdddgd�fdddg}|D]}|jd
�|�||�d
�q7|D],}d�|gd�}dddgfd|fddddgfd|fddg	}|jd�||�||�d
�qHd}tdt|��D]}|j|d|�d|d|�fg|�d
�q~|jddg|�d
�dS)NcSst�Sr)r7r
r
r
r�<lambda>Zsz:HTMLParserTestCase.test_convert_charrefs.<locals>.<lambda>)z&quot;z&#34;z&#x22;z&quotz&#34z&#x22rr[)�hrefzfoo"zar)rza"zr]z<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�ryr)r ryrz)r rzz/{1}<script>{0}</script>{1}<style>{0}</style>{1}z&quo &# &#xr�no charrefs here)rr�)Z
assertTruer@rJr�join�range�len)r
rHZcharrefsr�r&�textrr�r
r
r�test_convert_charrefsXsN
�������

�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+r[)rrhzbc<)r[NrS)rz
<img src="URL>)r#z/img)r zhtml<rMrAr
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>)r r�ro)rro�<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  />rMrAr
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"/>rr[)rt�varzj<img width=902 height=250px src="/sites/default/files/images/homepage/foo.jpg" /*what am I doing here*/ />rQ))�widthZ902)ZheightZ250px)rRz,/sites/default/files/images/homepage/foo.jpg)z*whatN)�amN)�iN)ZdoingN)zhere*Nz9<a / /foo/ / /=/ / /bar/ / /><a / /foo/ / /=/ / /bar/ / >))rtN)�=N)�barNrzD<meta><meta / ><meta // ><meta / / ><meta/><meta /><meta //><meta//>�metarMr�r
r
r�test_slashes_in_starttag�s$���z+HTMLParserTestCase.test_slashes_in_starttagcCr`)Nz<!DOCTYPE foo $ >)r)zDOCTYPE foo $ rMrAr
r
r�test_declaration_junk_chars�r"z.HTMLParserTestCase.test_declaration_junk_charscCr`)Nz"<!spacer type="block" height="25">)r#zspacer type="block" height="25"rMrAr
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)r zlabel<rX)r#z<h4)r ZlirMr�r
r
r�test_invalid_end_tags�s�z(HTMLParserTestCase.test_invalid_end_tagscCs&d}ddgfdddg}|�||�dS)Nz(<b>This</b attr=">"> confuses the parserrr\)rZThisr^)rz"> confuses the parserrMr�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>rrW�rzrnr\)rzThe r[)r�Zsome_url)rZrainr]�r� rr�)rz in �span)rZSpain�r r�r^rXz><div style="", foo = "bar" ><b>The <a href="some_url">rain</a>)r���,N)rtr�rMr�r
r
r�$test_correct_detection_of_start_tags�s4

�
�z7HTMLParserTestCase.test_correct_detection_of_start_tagscCsFddgfddgfdgd�fddd	gfg}|D]
\}}|�||�qdS)
N�a&)rr�za&b)r�abza&b )�rr[�r+r\r�za&b;r�r�rM)r
rrr�r
r
r�test_EOF_in_charrefs

��z&HTMLParserTestCase.test_EOF_in_charrefcCr�)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 !!!rMr�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 6rQ)rRzfirefox.png)r/zif !ie 6rr\)rrtr^)r/zif (!IE)|(lt IE 9))rRzmammoth.bmprMr�r
r
r�test_broken_condcoms,s(


�z'HTMLParserTestCase.test_broken_condcomscCs8tdd�}|�d�|�|��dddgfddd	g�dS)
NTr?zfoo <a>link</a> bar &amp; baz)rzfoo rr[)rr�r])rz
 bar & baz)rrCZassertEqualr)r
rr
r
r�"test_convert_charrefs_dropped_textMs

��z5HTMLParserTestCase.test_convert_charrefs_dropped_textN) r1r2r3rNrTrYrZr_rbrerlrrrsrurxr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r
r
r
rrLis< 
	)
!!rLc@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)$�AttributesTestCasecCsDddgd�fg}|�d|�|�d|�|�d|�|�d|�dS)Nrr[))r\�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>rMrpr
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
'>rr[))r\zxxx
	xxx)r�zyyy	
yyy)r�z	xyz
z
<a b='' c="">)r\rn)r�rnz<e a=rgb(1,2,3)>r�)r[z
rgb(1,2,3)z<a href=mailto:xyz@example.com>)r�zmailto:xyz@example.comrMrAr
r
r�test_attr_valueses����z#AttributesTestCase.test_attr_valuescCsL|�dddddgfg�|�ddddd	gfg�|�d
dddd	gfg�dS)Nu!<img src=/foo/bar.png alt=中文>rrQ)rRz/foo/bar.png)Zaltu中文u+<a title='テスト' href='テスト.html'>r[)�titleu	テスト)r�uテスト.htmlu+<a title="テスト" href="テスト.html">rMrAr
r
r�test_attr_nonasciits$������z%AttributesTestCase.test_attr_nonasciicC�|�ddddgfg�dS)Nz!<a b='&amp;&gt;&lt;&quot;&apos;'>rr[)r\z&><"'rMrAr
r
r�test_attr_entity_replacement���z/AttributesTestCase.test_attr_entity_replacementcCs|�dddgd�fg�dS)Nz<a a.b='v' c:d=v e-f=v>rr[))za.br�)zc:dr�)ze-fr�rMrAr
r
r�test_attr_funky_names�s�z(AttributesTestCase.test_attr_funky_namescCr�)Nz0<html foo='&euro;&amp;&#97;&#x61;&unsupported;'>rr)rtu€&aa&unsupported;rMrAr
r
r�test_entityrefs_in_attributes�r�z0AttributesTestCase.test_entityrefs_in_attributescCs.|�ddddgfdddgfdddgfg�dS)	Nz<a $><b $=%><c \=/>rr[)r�Nr\)r��%r�)�\�/rMrAr
r
r�test_attr_funky_names2�s


��z)AttributesTestCase.test_attr_funky_names2cCs\dD])}|�d|dddgfg�|�d|dddgfg�|�d|dddgfg�qdS)N)�&z&amp;z&#38;z&#x26;z
<a href="%s">rr[)r�r�z
<a href='%s'>z<a href=%s>rM)r
rPr
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>rr[)r�ztest'style='color:red;bad1')rztest - bad1r])r�ztest'+style='color:red;ba2')rztest - bad2)r�utest' style='color:red;bad3')rztest - bad3)r�utest' style='color:red;bad4')rztest - bad4rMr�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�rn)zo""N)r r�z<x><y z="""" /></x>)z""NrMrAr
r
r�"test_malformed_adjacent_attributes�s����z5AttributesTestCase.test_malformed_adjacent_attributescCs4|�dddddgfg�|�dddddgfg�dS)	Nz<a width="100%"cellspacing=0>rr[�r�z100%�Zcellspacing�0z<a id="foo"class="bar">)�idrt��classr�rMrAr
r
r�test_adjacent_attributes�s����z+AttributesTestCase.test_adjacent_attributescCr�)Nz<a v=>rr[)r�rnrMrAr
r
r�test_missing_attribute_value�s�z/AttributesTestCase.test_missing_attribute_valuecCr�)Nz-<a href=javascript:popup('/popup/help.html')>rr[)r�z$javascript:popup('/popup/help.html')rMrAr
r
r�test_javascript_attribute_value�s
��z2AttributesTestCase.test_javascript_attribute_valuecCs|�ddddgfddg�dS)Nz-<a href='http://www.example.org/">;'>spam</a>rr[)r�zhttp://www.example.org/">;)rZspamr]rMrAr
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�)Zcellpaddingrvr��trZtd)Zalign�leftZfont)�sizez-1)rz- r[)r�z/rabota/r�)r��en)rz software-and-ir�r])r�z/1/)rz library)r r�rMr�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">rrW)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�rMr�r
r
r�test_comma_between_attributes�s
�z0AttributesTestCase.test_comma_between_attributescCr�)Nz<form action=bogus|&#()value>rZform)�actionzbogus|&#()valuerMrAr
r
r�-test_weird_chars_in_unquoted_attribute_valuess
�
�z@AttributesTestCase.test_weird_chars_in_unquoted_attribute_valuesN)r1r2r3r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r
r
r
rr�Zs$	
	r��__main__)Zhtml.parserrrFZunittestrrrr5r7ZTestCaser=rLr�r1�mainr
r
r
r�<module>s"9	t=�