fF!hdZddlZddlZddlZddlmZddlmZdZdZ dZ d Z Gd d e Z dS) zTest result objectN)utilwrapsTc<tfd}|S)Ncft|ddr||g|Ri|S)NfailfastF)getattrstop)selfargskwmethods 6/opt/alt/python311/lib64/python3.11/unittest/result.pyinnerzfailfast..inner sD 4U + +  IIKKKvd(T(((R(((r)rrs` rr r s3 6]]))))]) Lrz Stdout: %sz Stderr: %sceZdZdZdZdZdZddZdZdZ dZ dZ d Z d Z d Zed Zed ZdZdZdZdZedZdZdZdZdZdZdZdZdS) 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|_d|_d|_d|_ d|_ d|_ tj |_tj|_d|_dS)NFr)r failureserrorstestsRunskippedexpectedFailuresunexpectedSuccesses shouldStopbuffer tb_locals_stdout_buffer_stderr_buffersysstdout_original_stdoutstderr_original_stderr _mirrorOutput)r stream descriptions verbositys r__init__zTestResult.__init__&s|     "#%  "" #  # "rcdS)z#Called by TestRunner after test runNr s r printErrorszTestResult.printErrors7rc\|xjdz c_d|_|dS)z-Called when the given test is about to be runrFN)rr& _setupStdoutr tests r startTestzTestResult.startTest:s2  " rc|jr[|j0tj|_tj|_|jt _|jt _dSdS)N)rr ioStringIOrr!r"r$r-s rr1zTestResult._setupStdout@sS ; -"*&(kmm#&(kmm#,CJ,CJJJ  - -rcdS)zpCalled once before any tests are executed. See startTest for a method called before each test. Nr,r-s r startTestRunzTestResult.startTestRunHr/rc<|d|_dS)z'Called when the given test has been runFN)_restoreStdoutr&r2s rstopTestzTestResult.stopTestNs" "rc|jrI|jrtj}tj}|r<|ds|dz }|jt|z|r<|ds|dz }|j t|z|jt_|j t_|j d|j |j d|jdSdS)N r)rr&r!r"getvaluer$endswithr#write STDOUT_LINEr% STDERR_LINErseektruncater )r outputerrors rr;zTestResult._restoreStdoutSs> ; +! E,,.. ++--F!??400'$)// f0DEEEE >>$//& )// e0CDDD.CJ.CJ   $ $Q ' ' '   ( ( * * *   $ $Q ' ' '   ( ( * * * * *% + +rcdS)zmCalled once after all tests are executed. See stopTest for a method called after each test. Nr,r-s r stopTestRunzTestResult.stopTestRunhr/rct|j||||fd|_dS)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 r3errs raddErrorzTestResult.addErrorns= D$":":3"E"EFGGG!rct|j||||fd|_dS)zdCalled when an error has occurred. 'err' is a tuple of values as returned by sys.exc_info().TN)rrKrLr&rMs r addFailurezTestResult.addFailurevs= dD$<$|j||fdS)zCalled when a test is skipped.N)rrK)r r3reasons raddSkipzTestResult.addSkips" T6N+++++rcf|j||||fdS)z/Called when an expected failure/error occurred.N)rrKrLrMs raddExpectedFailurezTestResult.addExpectedFailures? $$ 4++C66 7 9 9 9 9 9rc:|j|dS)z5Called when a test was expected to fail, but succeed.N)rrKr2s raddUnexpectedSuccesszTestResult.addUnexpectedSuccesss!  ''-----rct|jt|jcxkodknco(t|d pt|jdkS)z/Tells whether or not this result was a success.rr)lenrrhasattrrr-s r wasSuccessfulzTestResult.wasSuccessfulsj T]##s4;'7'7<<<<1<<<<5T#89994T-..!3 6rcd|_dS)z+Indicates that the tests should be aborted.TN)rr-s rr zTestResult.stops rcP|\}}}|||||}tj||||jd}t |}|jrtj }tj } |r7| ds|dz }| t|z| r7| ds| dz } | t| zd|S)z>Converts a sys.exc_info()-style tuple of values into a string.T)capture_localscompactr>)_clean_tracebacks tracebackTracebackExceptionrlistformatrr!r"r?r$r@rKrBrCjoin) r rNr3exctypevaluetbtb_emsgLinesrFrGs rrLzTestResult._exc_info_to_strings   # #GUB = =+ UB>4999 && ; 5Z((**FJ''))E 6t,,#dNF f 4555 5~~d++"TME e 3444wwx   rcd}d}|||fg}t|h}|r|\}}}|r3||r|j}|r||||jur|||r|}d}n||_|p|j|jfD]a} | ]t| |vrL| t| | | jf| t| b||S)NTF) idpop_is_relevant_tb_leveltb_nextrT_remove_unittest_tb_frames __traceback__ __cause__ __context__rKtypeadd) r rorprqr3retfirstexcsseencs rrizTestResult._clean_tracebackssC%$%5 { (#'88:: WeR 33B77 Z 33B77 $/////333 )&(# /5+<=((A}Ad):): T!WWa$ABBBA) (* rcd|jjvS)N __unittest)tb_frame f_globals)r rqs rrwz TestResult._is_relevant_tb_levelsr{444rcd}|r5||s |}|j}|r|| | d|_dSdS)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)rwrx)r rqprevs rryz%TestResult._remove_unittest_tb_framessl 33B77 DB 33B77   DLLL  rcdtj|j|jt |jt |jfzS)Nz!<%s run=%i errors=%i failures=%i>)rstrclass __class__rrarrr-s r__repr__zTestResult.__repr__s@3 dn--t}c$+>N>NDM""$$ %r)NNN)__name__ __module__ __qualname____doc___previousTestClass_testRunEntered_moduleSetUpFailedr*r.r4r1r9r<r;rIr rOrQrVrXr[r]r_rcr rLrirwryrr,rrrrs  O####"... ---   ### +++*   ""X"""X" &&&"   ,,,999 ..X.666!!!,8555    %%%%%rr)rr6r!rjrhr functoolsrrr rBrCobjectrr,rrrs     \%\%\%\%\%\%\%\%\%\%r