
    #)f"                        d dl mZ d dlZd dlZd dlmZ d dlmZ d dlZd dl	Z	d dl
mZmZ ej                  dk  rd dlmZ ddZdd	Zdd
ZddZddZddZddZddZddZddZddZy)    )annotationsN)TracebackType)Any)MatcherRaisesGroup)      )ExceptionGroupc                8    dt        j                  |       z   dz   S )N^$)reescape)ss    a/var/www/html/flask-app/venv/lib/python3.12/site-packages/trio/_tests/test_testing_raisesgroup.pywrap_escaper      s    1##    c                 D   t        j                  t        t        dt	               d            5  t        t	                      d d d        t        t              5  t        dt               f      # 1 sw Y   .xY w# 1 sw Y   nxY wt        t              5  t        t              5  t        dt               f      # 1 sw Y   nxY w	 d d d        n# 1 sw Y   nxY wt        t        t              5  t        dt               t               f      # 1 sw Y   nxY wt        t        t              5  t        dt               t               f      # 1 sw Y   nxY wt        t        t                    5  t        dt        dt               f      f      # 1 sw Y   nxY wt        t        t        t              t        t                    5  t        dt               t        dt               f      t        dt               f      f      # 1 sw Y   nxY wt        j                  t              5  t        t              5  t        dt               t               f      # 1 sw Y   nxY w	 d d d        n# 1 sw Y   nxY wt        j                  t              5  t        t              5  t        dt               t               f      # 1 sw Y   nxY w	 d d d        n# 1 sw Y   nxY wt        j                  t              5  t        t        t              5  t        dt               f      # 1 sw Y   nxY w	 d d d        n# 1 sw Y   nxY wt        j                  t              5  t        t        t              5  t        dt               f      # 1 sw Y   nxY w	 d d d        n# 1 sw Y   nxY wt        t        d      5  t        dt        dt               f      f      # 1 sw Y   nxY wt        t        t        d            5  t        dt        dt               f      f      # 1 sw Y   nxY wt        t        t        d            5  t        dt        dt        dt               f      f      f      # 1 sw Y   nxY wt        j                  t              5  t        t        t        d            5  t        dt               f      # 1 sw Y   nxY w	 d d d        n# 1 sw Y   nxY wt        j                  t        d	      5  t        t        t              d       d d d        n# 1 sw Y   nxY wt        j                  t        d
      5  t        t        d      5  t        d      # 1 sw Y   nxY w	 d d d        y # 1 sw Y   y xY w)NzInvalid argument "z2" must be exception type, Matcher, or RaisesGroup.matchfoobar F)strictzN^You cannot specify a nested structure inside a RaisesGroup with strict=False$z^value error text$zvalue error text)	pytestraises
ValueErrorr   	TypeErrorr   r
   SyntaxErrorRuntimeError r   r   test_raises_groupr"      s   	 /ab

 ! 	IK ! 
