۶eTc@sddlmZddlmZddlmZddlZddlZddlZddlZddl Z de j fdYZ de j fdYZ d e j fd YZ d e j fd YZd e j fdYZde j fdYZddZde j fdYZde fdYZde fdYZde j fdYZde fdYZde j fdYZedkre jndS(i(tTemplate(tCheetahWrapper(tDummyTransactionNtCommandLineTestcBseZdZRS(c Csd}x%|jddkr-tj}q Wtd|d}|j||jtj}|jdddd|gtj j |\}}t ||g}t ||}|S( Nt-is%s.tmpltwtcheetahtcompiles--quiets --nobackup( tfindttempfiletmktemptopentwritetcloseRtmaintostpathtsplitt loadModuletgetattr( tselftsourcet sourcefiletfdtwrapt module_patht module_nametmodulettemplate((sD/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Unicode.pytcreateAndCompiles   (t__name__t __module__R(((sD/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Unicode.pyR stJBQ_UTF8_Test1cBseZdZRS(cCsOtjdd}tjdd}|}||_d|_d|j_dS(NRs#Main file with |$v| $othersOther template with |$v|uUnicode String(RRtothertv(RtttotherTR!((sD/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Unicode.pytrunTests      (RRR%(((sD/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Unicode.pyR stJBQ_UTF8_Test2cBseZdZRS(cCsOtjdd}tjdd}|}||_d|_d|j_dS(NRs#Main file with |$v| $othersOther template with |$v|uUnicode String with eacute éuUnicode String(RRR!R"(RR#R$R!((sD/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Unicode.pyR%.s      (RRR%(((sD/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Unicode.pyR&-stJBQ_UTF8_Test3cBseZdZRS(cCsOtjdd}tjdd}|}||_d|_d|j_dS(NRs#Main file with |$v| $othersOther template with |$v|uUnicode String with eacute éuUnicode String and an eacute é(RRR!R"(RR#R$R!((sD/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Unicode.pyR%>s      (RRR%(((sD/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Unicode.pyR'=stJBQ_UTF8_Test4cBseZdZRS(cCstjdd}d|_dS(NRsI#encoding utf-8 Main file with |$v| and eacute in the template ésUnicode String(RRR"(RR#((sD/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Unicode.pyR%Ms   (RRR%(((sD/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Unicode.pyR(LstJBQ_UTF8_Test5cBseZdZRS(cCstjdd}d|_dS(NRsI#encoding utf-8 Main file with |$v| and eacute in the template éuUnicode String(RRR"(RR#((sD/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Unicode.pyR%Vs   (RRR%(((sD/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Unicode.pyR)UscCs|r nytj|}Wnetk rd}z7tj||\}}}tj||||}Wd|r}|jnXnX|S(N(tsystmodulestKeyErrortNonetimpt find_modulet load_moduleR (t moduleNameRtmodtfptpathnamet description((sD/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Unicode.pyR^s tJBQ_UTF8_Test6cBseZdZRS(cCs%d}tjd|}d|_dS(Nsu#encoding utf-8 #set $someUnicodeString = u"Bébé" Main file with |$v| and eacute in the template éRuUnicode String(RRR"(RRR#((sD/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Unicode.pyR%os (RRR%(((sD/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Unicode.pyR6nstJBQ_UTF8_Test7cBseZdZRS(cCs"d}|j|}d|_dS(Nsu#encoding utf-8 #set $someUnicodeString = u"Bébé" Main file with |$v| and eacute in the template éuUnicode String(RR"(RRR((sD/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Unicode.pyR%zs (RRR%(((sD/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Unicode.pyR7ystJBQ_UTF8_Test8cBseZdZdZRS(cCsAd}|j|}t|jd}|jd|dS(NsF#encoding utf-8 #set $someUnicodeString = u"Bébé" $someUnicodeStringsutf-8sBébé(Rtunicodetencodet assertEquals(RRRta((sD/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Unicode.pyttestStaticCompilescCs>d}td|}t|jd}|jd|dS(NsF#encoding utf-8 #set $someUnicodeString = u"Bébé" $someUnicodeStringRsutf-8sBébé(RR9R:R;(RRRR<((sD/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Unicode.pyttestDynamicCompiles(RRR=R>(((sD/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Unicode.pyR8s tEncodeUnicodeCompatTestcBseZdZdZRS(sx Taken initially from Red Hat's bugzilla #529332 https://bugzilla.redhat.com/show_bug.cgi?id=529332 cCs7tddd}d|_|j}t|}dS(Ns Foo ${var}tfiltert EncodeUnicodeu+Text with some non-ascii characters: åäö(Rtvartrespondtstr(RR#trc((sD/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Unicode.pyR%s    (RRt__doc__R%(((sD/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Unicode.pyR?stUnicode_in_SearchList_TestcBs#eZdZdZdZRS(cCs2d}|j|}|didd6g}dS(NsThis is $adjectivet searchListuneatt adjective(R(RRR((sD/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Unicode.pyttest_BasicASCIIscCs9d}|j|}|didd6dd6g}dS(NsThis is $foo $adjectiveRHtbartfoou$ยินดีต้อนรับRI(R(RRR((sD/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Unicode.pyt test_Thais cCs8d}d}|j|}|di|d6g}dS(Ns$ยินดีต้อนรับsThis is $adjectiveRHRI(R(Rtutf8RR((sD/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Unicode.pyttest_Thai_utf8s (RRRJRMRO(((sD/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Unicode.pyRGs  tInlineSpanishTestcBs#eZdZdZdZRS(cCs tt|jd|_dS(NsI Pagina del vendedor $header

Bienvenido $nombre.




Usted tiene $numpedidos_noconf pedidós sin confirmar.

Bodega tiene fecha para $numpedidos_bodega pedidos.
(tsuperRPtsetUpR(R((sD/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Unicode.pyRRscCs?|jtt|jdidd6dd6dd6dd6gdS(s0 Test a template lacking a proper #encoding tag RHttheadertnombretnumpedidos_bodegatnumpedidos_noconfN(tfailUnlessRaisestUnicodeDecodeErrorRR(R((sD/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Unicode.pyt test_failurescCsUd|j}t|didd6dd6dd6dd6g}|jt|dS( s- Test a template with a proper #encoding tag s#encoding utf-8 %sRHRSRTRURVRWN(RRt assertTrueR9(RR((sD/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Unicode.pyt test_successs  (RRRRRZR\(((sD/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Unicode.pyRPs  t__main__(tCheetah.TemplateRtCheetahRRR.RR*R tunittesttTestCaseRR R&R'R(R)R-RR6R7R8R?RGRPRR(((sD/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Unicode.pyts,         '