PL i)ddlZddlZddlZddZddZddZddZdZdZdZ d Z d Z d Z d Z d Z ddZGddZej"ddZddZddZddZ ddZy)Nc.||k(sJ|xs|d|y)z.Assert a == b, with repr messaging on failure.z != Nabmsgs ]/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/mako/testing/assertions.pyeq_r  6-3-1--6c.||k7sJ|xs|d|y)z.Assert a != b, with repr messaging on failure.z == Nrrs r ne_r r r c,||vsJ|xs|d|y)z.Assert a in b, with repr messaging on failure.z not in Nrrs r in_rs 6131Aq116r c,||vsJ|xs|d|y)z2Assert a in not b, with repr messaging on failure.z is in Nrrs r not_inrs A:4s4q!44:r c~|j|jur%|jsJd|d|jdyy)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. 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_contextrsI Y%8%88.. )// 1 u/ 9r cft|j|sJd|d|jd|dy)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/s5 i))9 5 i))9 6 5r ct||||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 NNr c"t|||||S)N)rr")r%rr&r'r(s r assert_raises_with_given_causer/Gs *irY OOr c"t|||||S)N)rr"r%rr&r'kwargss r assert_raises_messager3Ms *iv3 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 ct||||5}||i|ddd|jS#1swYjSxYwr!)_expect_raiseserror)r%r&r'r2rr,recs r r#r#asC  C B#b4"6"# 88O# 88Os ,AceZdZdZy)_ErrorContainerN)__name__ __module__ __qualname__r;rr r r>r>os Er r>c#Kt}|rtjd} |d}~|sJdy#|$r}||_d}|sysexc_infor;strresearchUNICODErrprintencode) r%rr,rr<are_we_already_in_a_tracebacksuccesserrerror_as_strings r r:r:ss  B(+ q(9%(.  99973 ( ?"#hO99S/2::> A >  $S) 4 !> ,S 1 c#hoog&''(s+$C8 CCBC C CCct||SNr+r:r%r,s r expect_raisesrS *M BBr ct|||SNr5rQr%rr,s r expect_raises_messagerXs *#] KKr ct||SrPrQrRs r !expect_raises_with_proper_contextrZrTr ct|||SrVrQrWs r )expect_raises_message_with_proper_contextr\s *#] KKr r!)NFN)F)T) contextlibrFrCr rrrrrr)r-r/r3r6r8r#r>contextmanagerr:rSrXrZr\rr r r_s . . 2 5  *  ;OP H    : :FCLC $(Lr