
    Eh                       % 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*S# r+g))    )annotationsN)Any)Dict)exc)default)URL)_expect_warnings)eq_)is_)is_false)is_not_)is_true)ne_	decoratorc                    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    ]/home/kali/devsecops-assessor/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'   /   s    *::r   c           	         [        XX4USS9$ )NT)msgr   r   r    r)   r!   r"   kwargss        r   assert_raises_messager,   3   s    tD r   c                    [        XX4US9$ )N)r)   r   r*   s        r    assert_raises_message_context_okr.   9   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)_ErrorContainerG   Nr   r1    )__name__
__module____qualname____firstlineno__r1   __annotations____static_attributes__r6   r   r   r4   r4   G   s    E3r   r4   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)r4   sysexc_infor1   strresearchUNICODEr   printencode)r    r)   r   
text_exactr2   are_we_already_in_a_tracebacksuccesserrs           r   r0   r0   K   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   r0   )r    r   s     r   expect_raisesrM   e   s    *BBr   c                    [        XX#S9$ )N)r)   r   rG   rL   )r    r)   r   rG   s       r   expect_raises_messagerO   i   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>   )rB   sub)abr)   s      r   eq_ignore_whitespacerV   q   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get_dialectimplicit_returninglegacy_schema_aliasing)nameds     r   _get_dialectrb   }   sd    |ty(%%''JJt((*,<#'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_warningsrg      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#   rf   s      r   decorate2emits_python_deprecation_warning.<locals>.decorate   s.    0K(K%Kt?r? LKKs   '
5r   )rf   rn   s   ` r    emits_python_deprecation_warningrp      s     # # Or   c                 $    [        [        U 40 UD6$ r&   rk   re   s     r   expect_deprecatedrr      s    .?B??r   c                 8    [        [        R                  U 40 UD6$ r&   )r	   sa_excSADeprecationWarningre   s     r   expect_sqlalchemy_deprecatedrv      s    F77HRHHr   c                 8    [        [        R                  U 40 UD6$ r&   )r	   rt   RemovedIn20Warningre   s     r   expect_sqlalchemy_deprecated_20ry      s    F55xF2FFr   )NF)NFF)T)TFr&   ),
__future__r   
contextlibrB   r?   typingr   r   
sqlalchemyr   rt   sqlalchemy.enginer   r   sqlalchemy.testing.assertionsr	   r
   r   r   r   r   r   sqlalchemy.utilr   r   r$   r'   r,   r.   r   r4   contextmanagerr0   rM   rO   rV   rW   r;   rb   rg   rp   rr   rv   ry   r6   r   r   <module>r      s    "  	 
   $ % ! : - - 2 1 1 - %
*O;H BG  :?: :2C
 5:. !#~ "
5  @IGr   