o ?Ogsã@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 ú6/opt/alt/python310/lib64/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)ZshortDescriptionrÚjoinÚstr)rÚtestZdoc_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 r1Có  þzTextTestResult.addErrorcr.)NÚFAILÚF) rrÚ addFailurerrrr'rrr2r r r r7Lr4zTextTestResult.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 r9Us þzTextTestResult.addSkipcr.)Nzexpected failureÚx) rrÚaddExpectedFailurerrrr'rrr2r r r r=^r4z!TextTestResult.addExpectedFailurecr))Nzunexpected successÚu) rrÚaddUnexpectedSuccessrrrr'rrr(r r r r?gr-z#TextTestResult.addUnexpectedSuccesscCs@|js|jr|j ¡|j ¡| d|j¡| d|j¡dS)Nr/r5)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')rZflavourrAr$r3r r r r@ws  ûzTextTestResult.printErrorList)rrrrrErFr r%r&r,r1r7r9r=r?rDr@Ú __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ÚbufferrIÚwarningsÚ resultclass) rrrrrLrMrOrNrIr r r r ˆs  ÿzTextTestRunner.__init__cCs| |j|j|j¡Sr)rOrrrrCr 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Ú stopTestRunrFzRan %d test%s in %.3fsrr8ÚrZFAILEDz failures=%dz errors=%dZOKz skipped=%dzexpected failures=%dzunexpected successes=%dz (%s)z, r) rPrrLrMrIrNÚcatch_warningsÚ simplefilterÚfilterwarningsÚDeprecationWarningÚtimeÚ perf_counterrrDÚhasattrrrrFZtestsRunÚmapÚlenZexpectedFailuresÚunexpectedSuccessesÚskippedr Z wasSuccessfulrrBrAÚappendr"r')rr$rZ startTimerVrWZstopTimeZ timeTakenÚrunZ expectedFailsrbrcZresultsZinfosZfailedZerroredr r r reŸsŠ   þ   € þÿ é ÿ   þ ÿ  €   zTextTestRunner.run)NTrFFNN) rrrrrrOr rPrer r r r rH€sÿ þ rH)rrJr]rNrXrZsignalsrZ __unittestÚobjectrZ TestResultrrHr r r r Ús  c