gLpUddlmZddlZddlZddlZddlmZddlmZddlm Z ddl m Z ddl m Z ddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZddlmZdZdZdZdZdZ d#dZGddZej> d$dZ d%dZ! d&dZ"d'dZ#iZ$de%d<dZ&dZ'd Z(d!Z)d"Z*y)() annotationsN)Any)Dict)exc)default)URL)_expect_warnings)eq_)is_)is_false)is_not_)is_true)ne_ decoratorc~|j|jur%|jsJd|d|jdyy)aHassert 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 I/opt/hc_python/lib/python3.12/site-packages/alembic/testing/assertions.py _assert_proper_exception_contextrsI Y%8%88.. )// 1 u/ 9c"t||||dS)NT check_context_assert_raises except_cls callable_argskws r assert_raisesr$+s *ir NNrct||||SNrrs rassert_raises_context_okr'/s *ir ::rc$t|||||dS)NT)msgrrr r)r!r"kwargss rassert_raises_messager,3s ItVD rc"t|||||S)N)r)rr*s r assert_raises_message_context_okr.9s *iv3 GGrct|||5}||i|ddd|jS#1swYjSxYwr&)_expect_raiseserror)r r!r"r+r)recs rrr?s<  C 724"6" 8 88O 8 88Os +?ceZdZUdZded<y)_ErrorContainerNrr1)__name__ __module__ __qualname__r1__annotations__rrr4r4Gs E3rr4c#Kt}|rtjd} |d}|sJdy#|$r}||_d}|V|rt ||k(sFJ|d|t j |t |t js J|d||r s t|tt |jdYd}~d}~wwxYww)NrFT != z !~ zutf-8z#Callable did not raise an exception) r4sysexc_infor1strresearchUNICODErprintencode)r r)r text_exactr2are_we_already_in_a_tracebacksuccesserrs rr0r0Ks  B(+ q(9% ( 9997  ( ?3x393%tC5(99yyc#h ;NuD=NN; !> ,S 1 c#hoog&'' (s+$C7 CCBCCCCct||S)Nrr0)r rs r expect_raisesrJes *M BBrc t||||S)N)r)rrDrI)r r)rrDs rexpect_raises_messagerLis =Z rctjdd|}tjdd|}tjdd|}tjdd|}||k(sJ|xs|d|y)Nz^\s+?|\nz {2,} r;)r?sub)abr)s req_ignore_whitespacerSqse {B"A xa A {B"A xa A 6-3-1--6rzDict[Any, Any] _dialect_modsc||dk(rtjStj|j }|dk(r d|_|S|dk(rd|_|S)Nr postgresqlTmssqlF)rDefaultDialectrcreate get_dialectimplicit_returninglegacy_schema_aliasing)nameds r _get_dialectr_}sf |ty(%%'' *CJJt  ( ( * , < #'A W_',A $rc$tt|fi|S)aContext 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 Warningmessagesr#s rexpect_warningsrds GX 4 44rc$tfd}|S)zDecorator form of expect_warnings(). Note that emits_warning does **not** assert that the warnings were in fact seen. cfttgddi5||i|cdddS#1swYyxYw)Nassert_F)r DeprecationWarning)fnr"r#rcs rdecoratez2emits_python_deprecation_warning..decorates. 0 K( K% Kt?r?L K Ks'0r)rcrjs` r emits_python_deprecation_warningrks## Orc8ttj|fi|Sr&)r sa_excSADeprecationWarningrbs rexpect_sqlalchemy_deprecatedros F77 HR HHrc8ttj|fi|Sr&)r rmRemovedIn20Warningrbs rexpect_sqlalchemy_deprecated_20rrs F55x F2 FFr)NF)NFF)T)TFr&)+ __future__r contextlibr?r<typingrr sqlalchemyrrmsqlalchemy.enginerrsqlalchemy.testing.assertionsr r r r r rrsqlalchemy.utilrrr$r'r,r.rr4contextmanagerr0rJrLrSrTr8r_rdrkrorrr9rrr{s" $%!:--211-% *O; HBG :?::2C 5:.!# ~"  5  IGr