Z	  5UZ\O44! !5 5 
[	! :$ 	: (899	: 	: 	:: : :
 
Z	- CUZ\;=$ABBC C 
[*	- CUZ\;=$ABBC C 
[,	- OU^EJL?%K$MNNO O 
JL!
 

 uz|o6rLN#45
 	

 
 
~	& C$ 	C jlJL%ABB	C 	C 	CC C C 
~	& E$ 	E lnjl%CDD	E 	E 	EE E E
 
~	& 6Z0 	6 jl_55	6 	6 	66 6 6 
~	& 6[1 	6 jl_55	6 	6 	66 6 6
 
Z	. IR.jl_"E!GHHI I 
[E:	; IR.jl_"E!GHHI I	[E:	; 
^B%H$JKM
 	

 
 
~	& 6Z>? 	6 jl_55	6 	6 	66 6 6
 
^
 ; 	K
+E:	; ; ; 
z)=	> 1E2 	1/00	1 	1 	11 1 1sI  A2A>2A;>BC)B??C	CC5DD4EE7!FF!>HH2I7I!!I*	&I77J K!,KK	K!!K*ML11L:	6MM,N-NN 	N--N6
!O++O4!P22P;,RR)S0SS#	S00S9T;;U"V4V  V		VVc                 .   t        t        d      5  t        dt               f      # 1 sw Y   nxY wt        j                  t              5  t        t        d      5  t        dt               f      # 1 sw Y   nxY w	 d d d        y # 1 sw Y   y xY w)Nr   r   r   )r   r   r
   r   r   r!   r   r   
test_matchr$   m   s    	Zu	- 5UZ\O445 5 
~	& 951 	9 88	9 	9 	99 9 9s&   (1BA55A>	:BBc                 @    t        dt               f       t        t         fd      5   # 1 sw Y   nxY wt        j                  t               5  t        t         fd      5  t        dt               f      # 1 sw Y   nxY w	 d d d        y # 1 sw Y   y xY w)Nr   c                    | u S Nr!   xexcs    r   <lambda>ztest_check.<locals>.<lambda>y   s    c r   checkc                    | u S r'   r!   r(   s    r   r+   ztest_check.<locals>.<lambda>|   s    Q#X r   )r
   r   r   r   r   )r*   s   @r   
test_checkr/   w   s    
jl_
-C	Z'9	: 	 	~	& 6+=> 	6 jl_55	6 	6 	66 6 6s&   .7B(A>>B	BBc                     t        t              } | j                  d       rJ | j                  t                     rJ | j                  t        dt               f            sJ y )Nr   )r   r   matchesr
   )rgs    r   test_RaisesGroup_matchesr3      sI    	Z	 Bzz$zz*,''::nR*,9:::r   c            	     &   dd}  | dt        t                      | dt        t        t                      | dt        t        t                            | dt        t        t        d                    | dt        t        d                    | d	t        t                      | d
t        t        t                            | dt        t        t                            | dt        t        t              t        t                           y )Nc                    t        j                  t        dt        j                  |        d      5  |5  	 d d d        d d d        y # 1 sw Y   xY w# 1 sw Y   y xY w)Nz'^DID NOT RAISE any exception, expected r   r   )r   r   AssertionErrorr   r   )messagebodys     r   check_messagez#test_message.<locals>.check_message   s^    ]];BIIg<N;OqQ
 	  		 	 		 	s!   AA	A	A	AAzExceptionGroup(ValueError)z&ExceptionGroup(ValueError, ValueError)z*ExceptionGroup(ExceptionGroup(ValueError))z3ExceptionGroup(Matcher(ValueError, match='my_str'))my_strz'ExceptionGroup(Matcher(match='my_str'))r   z%BaseExceptionGroup(KeyboardInterrupt)z.BaseExceptionGroup(Matcher(KeyboardInterrupt))z9BaseExceptionGroup(BaseExceptionGroup(KeyboardInterrupt))zUBaseExceptionGroup(BaseExceptionGroup(KeyboardInterrupt), ExceptionGroup(ValueError)))r7   strr8   zRaisesGroup[Any]returnNone)r   r   r   KeyboardInterrupt)r9   s    r   test_messager?      s     .J0GH0+j*2U 4K
+, =GJ12 1G(+, /=N1O 8G-./
 CK 123
 _K 12K
4KLr   c            	        t        j                  t        d      5  t                d d d        t        j                  t        dt	        j
                  t        t                     d      5  t        t               d d d        t        t        t                    5  t        dt               f      # 1 sw Y   xY w# 1 sw Y   CxY w# 1 sw Y   nxY wt        j                  t              5  t        t        t                    5  t        dt               f      # 1 sw Y   nxY w	 d d d        y # 1 sw Y   y xY w)Nz6^You must specify at least one parameter to match on.$r   z^exception_type z% must be a subclass of BaseException$r   )r   r   r   r   r   r   reprobjectr   r
   r   r!   r   r   test_matcherrC      s    	R
  		 
 4<!8 99^_
  		 
WZ(	) 2R*,11  2 2	~	& 6+, 	6 jl_55	6 	6 	66 6 6sA   B4.C C4B= C	C1D6
D  D)	%D66D?c                    t        t        t        d            5  t        dt        d      f      # 1 sw Y   nxY wt	        j
                  t              5  t        t        t        d            5  t        dt        d      f      # 1 sw Y   nxY w	 d d d        n# 1 sw Y   nxY wt        t        d            5  t        dt        d      f      # 1 sw Y   nxY wt	        j
                  t              5  t        t        d            5  t        dt        d      f      # 1 sw Y   nxY w	 d d d        y # 1 sw Y   y xY w)Nr   r   r   r   )r   r   r   r
   r   r   r!   r   r   test_matcher_matchrE      s   	WZ/	0 7R*U"3!5667 7	~	& ;U34 	; j&7%9::	; 	; 	;; ; ;
 
