Vռ}ddlZddlZddlZddZddZddZddZdZdZdZ d Z d Z d Z d Z d Z ddZGddZejddZddZddZddZ ddZdS)Nc4||ksJ|p|d|dS)z.Assert a == b, with repr messaging on failure.z != Nabmsgs /srv/buildsys-work-dir/castor/build_node/builder-2/WGSG1/unpkd_srcs/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/mako/testing/assertions.pyeq_r ) 6663-11-66666c4||ksJ|p|d|dS)z.Assert a != b, with repr messaging on failure.z == Nrrs r ne_r r r c0||vsJ|p|d|dS)z.Assert a in b, with repr messaging on failure.z not in Nrrs r in_rs) 66631AAAqq166666r c0||vsJ|p|d|dS)z2Assert a in not b, with repr messaging on failure.z is in Nrrs r not_inrs) A:::s4qqq!!4:::::r c`|j|jur|jsJd|d|jddSdS)Gassert 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. F Exception z> was correctly raised but did not set a cause, within context z as its cause.N) __context__ __cause____suppress_context__) exceptions r _assert_proper_exception_contextrs] Y%888. 9  yy)/// 1  u 9888r cbt|j|sJd|d|jd|ddS)rrz$ was correctly raised but has cause z., which does not have the expected cause type .N) isinstancer)r cause_clss r _assert_proper_cause_clsr/sY i)9 5 5 99i)))999 6 5r c&t||||SN_assert_raises except_cls callable_argskws r assert_raisesr)?s *ir : ::r c*t||||dS)NT check_contextr"r$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)rr"r%rr&r'kwargss r assert_raises_messager3Ms *iv3 G G GGr c,t|||||dS)NTrr,r"r1s r )assert_raises_message_with_proper_contextr6Qs( ItVD   r c,t||||||S)N)rrr")r%rrr&r'r2s r &assert_raises_message_with_given_causer8Ys( ItV    r Fctt||||5}||i|dddn #1swxYwY|jSr!)_expect_raiseserror)r%r&r'r2rr,recs r r#r#as  C B B#b 4"6"""############### 8Os (,,ceZdZdZdS)_ErrorContainerN)__name__ __module__ __qualname__r;rr r r>r>ps EEEr r>c#Kt}|rtjd} |Vd}n#|$r}||_d}|>t |}t j||t jsJ|d||t|||r|st|tt | dYd}~nd}~wwxYw~|s JddS)NrFTz !~ zutf-8z#Callable did not raise an exception) r>sysexc_infor;strresearchUNICODErrprintencode) r%rr,rr<are_we_already_in_a_tracebacksuccesserrerror_as_strings r r:r:ts>   B:(+ q(9%( ((( ?"#hhO9S/2:>>  A  >  $S) 4 4 4  2!> 2 ,S 1 1 1 c#hhoog&&''''''''(,  99999799s4C BCC c$t||SNr+r:r%r,s r expect_raisesrS *M B B BBr c&t|||SNr5rQr%rr,s r expect_raises_messagerXs *#] K K KKr Tc$t||SrPrQrRs r !expect_raises_with_proper_contextrZrTr c&t|||SrVrQrWs r )expect_raises_message_with_proper_contextr\s *#] K K KKr r!)NFN)F)T) contextlibrFrCr rrrrrr)r-r/r3r6r8r#r>contextmanagerr:rSrXrZr\rr r r_s .... .... 2222 5555    *    ;;;OOOPPP HHH       : : : :FCCCCLLLLCCCC $(LLLLLLr