o […dsã@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 ú&/usr/lib/python3.10/unittest/runner.pyÚ__init__s z_WritelnDecorator.__init__cCs|dvrt|ƒ‚t|j|ƒS)N)rÚ __getstate__)ÚAttributeErrorÚgetattrr)rÚattrr r r Ú __getattr__s z_WritelnDecorator.__getattr__NcCs|r| |¡| d¡dS©NÚ )Úwrite)rÚargr r r Úwritelns z_WritelnDecorator.writelnr)Ú__name__Ú __module__Ú __qualname__Ú__doc__r rrr r r r r s rcs”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__cCs,| ¡}|jr|rd t|ƒ|f¡St|ƒSr)ÚshortDescriptionrÚjoinÚstr)rÚtestÚdoc_first_liner r r ÚgetDescription,s zTextTestResult.getDescriptioncsFtt|ƒ |¡|jr!|j | |¡¡|j d¡|j ¡dSdS)Nz ... )rrÚ startTestrrrr'Úflush©rr%r r r r(3s  ýzTextTestResult.startTestcóTtt|ƒ |¡|jr|j d¡|j ¡dS|jr(|j d¡|j ¡dSdS)NÚokÚ.) rrÚ addSuccessrrrr)rrr*r r r r.:ó  þzTextTestResult.addSuccesscóVtt|ƒ ||¡|jr|j d¡|j ¡dS|jr)|j d¡|j ¡dSdS)NÚERRORÚE) rrÚaddErrorrrrr)rr©rr%Úerrr r r r3Có  þzTextTestResult.addErrorcr0)NÚFAILÚF) rrÚ addFailurerrrr)rrr4r r r r9Lr6zTextTestResult.addFailurecs\tt|ƒ ||¡|jr|j d |¡¡|j ¡dS|jr,|j  d¡|j ¡dSdS)Nz skipped {0!r}Ús) rrÚaddSkiprrrÚformatr)rr)rr%Úreasonr r r r;Us þzTextTestResult.addSkipcr0)Nzexpected failureÚx) rrÚaddExpectedFailurerrrr)rrr4r r r r?^r6z!TextTestResult.addExpectedFailurecr+)Nzunexpected successÚu) rrÚaddUnexpectedSuccessrrrr)rrr*r r r rAgr/z#TextTestResult.addUnexpectedSuccesscCs@|js|jr|j ¡|j ¡| d|j¡| d|j¡dS)Nr1r7)rrrrr)ÚprintErrorListÚerrorsÚfailures©rr r r Ú printErrorsps   zTextTestResult.printErrorscCsb|D],\}}|j |j¡|j d|| |¡f¡|j |j¡|j d|¡|j ¡qdS)Nz%s: %sz%s)rrÚ separator1r'Ú separator2r))rÚflavourrCr%r5r r r rBws  ûzTextTestResult.printErrorList)rrrrrGrHr r'r(r.r3r9r;r?rArFrBÚ __classcell__r r r r rs     rc@s8eZdZdZeZ  d 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 CsR|durtj}t|ƒ|_||_||_||_||_||_||_ |dur'||_ dSdS)z‰Construct a TextTestRunner. Subclasses should accept **kwargs to ensure compatibility as the interface changes. N) ÚsysÚstderrrrrrÚfailfastÚbufferrLÚwarningsÚ resultclass) rrrrrOrPrRrQrLr r r r ˆs  ÿzTextTestRunner.__init__cCs| |j|j|j¡Sr)rRrrrrEr r r Ú _makeResultœszTextTestRunner._makeResultc Cs^| ¡}t|ƒ|j|_|j|_|j|_t ¡V|jr/t |j¡|jdvr/tjdt ddt   ¡}t |ddƒ}|dur@|ƒz||ƒWt |ddƒ}|durS|ƒnt |ddƒ}|durb|ƒwwt   ¡}Wdƒn1sqwY||}|  ¡t|dƒrŠ|j |j¡|j}|j d ||d kr˜d p™d |f¡|j ¡d } } } z tt|j|j|jfƒ} Wn ty¿Ynw| \} } } g} | ¡sï|j d¡t|jƒt|jƒ}}|rå|  d|¡|rî|  d|¡n|j d¡| rþ|  d| ¡| r|  d| ¡| r|  d| ¡| r"|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Ú stopTestRunrHzRan %d test%s in %.3fsrr:ÚrÚFAILEDz failures=%dz errors=%dÚOKz skipped=%dzexpected failures=%dzunexpected successes=%dz (%s)z, r) rSrrOrPrLrQÚcatch_warningsÚ simplefilterÚfilterwarningsÚDeprecationWarningÚtimeÚ perf_counterrrFÚhasattrrrrHÚtestsRunÚmapÚlenÚexpectedFailuresÚunexpectedSuccessesÚskippedr Ú wasSuccessfulrrDrCÚappendr#r))rr%rÚ startTimerYrZÚstopTimeÚ timeTakenÚrunÚ expectedFailsrirjÚresultsÚinfosÚfailedÚerroredr r r rpŸsŠ   þ   € þÿ é ÿ   þ ÿ  €   zTextTestRunner.run)NTrFFNN) rrrrrrRr rSrpr r r r rK€sÿ þ rK)rrMrbrQr[rÚsignalsrÚ __unittestÚobjectrÚ TestResultrrKr r r r Ús  c