Vc$dZddlZddlZddlZddlmZddlmZddlm Z dZ Gdd e Z Gd d ej ZGd d e ZdS)z Running testsN)result)_SubTest)registerResultTc&eZdZdZdZdZddZdS)_WritelnDecoratorz@Used to decorate file-like objects with a handy 'writeln' methodc||_dSN)stream)selfr s (/usr/lib64/python3.11/unittest/runner.py__init__z_WritelnDecorator.__init__s  cR|dvrt|t|j|S)N)r __getstate__)AttributeErrorgetattrr )r attrs r __getattr__z_WritelnDecorator.__getattr__s0 - - ' && &t{4(((rNc^|r|||ddSN )write)r args r writelnz_WritelnDecorator.writelns1   JJsOOO 4rr )__name__ __module__ __qualname____doc__rrrrr rrsLJJ))) rrceZdZdZdZdZfdZdZfdZdZ 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----------------------------------------------------------------------ctt||||||_|dk|_|dk|_||_d|_dS)NrT)superr"rr showAlldots descriptions_newline)r r r' verbosity __class__s r rzTextTestResult.__init__&sU nd##,,V\9MMM  1} N ( rc|}|jr&|r$dt||fSt|Sr)shortDescriptionr'joinstr)r testdoc_first_lines r getDescriptionzTextTestResult.getDescription.sN..00    99c$ii899 9t99 rc8tt|||jri|j|||jd|jd|_dSdS)N ... F) r$r" startTestr%r rr1flushr(r r/r*s r r4zTextTestResult.startTest5s nd##--d333 < " K  d11$77 8 8 8 K  g & & & K     !DMMM  " "rct|t}|s|jr|js|j|r|jd|j|||jd|j||jd|_dS)Nz r3T) isinstancerr(r rrr1r5)r r/status is_subtests r _write_statuszTextTestResult._write_status=sh//  ' '= & ##%%% ( !!$''' K  d11$77 8 8 8 K  g & & & F###  rc||jrIt|d|jr||dn||dnp|jrit|d|jr|jdn|jd|jtt| |||dS)NrFAILERRORFE) r% issubclassfailureExceptionr;r&r rr5r$r" addSubTest)r r/subtesterrr*s r rCzTextTestResult.addSubTestJs  $| $c!fg&>??9&&w7777&&w8888 $c!fg&>??+K%%c****K%%c*** !!### nd##..tWcBBBBBrctt|||jr||ddS|jr5|jd|jdSdS)Nok.) r$r" addSuccessr%r;r&r rr5r6s r rIzTextTestResult.addSuccessYs nd##..t444 <   tT * * * * * Y K  c " " " K         rctt||||jr||ddS|jr5|jd|jdSdS)Nr>r@) r$r"addErrorr%r;r&r rr5r r/rEr*s r rKzTextTestResult.addErroras nd##,,T3777 <   tW - - - - - Y K  c " " " K         rctt||||jr||ddS|jr5|jd|jdSdS)Nr=r?) r$r" addFailurer%r;r&r rr5rLs r rNzTextTestResult.addFailureis nd##..tS999 <   tV , , , , , Y K  c " " " K         rc6tt||||jr+||d|dS|jr5|jd|j dSdS)Nz skipped {0!r}s) r$r"addSkipr%r;formatr&r rr5)r r/reasonr*s r rQzTextTestResult.addSkipqs nd##++D&999 <   t_%;%;F%C%C D D D D D Y K  c " " " K         rcJtt||||jr5|jd|jdS|jr5|jd|jdSdS)Nzexpected failurex) r$r"addExpectedFailurer%r rr5r&rrLs r rVz!TextTestResult.addExpectedFailureys nd##66tSAAA < K   2 3 3 3 K        Y K  c " " " K         rcHtt|||jr5|jd|jdS|jr5|jd|jdSdS)Nzunexpected successu) r$r"addUnexpectedSuccessr%r rr5r&rr6s r rYz#TextTestResult.addUnexpectedSuccesss nd##88>>> < K   4 5 5 5 K        Y K  c " " " K         rc|js|jr2|j|j|d|j|d|jt|dd}|ro|j|j |D]2}|jd| |3|jdSdS)Nr>r=unexpectedSuccessesr zUNEXPECTED SUCCESS: ) r&r%r rr5printErrorListerrorsfailuresr separator1r1)r r[r/s 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          rcb|D]\}}|j|j|j|d|||j|j|jd|z|jdS)Nz: z%s)r rr_r1 separator2r5)r flavourr]r/rEs r r\zTextTestResult.printErrorLists  ID# K   0 0 0 K  GGGD4G4G4M4M4M N O O O K   0 0 0 K  s + + + K         r)rrrrr_rbrr1r4r;rCrIrKrNrQrVrYr`r\ __classcell__)r*s@r r"r"sWJJ"""""    C C C C C                                         rr"c4eZdZdZeZ 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_localsc| tj}t||_||_||_||_||_||_||_ | ||_ dSdS)zConstruct a TextTestRunner. Subclasses should accept **kwargs to ensure compatibility as the interface changes. N) sysstderrrr r'r)failfastbufferrgwarnings resultclass) r r r'r)rkrlrnrmrgs r rzTextTestRunner.__init__sm  ZF'// ("   "   +*D    + +rcN||j|j|jSr )rnr r'r))r s r _makeResultzTextTestRunner._makeResults! T->OOOrc|}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.)defaultalwaysmodulezPlease use assert\w+ instead.)categorymessage startTestRunN stopTestRunrbzRan %d test%s in %.3fsrrPrFAILEDz failures=%dz errors=%dOKz skipped=%dzexpected failures=%dzunexpected successes=%dz (z, )r) rprrkrlrgrmcatch_warnings simplefilterfilterwarningsDeprecationWarningtime perf_counterrr`hasattrr rrbtestsRunmaplenexpectedFailuresr[skippedr wasSuccessfulrr^r]appendr-r5)r r/r startTimerwrxstopTime timeTakenrun expectedFailsr[rresultsinfosfailederroreds r rzTextTestRunner.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) rrrrr"rnrrprr rr rfrfsr !KABJN+#+++++(PPPGGGGGrrf)rrirrmryrcasersignalsr __unittestobjectr TestResultr"rfr rr rs ######           @ @ @ @ @ V&@ @ @ FfffffVfffffr