Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/site-packages/markupsafe/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/site-packages/markupsafe/__pycache__/tests.cpython-35.opt-1.pyc



��kS��@s�ddlZddlZddlZddlmZmZmZddlmZGdd�dej	�Z
Gdd�dej	�Zdd	�Ze
d
kr�ejdd	�dS)�N)�Markup�escape�
escape_silent)�	text_typec@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
ejd"kr�dd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!S)#�MarkupTestCasecCsd}td�}dS)Nz?<script type="application/x-some-script">alert("foo");</script>z<em>username</em>)r)�selfZunsafeZsafe�r�C/opt/alt/python35/lib64/python3.5/site-packages/markupsafe/tests.py�test_addingszMarkupTestCase.test_addingcCsdS)Nr)rrrr	�test_string_interpolations	z(MarkupTestCase.test_string_interpolationcCstd�}dS)N�foo)r)r�xrrr	�test_type_behaviorsz!MarkupTestCase.test_type_behaviorcCsGdd�dt�}dS)Nc@s.eZdZdd�Zdd�ZeZdS)z-MarkupTestCase.test_html_interop.<locals>.FoocSsdS)Nz<em>awesome</em>r)rrrr	�__html__'sz6MarkupTestCase.test_html_interop.<locals>.Foo.__html__cSsdS)N�awesomer)rrrr	�__unicode__)sz9MarkupTestCase.test_html_interop.<locals>.Foo.__unicode__N)�__name__�
__module__�__qualname__rr�__str__rrrr	�Foo&sr)�object)rrrrr	�test_html_interop$sz MarkupTestCase.test_html_interopcCs$|jtd�dtd��dS)Nz<em>%s:%s</em>�<foo>�<bar>z <em>&lt;foo&gt;:&lt;bar&gt;</em>)rr)�assertEqualr)rrrr	�test_tuple_interpol0sz"MarkupTestCase.test_tuple_interpolcCsV|jtd�dditd��|jtd�dddditd��dS)	Nz<em>%(foo)s</em>rz<foo>z<em>&lt;foo&gt;</em>z<em>%(foo)s:%(bar)s</em>�barz<bar>z <em>&lt;foo&gt;:&lt;bar&gt;</em>)rr)rrrr	�test_dict_interpol6s


z!MarkupTestCase.test_dict_interpolcCsdS)Nr)rrrr	�
test_escaping?szMarkupTestCase.test_escapingc
Cs�x�td�ddftd�ddftd�ddftd�jd
d�dftd�jdddig�dftd�jddtd�ig�dffD]\}}q�WdS)Nz%ig��Q�	@�3z%.2fgn��!	@z3.14z%s %s %s�<�{�>z
&lt; 123 &gt;z<em>{awesome}</em>rz	<awesome>z<em>&lt;awesome&gt;</em>z{0[1][bar]}rrz<bar/>z&lt;bar/&gt;)r!r"r#)r�format)rZactualZexpectedrrr	�test_formattingEs$zMarkupTestCase.test_formatting��cCstd�jd�}dS)Nz{}r)rr$)rZ	formattedrrr	�test_formatting_emptyTsz$MarkupTestCase.test_formatting_emptycCs0Gdd�dt�}Gdd�dt�}dS)Nc@seZdZdd�ZdS)z:MarkupTestCase.test_custom_formatting.<locals>.HasHTMLOnlycSs
td�S)Nz<foo>)r)rrrr	rZszCMarkupTestCase.test_custom_formatting.<locals>.HasHTMLOnly.__html__N)rrrrrrrr	�HasHTMLOnlyYsr)c@s(eZdZdd�Zdd�ZdS)z?MarkupTestCase.test_custom_formatting.<locals>.HasHTMLAndFormatcSs
td�S)Nz<foo>)r)rrrr	r^szHMarkupTestCase.test_custom_formatting.<locals>.HasHTMLAndFormat.__html__cSs
td�S)Nz<FORMAT>)r)r�specrrr	�__html_format__`szOMarkupTestCase.test_custom_formatting.<locals>.HasHTMLAndFormat.__html_format__N)rrrrr+rrrr	�HasHTMLAndFormat]sr,)r)rr)r,rrr	�test_custom_formattingXsz%MarkupTestCase.test_custom_formattingcCs)Gdd�dt�}|dd�}dS)Nc@s4eZdZdd�Zdd�Zdd�ZdS)z;MarkupTestCase.test_complex_custom_formatting.<locals>.UsercSs||_||_dS)N)�id�username)rr.r/rrr	�__init__hs	zDMarkupTestCase.test_complex_custom_formatting.<locals>.User.__init__cSsG|dkr+td�j|j|j��S|r=td��|j�S)N�linkz<a href="/user/{0}">{1}</a>zInvalid format spec)rr$r.r�
ValueError)r�format_specrrr	r+ks
zKMarkupTestCase.test_complex_custom_formatting.<locals>.User.__html_format__cSstd�j|j�S)Nz<span class=user>{0}</span>)rr$r/)rrrr	rtszDMarkupTestCase.test_complex_custom_formatting.<locals>.User.__html__N)rrrr0r+rrrrr	�Usergs	r4�r)r)rr4�userrrr	�test_complex_custom_formattingfsz-MarkupTestCase.test_complex_custom_formattingcCs1ddl}x|jD]}t||�qWdS)Nr)�
markupsafe�__all__�getattr)rZmarkup�itemrrr	�test_all_set{szMarkupTestCase.test_all_setcCsdS)Nr)rrrr	�test_escape_silent�sz!MarkupTestCase.test_escape_silentcCs�|jtd�j�td�td�g�|jtd�j�td�td�g�|jtd�j�td�td�g�dS)Nza b�a�bza
b)rr�split�rsplit�
splitlines)rrrr	�test_splitting�s			zMarkupTestCase.test_splittingcCs$|jtd�dtd��dS)Nr>�Zaaa)rr)rrrr	�test_mul�szMarkupTestCase.test_mulN)r&r')rrrr
rrrrrrr%�sys�version_infor(r-r7r<r=rCrErrrr	r	s 	rc@seZdZdd�ZdS)�MarkupLeakTestCasecCs|t�}xltd�D]^}x<td�D].}td�td�td�td�q)W|jttj���qWdS)N�i�rz<foo>)�set�ranger�add�len�gcZget_objects)rZcounts�countr;rrr	�test_markup_leaks�s	


z$MarkupLeakTestCase.test_markup_leaksN)rrrrPrrrr	rH�srHcCsKtj�}|jtjt��ttd�sG|jtjt��|S)NZ	func_code)�unittestZ	TestSuiteZaddTestZ	makeSuiter�hasattrrrH)�suiterrr	rS�s
rS�__main__ZdefaultTest)rNrFrQr8rrrZmarkupsafe._compatrZTestCaserrHrSr�mainrrrr	�<module>s