
    +h                         d dl Z d dlmZ d dlmZ d dlmZ ddlmZ ddlmZ  G d d	      Z	 G d
 de      Z
 eded       y)    N)	CacheImpl)register_plugin)Template   )eq_)configc                   H    e Zd Zd Zd Z	 	 	 ddZ	 	 	 ddZ	 	 	 d	dZd Zy)
TemplateTestc                 ^    | j                  |      }t        d||t        j                  d|S )N)urifilenamemodule_directory )
_file_pathr   r   module_base)selfr   kwfilepaths       H/var/www/html/venv/lib/python3.12/site-packages/mako/testing/fixtures.py_file_templatezTemplateTest._file_template   s;    ??8, 
#//
 	
 	
    c                 L   t         j                  j                  |      \  }}t         j                  j                  t        j
                  |dz   |z         }t         j                  j                  |      r|S t         j                  j                  t        j
                  |      S )N_py3k)ospathsplitextjoinr   template_baseexists)r   r   nameext	py3k_paths        r   r   zTemplateTest._file_path   sn    GG$$X.	cGGLL!5!5tg~7KL	77>>)$ww||F00(;;r   Nc                 V     | j                   |fi |}| j                  |||||       y )Nfiltersunicode_template_args)r   _do_test)r   r   expectedr%   r&   r'   r   t1s           r   _do_file_testzTemplateTest._do_file_test   s;     !T  0R0' 	 	
r   c                 J    t        dd|i|}| j                  |||||       y )Ntextr$   r   )r   r(   )r   sourcer)   r%   r&   r'   r   r*   s           r   _do_memory_testzTemplateTest._do_memory_test.   s6     (6(R(' 	 	
r   c                     |i }|r |j                   di |}n |j                  di |}|r ||      }t        ||       y Nr   )render_unicoderenderr   )r   templater)   r%   r'   r&   outputs          r   r(   zTemplateTest._do_test@   sP      M,X,,=}=F$X__5}5FV_FFHr   c                 P    d| d}d| dd| df}t        fd|D              S )Nz&#39;zlocal variable z referenced before assignmentzcannot access local variable z where it is not associatedc              3   &   K   | ]  }|v  
 y wNr   ).0msgrendered_outputs     r   	<genexpr>z=TemplateTest.indicates_unbound_local_error.<locals>.<genexpr>[   s     BC?*Bs   )any)r   r;   unbound_varvar
error_msgss    `   r   indicates_unbound_local_errorz*TemplateTest.indicates_unbound_local_errorS   sG    k]%( cU"?@+C50KL	

 BzBBBr   )NTN)NNT)	__name__
__module____qualname__r   r   r+   r/   r(   rA   r   r   r   r
   r
   
   sB    
< 
, 
, &Cr   r
   c                   .    e Zd ZdZd Zd Zd Zd Zd Zy)PlainCacheImplzTSimple memory cache impl so that tests which
    use caching can run without beaker.c                      || _         i | _        y r8   )cachedata)r   rH   s     r   __init__zPlainCacheImpl.__init__b   s    
	r   c                 n    || j                   v r| j                   |   S  |di |x| j                   |<   }|S r1   rI   )r   keycreation_functionr   rI   s        r   get_or_createzPlainCacheImpl.get_or_createf   s;    $))99S>!$5$;$;;DIIcNTKr   c                 "    || j                   |<   y r8   rL   )r   rM   valuer   s       r   putzPlainCacheImpl.putm   s    		#r   c                      | j                   |   S r8   rL   r   rM   r   s      r   getzPlainCacheImpl.getp   s    yy~r   c                     | j                   |= y r8   rL   rT   s      r   
invalidatezPlainCacheImpl.invalidates   s    IIcNr   N)	rB   rC   rD   __doc__rJ   rO   rR   rU   rW   r   r   r   rF   rF   ^   s     +r   rF   plain)r   
mako.cacher   r   mako.templater   
assertionsr   r   r
   rF   rB   r   r   r   <module>r]      sA    	   & "  QC QChY 2 #3 4r   