U  e @srddlZddlmZddlmZddlmZddlmZddlmZGdd d Z Gd d d eZ ed e d dS) N) CacheImpl)register_plugin)Template)eq_)configc@sBeZdZddZddZdddZdd d Zdd d Zd dZdS) TemplateTestcKs"||}tf||tjd|S)N)urifilenameZmodule_directory) _file_pathrrZ module_base)selfr kwfilepathrC/opt/hc_python/lib/python3.8/site-packages/mako/testing/fixtures.py_file_template s zTemplateTest._file_templatecCsHtj|\}}tjtj|d|}tj|r8|Stjtj|S)NZ_py3k)ospathsplitextjoinrZ template_baseexists)r r nameextZ py3k_pathrrrr s  zTemplateTest._file_pathNTcKs&|j|f|}|j|||||ddS)Nfiltersunicode_ template_args)r_do_test)r r expectedrrrr t1rrr _do_file_tests zTemplateTest._do_file_testcKs*tfd|i|}|j|||||ddS)Ntextr)rr)r sourcerrrrr rrrr_do_memory_test.s zTemplateTest._do_memory_testcCsD|dkr i}|r|jf|}n |jf|}|r6||}t||dSN)Zrender_unicoderenderr)r templaterrrroutputrrrr@s zTemplateTest._do_testcs:d|d}d|dd|df}tfdd|DS)Nz'zlocal variable z referenced before assignmentzcannot access local variable z where it is not associatedc3s|]}|kVqdSr$r).0msgrendered_outputrr [sz=TemplateTest.indicates_unbound_local_error..)any)r r+Z unbound_varvarZ error_msgsrr*rindicates_unbound_local_errorSs    z*TemplateTest.indicates_unbound_local_error)NTN)NTN)NNT) __name__ __module__ __qualname__rr r r#rr/rrrrr s     rc@s8eZdZdZddZddZddZdd Zd d Zd S) PlainCacheImplzTSimple memory cache impl so that tests which use caching can run without beaker.cCs||_i|_dSr$)cachedata)r r4rrr__init__bszPlainCacheImpl.__init__cKs0||jkr|j|S|f||j|<}|SdSr$r5)r keyZcreation_functionr r5rrr get_or_createfs  zPlainCacheImpl.get_or_createcKs||j|<dSr$r7)r r8valuer rrrputmszPlainCacheImpl.putcKs |j|Sr$r7r r8r rrrgetpszPlainCacheImpl.getcKs |j|=dSr$r7r<rrr invalidatesszPlainCacheImpl.invalidateN) r0r1r2__doc__r6r9r;r=r>rrrrr3^s r3plain) rZ mako.cacherrZ mako.templaterZ assertionsrrrr3r0rrrrs     T