o !bs@svddlZddlZddlZddlmZddlmZmZddlm Z Gdddej Z ddZ e d kr9ejdd dSdS) N)TEXT)TemplateSyntaxErrorEXPR) interpolatec@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3S)4InterpolateTestCasecCHttd}|dt||t|dd|d|dddS)Nblarlistr assertEquallenrselfpartsrE/usr/lib/python3/dist-packages/genshi/template/tests/interpolation.pytest_interpolate_string z+InterpolateTestCase.test_interpolate_stringcCJttd}|dt||t|dd|d|ddjdS)N${bla}r rrr rr r rsourcerrrrtest_interpolate_simple z+InterpolateTestCase.test_interpolate_simplecCHttd}|dt||t|dd|d|dddS)Nz$${bla}r rrr rrrrtest_interpolate_escaped%rz,InterpolateTestCase.test_interpolate_escapedcCrttd}|dt||t|dd|d|dd|t|dd|d|ddjdS)Nz$$${bla}r$r rr rr r rrrrrrrtest_interpolate_dobuleescaped+ z2InterpolateTestCase.test_interpolate_dobuleescapedcCr)N$blar rrrrrrrtest_interpolate_short3rz*InterpolateTestCase.test_interpolate_shortcCr)Nz$$blar rr#r rrrrtest_interpolate_short_escaped9rz2InterpolateTestCase.test_interpolate_short_escapedcCr)Nz my $$bla = 2r rz my $bla = 2r rrrr test_interpolate_short_escaped_2?rz4InterpolateTestCase.test_interpolate_short_escaped_2cCr)Nz$$$blarrrr rr rrrr$test_interpolate_short_doubleescapedEr"z8InterpolateTestCase.test_interpolate_short_doubleescapedcCr)Nz$_blar r_blarrrrr/test_interpolate_short_starting_with_underscoreMrzCInterpolateTestCase.test_interpolate_short_starting_with_underscorecCr)Nz$foo_barr rfoo_barrrrrr,test_interpolate_short_containing_underscoreSrz@InterpolateTestCase.test_interpolate_short_containing_underscorecCr)Nz$.blar rr rrrr(test_interpolate_short_starting_with_dotYrzInterpolateTestCase.test_interpolate_short_starting_with_digitcCrNz$foo0r rfoo0rrrrr'test_interpolate_short_containing_digitkrz;InterpolateTestCase.test_interpolate_short_containing_digitcCrr.r rrrrr/qrcCrr0rrrrrr2wrcCr)Nz${{1:2}}r rz{1:2}rrrrr%test_interpolate_full_nested_brackets}rz9InterpolateTestCase.test_interpolate_full_nested_bracketsc CsFzttdWnty}zWYd}~dSd}~ww|ddS)Nz${{1:2}zExpected TemplateSyntaxError)r rrfail)rerrr)test_interpolate_full_mismatched_bracketssz=InterpolateTestCase.test_interpolate_full_mismatched_bracketscCr)Nz${"}"}r rz"}"rrrrr"test_interpolate_quoted_brackets_1rz6InterpolateTestCase.test_interpolate_quoted_brackets_1cCr)Nz${'}'}r rz'}'rrrrr"test_interpolate_quoted_brackets_2rz6InterpolateTestCase.test_interpolate_quoted_brackets_2cCr)Nz ${'''}'''}r rz'''}'''rrrrr"test_interpolate_quoted_brackets_3rz6InterpolateTestCase.test_interpolate_quoted_brackets_3cCr)Nz ${'''}"""'''}r rz '''}"""'''rrrrr"test_interpolate_quoted_brackets_4rz6InterpolateTestCase.test_interpolate_quoted_brackets_4cCr)Nz${'\'}'}r rz'\'}'rrrrr"test_interpolate_quoted_brackets_5rz6InterpolateTestCase.test_interpolate_quoted_brackets_5cCsttd}|dt||t|dd|d|ddj|t|dd|d|dd|t|dd|d|ddjdS) Nz $foo bar $bazrfoor z bar rbaz)r rr r rrrrrrrtest_interpolate_mixed1s z+InterpolateTestCase.test_interpolate_mixed1cCsttd}|dt||t|dd|d|dd|t|dd|d|ddj|t|dd|d|dddS) Nz foo $bar bazr<rzfoo r barrz bazr rrrrtest_interpolate_mixed2s z+InterpolateTestCase.test_interpolate_mixed2cCs6ttd}|dt||d|ddjdS)Nz${"""foo bar"""}r z """foo bar"""r)r rr r rrrrrtest_interpolate_triplequoteds z1InterpolateTestCase.test_interpolate_triplequotedN)__name__ __module__ __qualname__rrrr!r$r%r&r'r)r+r,r-r/r2r3r6r7r8r9r:r;r?rArBrrrrrs6 rcCs0t}|ttj|ttd|S)Ntest) unittest TestSuiteaddTestdoctest DocTestSuiterrD makeSuiter)suiterrrrMsrM__main__) defaultTest)rJsysrG genshi.corergenshi.template.baserrgenshi.template.interpolationrTestCaserrMrCmainrrrrs   -