g#`dZddlZddlZddlZddlmZddlmZdZdZ dZ d Z Gd d e Z y) zTest result objectN)utilwrapsTc.tfd}|S)NcVt|ddr|j|g|i|S)NfailfastF)getattrstop)selfargskwmethods 6/opt/alt/python312/lib64/python3.12/unittest/result.pyinnerzfailfast..inner s- 4U + IIKd(T(R((r)rrs` rr r s  6])) Lrz Stdout: %sz Stderr: %sceZdZdZdZdZdZddZdZdZ dZ dZ d Z d Z d Zed Zed ZdZdZdZdZedZdZdZdZdZdZdZdZdZy) TestResultaHolder for test result information. Test results are automatically managed by the TestCase and TestSuite classes, and do not need to be explicitly manipulated by writers of tests. Each instance holds the total number of tests run, and collections of failures and errors that occurred among those test runs. The collections contain tuples of (testcase, exceptioninfo), where exceptioninfo is the formatted traceback of the error that occurred. NFcd|_g|_g|_d|_g|_g|_g|_g|_d|_d|_ d|_ d|_ d|_ tj|_tj |_d|_y)NFr)r failureserrorstestsRunskippedexpectedFailuresunexpectedSuccessescollectedDurations shouldStopbuffer tb_locals_stdout_buffer_stderr_buffersysstdout_original_stdoutstderr_original_stderr _mirrorOutput)r stream descriptions verbositys r__init__zTestResult.__init__&s     "#% "$ "" #  # "rcy)z#Called by TestRunner after test runNr s r printErrorszTestResult.printErrors8rc\|xjdz c_d|_|jy)z-Called when the given test is about to be runrFN)rr' _setupStdoutr tests r startTestzTestResult.startTest;s$  " rc|jri|j2tj|_tj|_|jt _|jt _yy)N)rr!ioStringIOr r"r#r%r.s rr2zTestResult._setupStdoutAsP ;;""*&(kkm#&(kkm#,,CJ,,CJ rcy)zpCalled once before any tests are executed. See startTest for a method called before each test. Nr-r.s r startTestRunzTestResult.startTestRunIr0rc2|jd|_y)z'Called when the given test has been runFN)_restoreStdoutr'r3s rstopTestzTestResult.stopTestOs "rc|jrQ|jrtjj }tj j }|r8|j ds|dz }|jjt|z|r8|j ds|dz }|jjt|z|jt_|jt_|jjd|jj|jjd|jjyy)N r)rr'r"r#getvaluer%endswithr$write STDOUT_LINEr& STDERR_LINEr seektruncater!)r outputerrors rr<zTestResult._restoreStdoutTs ;;!!,,. ++-!??40$))// f0DE >>$/ ))// e0CD..CJ..CJ    $ $Q '    ( ( *    $ $Q '    ( ( *% rcy)zmCalled once after all tests are executed. See stopTest for a method called after each test. Nr-r.s r stopTestRunzTestResult.stopTestRunir0rcl|jj||j||fd|_y)zmCalled when an error has occurred. 'err' is a tuple of values as returned by sys.exc_info(). TN)rappend_exc_info_to_stringr'r r4errs raddErrorzTestResult.addErroros0 D$":":3"EFG!rcl|jj||j||fd|_y)zdCalled when an error has occurred. 'err' is a tuple of values as returned by sys.exc_info().TN)rrLrMr'rNs r addFailurezTestResult.addFailurews0 dD$<$|jj||fy)zCalled when a test is skipped.N)rrL)r r4reasons raddSkipzTestResult.addSkips T6N+rc^|jj||j||fy)z/Called when an expected failure/error occurred.N)rrLrMrNs raddExpectedFailurezTestResult.addExpectedFailures+ $$ 4++C6 7 9rc:|jj|y)z5Called when a test was expected to fail, but succeed.N)rrLr3s raddUnexpectedSuccesszTestResult.addUnexpectedSuccesss   ''-rcjt|dr'|jjt||fyy)zCalled when a test finished to run, regardless of its outcome. *test* is the test case corresponding to the test method. *elapsed* is the time represented in seconds, and it includes the execution of cleanup functions. rN)hasattrrrLstr)r r4elapseds r addDurationzTestResult.addDurations1 4- .  # # * *CIw+? @ /rct|jt|jcxk(xrdk(ncxr't|d xst|jdk(S)z/Tells whether or not this result was a success.rr)lenrrrbrr.s r wasSuccessfulzTestResult.wasSuccessfulsS T]]#s4;;'7<1<5T#8994T--.!3 6rcd|_y)z+Indicates that the tests should be aborted.TN)rr.s rr zTestResult.stops rc"|\}}}|j||||}tj||||jd}t |j }|j rtjj}tjj} |r.|jds|dz }|jt|z| r.| jds| dz } |jt| zdj|S)z>Converts a sys.exc_info()-style tuple of values into a string.T)capture_localscompactr?)_clean_tracebacks tracebackTracebackExceptionrlistformatrr"r#r@r%rArLrCrDjoin) r rOr4exctypevaluetbtb_emsgLinesrGrHs rrMzTestResult._exc_info_to_strings   # #GUB =++ UB>>49 & ;;ZZ((*FJJ'')Et,dNF f 45~~d+TME e 34wwx  rcd}d}|||fg}t|h}|r|j\}}}|r1|j|r |j}|r|j|r ||jur|j ||r|}d}n||_|o|j|jfD]T} | t| |vs|jt| | | j f|jt| V|r|S)NTF) idpop_is_relevant_tb_leveltb_nextrU_remove_unittest_tb_frames __traceback__ __cause__ __context__rLtypeadd) r rtrurvr4retfirstexcsseencs rrnzTestResult._clean_tracebackss%$%5 {#'88: WeR33B7ZZ33B7$/////3&(# //5+<+<=A}Ad): T!Wa$ABA>#* rc2d|jjvS)N __unittest)tb_frame f_globals)r rvs rr|z TestResult._is_relevant_tb_levelsr{{4444rcd}|r3|j|s"|}|j}|r|j|s"|d|_yy)aTruncates usercode tb at the first unittest frame. If the first frame of the traceback is in user code, the prefix up to the first unittest frame is returned. If the first frame is already in the unittest module, the traceback is not modified. N)r|r})r rvprevs rr~z%TestResult._remove_unittest_tb_framessM33B7DB33B7  DL rcdtj|j|jt |j t |j fzS)Nz!<%s run=%i errors=%i failures=%i>)rstrclass __class__rrgrrr.s r__repr__zTestResult.__repr__sA3 dnn-t}}c$++>NDMM"$$ %r)NNN)__name__ __module__ __qualname____doc___previousTestClass_testRunEntered_moduleSetUpFailedr+r/r5r2r:r=r<rJr rPrRrWrYr\r^r`rerhr rMrnr|r~rr-rrrrs O#$. - # +* """" &" ,9 .. A6!,85  %rr)rr7r"rormr functoolsrrr rCrDobjectrr-rrrs;     h%h%r