id*ddlZddlZddlZddZddZddZddZdZdZdZ d Z d Z d Z d Z d Z ddZGddZejddZddZddZddZ ddZdS)NcdS)z.Assert a == b, with repr messaging on failure.Nabmsgs L/opt/cloudlinux/venv/lib/python3.11/site-packages/mako/testing/assertions.pyeq_r cdS)z.Assert a != b, with repr messaging on failure.Nrrs r ne_r r r cdS)z.Assert a in b, with repr messaging on failure.Nrrs r in_rr r cdS)z2Assert a in not b, with repr messaging on failure.Nrrs r not_inrr r c8|j|jur |jsdSdSdSaGassert 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. N) __context__ __cause____suppress_context__) exceptions r _assert_proper_exception_contextrs2 Y%888. 9888888r cdSrr)r cause_clss r _assert_proper_cause_clsr/r r c&t||||SN_assert_raises except_cls callable_argskws r assert_raisesr&?s *ir : ::r c*t||||dS)NT check_contextrr!s r !assert_raises_with_proper_contextr*Cs *ir N N NNr c*t|||||S)N)rr)r"rr#r$r%s r assert_raises_with_given_causer,Gs *irY O O OOr c*t|||||S)N)rrr"rr#r$kwargss r assert_raises_messager0Ms *iv3 G G GGr c,t|||||dS)NTrr)rr.s r )assert_raises_message_with_proper_contextr3Qs( ItVD   r c,t||||||S)N)rrr)r"rrr#r$r/s r &assert_raises_message_with_given_causer5Ys( ItV    r Fctt||||5}||i|dddn #1swxYwY|jSr)_expect_raiseserror)r"r#r$r/rr)recs r r r as  C B B#b 4"6"""############### 8Os (,,ceZdZdZdS)_ErrorContainerN)__name__ __module__ __qualname__r8rr r r;r;ps EEEr r;c#nKt}|rtjd} |Vd}n#|$rx}||_d}|t |}|t |||r|st |tt |dYd}~nd}~wwxYw~dS)NrFTzutf-8) r;sysexc_infor8strrrprintencode) r"rr)rr9are_we_already_in_a_tracebacksuccesserrerror_as_strings r r7r7ts   B:(+ q(9%( ((( ?"#hhO  $S) 4 4 4  2!> 2 ,S 1 1 1 c#hhoog&&''''''''(, s4B1A.B,,B1c$t||SNr(r7r"r)s r expect_raisesrM *M B B BBr c&t|||SNr2rKr"rr)s r expect_raises_messagerRs *#] K K KKr Tc$t||SrJrKrLs r !expect_raises_with_proper_contextrTrNr c&t|||SrPrKrQs r )expect_raises_message_with_proper_contextrVs *#] K K KKr r)NFN)F)T) contextlibrer@r rrrrrr&r*r,r0r3r5r r;contextmanagerr7rMrRrTrVrr r rZs .... .... 2222 5555    *    ;;;OOOPPP HHH       : : : :FCCCCLLLLCCCC $(LLLLLLr