
    +h)                         d dl Z d dlZd dlZddZddZddZddZd Zd Zd Z	d	 Z
d
 Zd Zd Zd Z	 	 	 ddZ G d d      Ze j"                  dd       ZddZddZddZ	 ddZy)    Nc                 .    | |k(  sJ |xs | d|       y)z.Assert a == b, with repr messaging on failure.z != N abmsgs      J/var/www/html/venv/lib/python3.12/site-packages/mako/testing/assertions.pyeq_r
          6-3-1--6    c                 .    | |k7  sJ |xs | d|       y)z.Assert a != b, with repr messaging on failure.z == Nr   r   s      r	   ne_r      r   r   c                 ,    | |v sJ |xs | d|       y)z.Assert a in b, with repr messaging on failure.z not in Nr   r   s      r	   in_r      s    6131Aq116r   c                 ,    | |vsJ |xs | d|       y)z2Assert a in not b, with repr messaging on failure.z is in Nr   r   s      r	   not_inr      s    A:4s4q!44:r   c                 ~    | j                   | j                  ur%| j                  sJ d| d| j                   d       yy)G  assert that any exception we're catching does not have a __context__
    without a __cause__, and that __suppress_context__ is never set.

    Python 3 will report nested as exceptions as "during the handling of
    error X, error Y occurred". That's not what we want to do. We want
    these exceptions in a cause chain.

    
Exception z> was correctly raised but did not set a cause, within context z as its cause.N)__context__	__cause____suppress_context__)	exceptions    r	    _assert_proper_exception_contextr      sI     	Y%8%88..	
 )//1	
u / 	9r   c                 f    t        | j                  |      sJ d| d| j                  d|d       y)r   r   z$ was correctly raised but has cause z., which does not have the expected cause type .N)
isinstancer   )r   	cause_clss     r	   _assert_proper_cause_clsr   /   s5     i))95  i))9	65r   c                     t        | |||      S N_assert_raises
except_cls	callable_argskws       r	   assert_raisesr)   ?   s    *ir::r   c                 "    t        | |||d      S )NTcheck_contextr"   r$   s       r	   !assert_raises_with_proper_contextr-   C   s    *irNNr   c                 "    t        | ||||      S )N)r   r"   )r%   r   r&   r'   r(   s        r	   assert_raises_with_given_causer/   G   s     *irYOOr   c                 "    t        | ||||      S )N)r   r"   r%   r   r&   r'   kwargss        r	   assert_raises_messager3   M   s    *iv3GGr   c                 $    t        | ||||d      S )NTr   r,   r"   r1   s        r	   )assert_raises_message_with_proper_contextr6   Q   s     ItVD r   c                 $    t        | |||||      S )N)r   r   r"   )r%   r   r   r&   r'   r2   s         r	   &assert_raises_message_with_given_causer8   Y   s     ItV	 r   c                     t        | |||      5 } ||i | d d d        |j                  S # 1 sw Y   j                  S xY wr!   )_expect_raiseserror)r%   r&   r'   r2   r   r,   r   ecs           r	   r#   r#   a   sC     

C		B #b4"6"#88O#88Os	   	,A c                       e Zd ZdZy)_ErrorContainerN)__name__
__module____qualname__r;   r   r   r	   r>   r>   o   s    Er   r>   c              #     K   t               }|rt        j                         d   }	 | d}~|sJ d       y # | $ r}||_        d}|<t	        |      }t        j                  ||t
        j                        sJ |d|       |t        ||       |rst        |       t        t	        |      j                  d             Y d }~d }~ww xY ww)Nr   FTz !~ zutf-8z#Callable did not raise an exception)r>   sysexc_infor;   strresearchUNICODEr   r   printencode)	r%   r   r,   r   r<   are_we_already_in_a_tracebacksuccesserrerror_as_strings	            r	   r:   r:   s   s     		B(+q(9%(. 	 99973  (? "#hO99S/2::> A >  $S)4!>,S1c#hoog&''(s+   $C8 CCBC	C	CCc                     t        | |      S Nr+   r:   r%   r,   s     r	   expect_raisesrS          *MBBr   c                     t        | ||      S Nr5   rQ   r%   r   r,   s      r	   expect_raises_messagerX      s    *#]KKr   c                     t        | |      S rP   rQ   rR   s     r	   !expect_raises_with_proper_contextrZ      rT   r   c                     t        | ||      S rV   rQ   rW   s      r	   )expect_raises_message_with_proper_contextr\      s     *#]KKr   r!   )NFN)F)T)
contextlibrF   rC   r
   r   r   r   r   r   r)   r-   r/   r3   r6   r8   r#   r>   contextmanagerr:   rS   rX   rZ   r\   r   r   r	   <module>r_      s     	 
.
.
2
5

* ;OPH 	   :  :FCLC
 $(Lr   