W5)	* 7R*U"3!5667 7	~	& ;u-. 	; j&7%9::	; 	; 	;; ; ;sP   1:B0BB	BB&>CC:D=D''D0	,D==Ec            	        dd} t        t        |             5  t        dt        dd      f      # 1 sw Y   nxY wdd}t        t        t        |            5  t        dt        dd      f      # 1 sw Y   nxY wt	        j
                  t              5  t        t        t        |            5  t        dt        dd      f      # 1 sw Y   nxY w	 d d d        y # 1 sw Y   y xY w)	Nc                D    t        | t              xr | j                  dk(  S N   )
isinstanceOSErrorerrnoes    r   check_oserror_and_errno_is_5z8test_Matcher_check.<locals>.check_oserror_and_errno_is_5   s    !W%6!''Q,6r   r,   r   rI   c                     | j                   dk(  S rH   )rL   rM   s    r   check_errno_is_5z,test_Matcher_check.<locals>.check_errno_is_5   s    ww!|r      )rN   BaseExceptionr<   bool)rN   rK   r<   rT   )r   r   r
   rK   r   r   )rO   rQ   s     r   test_Matcher_checkrU      s    7 
W#?@	A 4R'!R.!2334 4 
WW,<=	> 4R'!R.!2334 4 
~	& 80@AB 	8 gan%677	8 	8 	88 8 8s2   2;A44A=C"4CC	C""C+c                    t        t        t                    dk(  sJ t        t        d            dk(  sJ t        j                  dd      } t        t        |             dk(  sJ t        j                  dt        j
                        }t        t        |            d|d	k(  sJ t        t        t        d
t                    dt        d	k(  sJ y )NzMatcher(ValueError)z[a-z]r   zMatcher(match='[a-z]')noflagr   zMatcher(match='noflag')zMatcher(match=)r   )r   r-   z&Matcher(ValueError, match='re', check=)r;   r   r   r   compile
IGNORECASErT   )pattern_no_flagspattern_flagss     r   test_matcher_tostringr]      s    wz"#'<<<wW%&*BBBzz(A.w-./3LLLJJx7Mw]+,.@QQR0SSSGJd$783D81=	>	>r   c                   | j                  t        j                  j                  dt        j                  j                  j                         t        j                  j                  t              5 }t        dt        d      f      # 1 sw Y   nxY wj                  t        u sJ |j                  j                  d   j                  dk(  sJ t        |j                  t              sJ y )NExceptionInfor   hellor   )r`   )setattrtriotesting_raises_group_ExceptionInfor   r   r
   typevalue
exceptionsargsrJ   tbr   )monkeypatchexcinfos     r   test__ExceptionInform      s    """"11
 
	!	!*	- 9R*W"5!7889 9<<>))==##A&++z99gjj-000s   1BB)r   r;   r<   r;   )r<   r=   )rk   zpytest.MonkeyPatchr<   r=   )
__future__r   r   systypesr   typingr   r   rb   trio.testingr   r   version_infoexceptiongroupr
   r   r"   r$   r/   r3   r?   rC   rE   rU   r]   rm   r!   r   r   <module>ru      sh    " 	 
     -g-$U1p96;1h6$;8&

1r   