a ÕDOgsã@sndZddlZddlZddlZddlmZddlmZdZGdd„de ƒZ Gd d „d ej ƒZ Gd d „d e ƒZ dS) z Running testséNé)Úresult)ÚregisterResultTc@s*eZdZdZdd„Zdd„Zd dd„ZdS) Ú_WritelnDecoratorz@Used to decorate file-like objects with a handy 'writeln' methodcCs ||_dS©N)Ústream)Úselfr©r ú4/opt/alt/python39/lib64/python3.9/unittest/runner.pyÚ__init__sz_WritelnDecorator.__init__cCs|dvrt|ƒ‚t|j|ƒS)N)rÚ __getstate__)ÚAttributeErrorÚgetattrr)rÚattrr r r Ú __getattr__sz_WritelnDecorator.__getattr__NcCs|r| |¡| d¡dS©NÚ )Úwrite)rÚargr r r Úwritelns z_WritelnDecorator.writeln)N)Ú__name__Ú __module__Ú __qualname__Ú__doc__r rrr r r r r srcs”eZdZdZdZdZ‡fdd„Zdd„Z‡fdd „Z‡fd d „Z ‡fd d „Z ‡fdd„Z ‡fdd„Z ‡fdd„Z ‡fdd„Zdd„Zdd„Z‡ZS)ÚTextTestResultzhA test result class that can print formatted text results to a stream. Used by TextTestRunner. zF======================================================================zF----------------------------------------------------------------------cs8tt|ƒ |||¡||_|dk|_|dk|_||_dS)Nr)Úsuperrr rÚshowAllÚdotsÚ descriptions)rrrÚ verbosity©Ú __class__r r r %s   zTextTestResult.__init__cCs0| ¡}|jr$|r$d t|ƒ|f¡St|ƒSdSr)ZshortDescriptionrÚjoinÚstr)rÚtestZdoc_first_liner r r ÚgetDescription,s zTextTestResult.getDescriptioncsBtt|ƒ |¡|jr>|j | |¡¡|j d¡|j ¡dS)Nz ... )rrÚ startTestrrrr%Úflush©rr$r r r r&3s  zTextTestResult.startTestcsNtt|ƒ |¡|jr.|j d¡|j ¡n|jrJ|j d¡|j ¡dS)NÚokÚ.) rrÚ addSuccessrrrr'rrr(r r r r+:s   zTextTestResult.addSuccesscsPtt|ƒ ||¡|jr0|j d¡|j ¡n|jrL|j d¡|j ¡dS)NÚERRORÚE) rrÚaddErrorrrrr'rr©rr$Úerrr r r r.Cs   zTextTestResult.addErrorcsPtt|ƒ ||¡|jr0|j d¡|j ¡n|jrL|j d¡|j ¡dS)NÚFAILÚF) rrÚ addFailurerrrr'rrr/r r r r3Ls   zTextTestResult.addFailurecsVtt|ƒ ||¡|jr6|j d |¡¡|j ¡n|jrR|j  d¡|j ¡dS)Nz skipped {0!r}Ús) rrÚaddSkiprrrÚformatr'rr)rr$Úreasonr r r r5Us  zTextTestResult.addSkipcsPtt|ƒ ||¡|jr0|j d¡|j ¡n|jrL|j d¡|j ¡dS)Nzexpected failureÚx) rrÚaddExpectedFailurerrrr'rrr/r r r r9^s   z!TextTestResult.addExpectedFailurecsNtt|ƒ |¡|jr.|j d¡|j ¡n|jrJ|j d¡|j ¡dS)Nzunexpected successÚu) rrÚaddUnexpectedSuccessrrrr'rrr(r r r r;gs   z#TextTestResult.addUnexpectedSuccesscCs@|js |jr |j ¡|j ¡| d|j¡| d|j¡dS)Nr,r1)rrrrr'ÚprintErrorListÚerrorsÚfailures©rr r r Ú printErrorsps    zTextTestResult.printErrorscCsb|D]X\}}|j |j¡|j d|| |¡f¡|j |j¡|j d|¡|j ¡qdS)Nz%s: %sz%s)rrÚ separator1r%Ú separator2r')rZflavourr=r$r0r r r r<ws  zTextTestResult.printErrorList)rrrrrArBr r%r&r+r.r3r5r9r;r@r<Ú __classcell__r r r r rs   rc@s4eZdZdZeZd ddœdd„Zd d „Zd d „ZdS)ÚTextTestRunnerzÉA test runner class that displays results in textual form. It prints out the names of tests as they are run, errors as they occur, and a summary of the results at the end of the test run. NTrF)Ú tb_localsc CsN|durtj}t|ƒ|_||_||_||_||_||_||_ |durJ||_ dS)z‰Construct a TextTestRunner. Subclasses should accept **kwargs to ensure compatibility as the interface changes. N) ÚsysÚstderrrrrrÚfailfastÚbufferrEÚwarningsÚ resultclass) rrrrrHrIrKrJrEr r r r ˆs zTextTestRunner.__init__cCs| |j|j|j¡Sr)rKrrrr?r r r Ú _makeResultœszTextTestRunner._makeResultc Csl| ¡}t|ƒ|j|_|j|_|j|_t ¡ª|jr^t |j¡|jdvr^tjdt ddt   ¡}t |ddƒ}|dur€|ƒz&||ƒWt |ddƒ}|durÄ|ƒnt |ddƒ}|durÂ|ƒ0t   ¡}Wdƒn1sà0Y||}|  ¡t|dƒr|j |j¡|j}|j d ||d kr4d p6d |f¡|j ¡d } } } ztt|j|j|jfƒ} Wnty„Yn 0| \} } } g} | ¡sê|j d¡t|jƒt|jƒ}}|rÔ|  d|¡|rö|  d|¡n |j d¡| r |  d| ¡| r|  d| ¡| r2|  d| ¡| rR|j dd | ¡f¡n |j d¡|j ¡|S)z&Run the given test case or test suite.)ÚdefaultÚalwaysÚmodulezPlease use assert\w+ instead.)ÚcategoryÚmessageÚ startTestRunNÚ stopTestRunrBzRan %d test%s in %.3fsrr4ÚrZFAILEDz failures=%dz errors=%dZOKz skipped=%dzexpected failures=%dzunexpected successes=%dz (%s)z, r) rLrrHrIrErJÚcatch_warningsÚ simplefilterÚfilterwarningsÚDeprecationWarningÚtimeÚ perf_counterrr@ÚhasattrrrrBZtestsRunÚmapÚlenZexpectedFailuresÚunexpectedSuccessesÚskippedr Z wasSuccessfulrr>r=Úappendr"r')rr$rZ startTimerRrSZstopTimeZ timeTakenÚrunZ expectedFailsr^r_ZresultsZinfosZfailedZerroredr r r raŸs€   þ   þ & ÿ  þ       zTextTestRunner.run)NTrFFNN) rrrrrrKr rLrar r r r rD€sÿþ rD)rrFrYrJrTrZsignalsrZ __unittestÚobjectrZ TestResultrrDr r r r Ús  c