
    gW                    z   % S SK Jr  S SKrS SKrS SKrS SKJr  S SKJr  S SKJ	r
  S SKJr  S SKJr  S SKJr  S S	KJr  S S
KJr  S SKJr  S SKJr  S SKJr  S SKJr  SSKJr  S rS rS rS rS r S$S jr " S S5      r\R@                   S%S j5       r!S&S jr" S'S jr#S(S jr$0 r%S\&S'   S r'S  r(S! r)S" r*S# r+g))    )annotationsN)Any)Dict)exc)default)_expect_warnings)eq_)is_)is_false)is_not_)is_true)ne_	decorator   )sqla_compatc                    U R                   U R                  La,  U R                  (       d   SU < SU R                   < S35       egg)a4  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.

z
Exception z> was correctly raised but did not set a cause, within context z as its cause.N)__context__	__cause____suppress_context__)	exceptions    b/Users/Alptekin/Desktop/izin_takip/venv/lib/python3.13/site-packages/alembic/testing/assertions.py _assert_proper_exception_contextr      sI     	Y%8%88..	
 )//1	
u / 	9    c                    [        XX#SS9$ )NTcheck_context_assert_raises
except_cls	callable_argskws       r   assert_raisesr%   ,   s    *NNr   c                    [        XX#5      $ Nr   r    s       r   assert_raises_context_okr(   0   s    *::r   c           	         [        XX4USS9$ )NT)msgr   r   r!   r*   r"   r#   kwargss        r   assert_raises_messager-   4   s    tD r   c                    [        XX4US9$ )N)r*   r   r+   s        r    assert_raises_message_context_okr/   :   s     *3GGr   c                    [        XU5       nU" U0 UD6  S S S 5        UR                  $ ! , (       d  f       WR                  $ = fr'   )_expect_raiseserror)r!   r"   r#   r,   r*   r   ecs          r   r   r   @   s=     

	724"6" 
888O 
8	788Os	   	*
Ac                  $    \ rS rSr% SrS\S'   Srg)_ErrorContainerH   Nr   r2    )__name__
__module____qualname____firstlineno__r2   __annotations____static_attributes__r7   r   r   r5   r5   H   s    E3r   r5   c              #    #    [        5       nU(       a  [        R                  " 5       S   n Uv   SnU(       d   S5       eg ! U  a  nXtl        SnUbc  U(       a  [	        U5      U:X  d   U SU 35       eO@[
        R                  " U[	        U5      [
        R                  5      (       d   U SU 35       eU(       a  W(       d  [        U5        [        [	        U5      R                  S5      5         S nANS nAff = f7f)Nr   FT != z !~ zutf-8z#Callable did not raise an exception)r5   sysexc_infor2   strresearchUNICODEr   printencode)r!   r*   r   
text_exactr3   are_we_already_in_a_tracebacksuccesserrs           r   r1   r1   L   s      
	B(+q(9%( 9997  
(?3x393%tC5(99yyc#h

;;NuD=NN;!>,S1c#hoog&''
(s.   *C?A C?C<B*C72C?7C<<C?c                    [        XS9$ )Nr   r1   )r!   r   s     r   expect_raisesrN   f   s    *BBr   c                    [        XX#S9$ )N)r*   r   rH   rM   )r!   r*   r   rH   s       r   expect_raises_messagerP   j   s     = r   c                    [         R                  " SSU 5      n [         R                  " SSU 5      n [         R                  " SSU5      n[         R                  " SSU5      nX:X  d   U=(       d	    U < SU< 35       eg )Nz^\s+?|\n z {2,} r?   )rC   sub)abr*   s      r   eq_ignore_whitespacerW   r   sc    
{B"A
xa A
{B"A
xa A6-3-1--6r   zDict[Any, Any]_dialect_modsc                    U b  U S:X  a  [         R                  " 5       $ [        R                  " U 5      R	                  5       " 5       nU S:X  a	  SUl        U$ U S:X  a  SUl        U$ )Nr   
postgresqlTmssqlF)r   DefaultDialectr   _create_urlget_dialectimplicit_returninglegacy_schema_aliasing)nameds     r   _get_dialectrc   ~   sf    |ty(%%''##D)5579<#'A   W_',A$r   c                 $    [        [        U 40 UD6$ )a  Context manager which expects one or more warnings.

With no arguments, squelches all SAWarnings emitted via
sqlalchemy.util.warn and sqlalchemy.util.warn_limited.   Otherwise
pass string expressions that will match selected warnings via regex;
all non-matching warnings are sent through.

The expect version **asserts** that the warnings were in fact seen.

Note that the test suite sets SAWarning warnings to raise exceptions.

)r   Warningmessagesr$   s     r   expect_warningsrh      s     GX444r   c                 &   ^  [         U 4S j5       nU$ )zxDecorator form of expect_warnings().

Note that emits_warning does **not** assert that the warnings
were in fact seen.

c                p   > [        [        /TQ7SS06   U " U0 UD6sS S S 5        $ ! , (       d  f       g = f)Nassert_F)r   DeprecationWarning)fnr#   r$   rg   s      r   decorate2emits_python_deprecation_warning.<locals>.decorate   s.    0K(K%Kt?r? LKKs   '
5r   )rg   rn   s   ` r    emits_python_deprecation_warningrp      s     # # Or   c                 8    [        [        R                  U 40 UD6$ r'   )r   sa_excSADeprecationWarningrf   s     r   expect_sqlalchemy_deprecatedrt      s    F77HRHHr   c                 8    [        [        R                  U 40 UD6$ r'   )r   rr   RemovedIn20Warningrf   s     r   expect_sqlalchemy_deprecated_20rw      s    F55xF2FFr   )NF)NFF)T)TFr'   ),
__future__r   
contextlibrC   r@   typingr   r   
sqlalchemyr   rr   sqlalchemy.enginer   sqlalchemy.testing.assertionsr   r	   r
   r   r   r   r   sqlalchemy.utilr   utilr   r   r%   r(   r-   r/   r   r5   contextmanagerr1   rN   rP   rW   rX   r<   rc   rh   rp   rt   rw   r7   r   r   <module>r      s    "  	 
   $ % : - - 2 1 1 - % 
*O;H BG  :?: :2C
 5:. !#~ "
5  IGr   