3 kS@s|ddlZddlZddlZddlmZmZmZddlmZGdddej Z Gdddej Z dd Z e d krxejd d dS) N)Markupescape escape_silent) text_typec@seZdZddZddZddZddZd d Zd d Zd dZ ddZ e j d"krZddZ ddZddZddZddZddZdd Zd!S)#MarkupTestCasecCsd}td}dS)Nz?zusername)r)selfZunsafeZsafer/usr/lib64/python3.6/tests.py test_adding szMarkupTestCase.test_addingcCsdS)Nr)rrrr test_string_interpolations z(MarkupTestCase.test_string_interpolationcCs td}dS)Nfoo)r)rxrrr test_type_behaviorsz!MarkupTestCase.test_type_behaviorcCsGdddt}dS)Nc@s eZdZddZddZeZdS)z-MarkupTestCase.test_html_interop..FoocSsdS)Nzawesomer)rrrr __html__'sz6MarkupTestCase.test_html_interop..Foo.__html__cSsdS)Nawesomer)rrrr __unicode__)sz9MarkupTestCase.test_html_interop..Foo.__unicode__N)__name__ __module__ __qualname__rr__str__rrrr Foo&sr)object)rrrrr test_html_interop$sz MarkupTestCase.test_html_interopcCs|jtddtddS)Nz%s:%sz <foo>:<bar>)rr) assertEqualr)rrrr test_tuple_interpol0s z"MarkupTestCase.test_tuple_interpolcCs>|jtddditd|jtddddtddS) Nz%(foo)sr zz<foo>z%(foo)s:%(bar)sz)r barz <foo>:<bar>)rr)rrrr test_dict_interpol6s   z!MarkupTestCase.test_dict_interpolcCsdS)Nr)rrrr test_escaping?szMarkupTestCase.test_escapingc Csxtdddftdddftddd ftd jd ddftdjdddigdftdjddtdigdffD]\}}qvWdS)Nz%igQ @3z%.2fgn! @z3.14z%s %s %s<{>z < 123 >z{awesome}z )rz<awesome>z {0[1][bar]}rrzz <bar/>)r!r"r#)rformat)ractualZexpectedrrr test_formattingEszMarkupTestCase.test_formattingcCstdjd}dS)Nz{}r)rr$)rZ formattedrrr test_formatting_emptyTsz$MarkupTestCase.test_formatting_emptycCs$Gdddt}Gdddt}dS)Nc@seZdZddZdS)z:MarkupTestCase.test_custom_formatting..HasHTMLOnlycSstdS)Nz)r)rrrr rZszCMarkupTestCase.test_custom_formatting..HasHTMLOnly.__html__N)rrrrrrrr HasHTMLOnlyYsr*c@seZdZddZddZdS)z?MarkupTestCase.test_custom_formatting..HasHTMLAndFormatcSstdS)Nz)r)rrrr r^szHMarkupTestCase.test_custom_formatting..HasHTMLAndFormat.__html__cSstdS)Nz)r)rspecrrr __html_format__`szOMarkupTestCase.test_custom_formatting..HasHTMLAndFormat.__html_format__N)rrrrr,rrrr HasHTMLAndFormat]sr-)r)rr*r-rrr test_custom_formattingXsz%MarkupTestCase.test_custom_formattingcCsGdddt}|dd}dS)Nc@s$eZdZddZddZddZdS)z;MarkupTestCase.test_complex_custom_formatting..UsercSs||_||_dS)N)idusername)rr/r0rrr __init__hszDMarkupTestCase.test_complex_custom_formatting..User.__init__cSs2|dkrtdj|j|jS|r*td|jS)Nlinkz{1}zInvalid format spec)rr$r/r ValueError)r format_specrrr r,ks zKMarkupTestCase.test_complex_custom_formatting..User.__html_format__cSstdj|jS)Nz{0})rr$r0)rrrr rtszDMarkupTestCase.test_complex_custom_formatting..User.__html__N)rrrr1r,rrrrr Usergs r5r )r)rr5userrrr test_complex_custom_formattingfs z-MarkupTestCase.test_complex_custom_formattingcCs&ddl}x|jD]}t||qWdS)Nr) markupsafe__all__getattr)rZmarkupitemrrr test_all_set{s zMarkupTestCase.test_all_setcCsdS)Nr)rrrr test_escape_silentsz!MarkupTestCase.test_escape_silentcCsd|jtdjtdtdg|jtdjtdtdg|jtdjtdtdgdS)Nza babza b)rrsplitrsplit splitlines)rrrr test_splittings  zMarkupTestCase.test_splittingcCs|jtddtddS)Nr?Zaaa)rr)rrrr test_mulszMarkupTestCase.test_mulN)r'r()rrrr r rrrrrr&sys version_infor)r.r8r=r>rDrFrrrr r s     rc@seZdZddZdS)MarkupLeakTestCasecCs`t}xTtdD]H}x0tdD]$}tdtdtdtdqW|jttjqWdS)Nir z)setrangeraddlengcZ get_objects)rZcountscountr<rrr test_markup_leakss z$MarkupLeakTestCase.test_markup_leaksN)rrrrQrrrr rIsrIcCs6tj}|jtjtttds2|jtjt|S)NZ func_code)unittestZ TestSuiteZaddTestZ makeSuiterhasattrrrI)suiterrr rTs  rT__main__)Z defaultTest)rOrGrRr9rrrZmarkupsafe._compatrZTestCaserrIrTrmainrrrr s