Vc$csdZddlZddlZddlZddlmZddlmZddlm Z dZ Gdd e Z Gd d ej ZGd d e ZdS)z Running testsN)result)_SubTest)registerResultTcs&eZdZdZdZdZddZdS)_WritelnDecoratorz@Used to decorate file-like objects with a handy 'writeln' methodcs||_dSN)stream)selfr (/usr/lib64/python3.11/unittest/runner.py__init__z_WritelnDecorator.__init__s  csR|dvrt|t|j|S)N)rZ __getstate__)AttributeErrorgetattrr)rZattrr r __getattr__z_WritelnDecorator.__getattr__s0 - - ' && &t{4(((r Ncs^|r|||ddSN )write)rZargr r writelnz_WritelnDecorator.writelns1   JJsOOO 4r r)__name__ __module__ __qualname____doc__r rrr r rrsLJJ))) r rcseZdZdZdZdZfdZdZfdZdZ fdZ fd Z fd Z fd Z fd Zfd ZfdZdZdZxZS)TextTestResultzhA test result class that can print formatted text results to a stream. Used by TextTestRunner. zF======================================================================zF----------------------------------------------------------------------cstt||||||_|dk|_|dk|_||_d|_dS)NrT)superrr rshowAlldots descriptions_newline)rrr verbosity __class__ r r zTextTestResult.__init__&sU nd##,,V\9MMM  1} N ( r cs|}|jr&|r$dt||fSt|Sr)ZshortDescriptionrjoinZstr)rtestZdoc_first_line r getDescriptionzTextTestResult.getDescription.sN..00    99c$ii899 9t99 r cs8tt|||jri|j|||jd|jd|_dSdS)N ... F) rr startTestrrrr%flushrrr#r  r r'zTextTestResult.startTest5s nd##--d333 < " K  d11$77 8 8 8 K  g & & & K     !DMMM  " "r cst|t}|s|jr|js|j|r|jd|j|||jd|j||jd|_dS)Nz r&T)Z isinstancerrrrrr%r()rr#ZstatusZ is_subtests r _write_statuszTextTestResult._write_status=sh//  ' '= & ##%%% ( !!$''' K  d11$77 8 8 8 K  g & & & F###  r cs||jrIt|d|jr||dn||dnp|jrit|d|jr|jdn|jd|jtt| |||dS)NrFAILERRORFE) rZ issubclassZfailureExceptionr+rrrr(rr addSubTest)rr#Zsubtesterrr r!r r0zTextTestResult.addSubTestJs  $| $c!fg&>??9&&w7777&&w8888 $c!fg&>??+K%%c****K%%c*** !!### nd##..tWcBBBBBr cstt|||jr||ddS|jr5|jd|jdSdS)NZokz.) rr addSuccessrr+rrrr(r)r*r r2zTextTestResult.addSuccessYs nd##..t444 <   tT * * * * * Y K  c " " " K         r ctt||||jr||ddS|jr5|jd|jdSdS)Nr-r/) rraddErrorrr+rrrr(rr#r1r  r r4zTextTestResult.addErroras nd##,,T3777 <   tW - - - - - Y K  c " " " K         r cr3)Nr,r.) rr addFailurerr+rrrr(r5r6r r7zTextTestResult.addFailureis nd##..tS999 <   tV , , , , , Y K  c " " " K         r cs6tt||||jr+||d|dS|jr5|jd|j dSdS)Nz skipped {0!r}s) rraddSkiprr+Zformatrrrr()rr#Zreasonr r6r r9zTextTestResult.addSkipqs nd##++D&999 <   t_%;%;F%C%C D D D D D Y K  c " " " K         r csJtt||||jr5|jd|jdS|jr5|jd|jdSdS)Nzexpected failureZx) rraddExpectedFailurerrrr(rrr5r6r r:z!TextTestResult.addExpectedFailureys nd##66tSAAA < K   2 3 3 3 K        Y K  c " " " K         r csHtt|||jr5|jd|jdS|jr5|jd|jdSdS)Nzunexpected successZu) rraddUnexpectedSuccessrrrr(rrr)r*r r;z#TextTestResult.addUnexpectedSuccesss nd##88>>> < K   4 5 5 5 K        Y K  c " " " K         r cs|js|jr2|j|j|d|j|d|jt|dd}|ro|j|j |D]2}|jd| |3|jdSdS)Nr-r,unexpectedSuccessesrzUNEXPECTED SUCCESS: ) rrrrr(printErrorListerrorsfailuresr separator1r%)rr<r#r$r printErrorszTextTestResult.printErrorss 9   K   ! ! ! K      GT[111 FDM222%d,A2FF  K   0 0 0+ X X ##$V4;N;Nt;T;T$V$VWWWW K          r csb|D]\}}|j|j|j|d|||j|j|jd|z|jdS)Nz: z%s)rrr@r% separator2r()rZflavourr>r#r1s r r=zTextTestResult.printErrorLists  ID# K   0 0 0 K  GGGD4G4G4M4M4M N O O O K   0 0 0 K  s + + + K         r )rrrrr@rBr r%r'r+r0r2r4r7r9r:r;rAr=Z __classcell__)r s@r rrsWJJ"""""    C C C C C                                         r rcs4eZdZdZeZ d dddZdZd ZdS) TextTestRunnerzA 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_localscs| tj}t||_||_||_||_||_||_||_ | ||_ dSdS)zConstruct a TextTestRunner. Subclasses should accept **kwargs to ensure compatibility as the interface changes. N) sysZstderrrrrrfailfastbufferrDwarnings resultclass) rrrrrFrGrIrHrDs r r zTextTestRunner.__init__sm  ZF'// ("   "   +*D    + +r csN||j|j|jSr)rIrrr)rs r _makeResultzTextTestRunner._makeResults! T->OOOr cs|}t||j|_|j|_|j|_t j5|jr>t j|j|jdvrt jdtdtj }t|dd}| | ||t|dd}| |n##t|dd}| |wwxYwtj }dddn #1swxYwY||z }|j t|dr|j|j|j}|jd ||d krd pd |fz|jd x} x} } t't(|j|j|jf} | \} } } n#t0$rYnwxYwg} |jsw|jdt)|jt)|j}}|r| d|z|r| d|zn|jd| r| d| z| r| d| z| r| d| z| r2|jdd| dn|jd|j|S)z&Run the given test case or test suite.)ZdefaultZalwaysZmodulezPlease use assert\w+ instead.)ZcategoryZmessage startTestRunN stopTestRunrBzRan %d test%s in %.3fsrr8rZFAILEDz failures=%dz errors=%dZOKz skipped=%dzexpected failures=%dzunexpected successes=%dz (z, z)r) rJrrFrGrDrHZcatch_warningsZ simplefilterZfilterwarningsZDeprecationWarningtimeZ perf_counterrrAZhasattrrrrBZtestsRunZmapZlenZexpectedFailuresr<skippedr Z wasSuccessfulrr?r>Zappendr"r()rr#rZ startTimerKrLZstopTimeZ timeTakenrunZ expectedFailsr<rOZresultsZinfosZfailedZerroreds r rPzTextTestRunner.runs!!##v-  >  $ & & + +} F%dm444 =$99F+H%7$DFFFF)++I"6>4@@L   "V %fmTBB "KMMM&fmTBB "KMMMM"(**H/ + + + + + + + + + + + + + + +0y(  6< ( ( 3 K   1 2 2 2o 4 #("2s"8b)DE F F F 899 9+g B# 7 & : & 011G ;B 7M.    D  #v#%% $ K  h ' ' '!&/22C 4F4FGF 5 ]V3444 4 [72333 K  d # # #  1 LL/ 0 0 0  A LL/-? @ @ @  J LL25HH I I I  $ K   499U+;+;+;+; = > > > > K  d # # #  s=A6D= C;D=; DD==EE'H HH)NTrFFNN) rrrrrrIr rJrPrr r rCrCsr !KABJN+#+++++(PPPGGGGGr rC)rrErNrHrMrZcaserZsignalsrZ __unittestZobjectrZ TestResultrrCrr r rQs ######           @ @ @ @ @ V&@ @ @ FfffffVfffffr