o !b"@sddlZddlZddlZddlZddlZddlmZddlmZddl m Z m Z Gdddej Z Gdddej Zd d Zed krJejd d dSdS) N)TemplateSyntaxError)TemplateLoader)OldTextTemplateNewTextTemplatec@sheZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZdS)OldTextTemplateTestCase#Tests for text template processing.cCtjdd|_dSN markup_test)suffixtempfilemkdtempdirnameselfrz+NewTextTemplateTestCase.test_latin1_encodedcCr?r@rfr;rrrrArBz*NewTextTemplateTestCase.test_unicode_inputcCrC)Nz9Your items: {% for item in items %} * ${item} {% end %}zYour items: * 0 * 1 * 2 rDrErrr!r"rHr#r$rrrrIrJz)NewTextTemplateTestCase.test_empty_lines1cCrC)Nz?Your items: {% for item in items %}\ * ${item} {% end %}z$Your items: * 0 * 1 * 2 rDrErrgr$rrrtest_empty_lines1_with_crlfsz3NewTextTemplateTestCase.test_empty_lines1_with_crlfcCrC)Nz:Your items: {% for item in items %} * ${item} {% end %}z"Your items: * 0 * 1 * 2 rDrErrgr$rrrrKrLz)NewTextTemplateTestCase.test_empty_lines2cCrC)NzAYour items: {% for item in items %}\ * ${item} {% end %}z*Your items: * 0 * 1 * 2 rDrErrgr$rrrtest_empty_lines2_with_crlfsz3NewTextTemplateTestCase.test_empty_lines2_with_crlfcCs tddS)zw Verify that a code block with trailing space does not cause a syntax error (see ticket #127). z? {% python bar = 42 $} N)rrrrrtest_exec_with_trailing_spaces z5NewTextTemplateTestCase.test_exec_with_trailing_spacecCr)NzQ{% python from datetime import timedelta %} ${timedelta(days=2)} z! 2 days, 0:00:00 rrfr$rrrtest_exec_importsz(NewTextTemplateTestCase.test_exec_importcCr)NzW{% python def foo(): return 42 %} ${foo()} z 42 rrfr$rrr test_exec_defsz%NewTextTemplateTestCase.test_exec_defcCrM) NrNrOIncludedrPrQzk----- Included data below this line ----- {% include tmpl1.txt %} ----- Included data above this line -----rRz\----- Included data below this line ----- Included ----- Included data above this line -----rrTrUrVrWrrXr:rYrrZrr!r"r#r[rrrr_r`z$NewTextTemplateTestCase.test_includecCrM) NrNrOrmrPrQz----- Included data below this line ----- {% include ${'%s.txt' % ('tmpl1',)} %} ----- Included data above this line -----rRzd----- Included data below this line ----- Included ----- Included data above this line -----rrnr[rrrtest_include_exprr`z)NewTextTemplateTestCase.test_include_exprN)rarbrcrdrrr&r)r*r0r=rArIrhrKrirjrkrlr_rorrrrrews&    recCsBt}|ttj|ttd|tt d|S)Ntest) unittest TestSuiteaddTestdoctest DocTestSuiterrb makeSuiterre)suiterrrrw's rw__main__) defaultTest)rtrUrr rqgenshi.template.basergenshi.template.loaderrgenshi.template.textrrTestCaserrerwramainrrrrs   ^1