g(dZddlZddlZddlZddlmZddlmZddlm Z dZ Gdd e Z Gd d ejZGd d e Zy)z Running testsN)result)_SubTest)registerResultTc$eZdZdZdZdZddZy)_WritelnDecoratorz@Used to decorate file-like objects with a handy 'writeln' methodc||_yN)stream)selfr s 6/opt/alt/python312/lib64/python3.12/unittest/runner.py__init__z_WritelnDecorator.__init__s  cL|dvr t|t|j|S)N)r __getstate__)AttributeErrorgetattrr )r attrs r __getattr__z_WritelnDecorator.__getattr__s' - - & &t{{4((rNcL|r|j||jdyN )write)r args r writelnz_WritelnDecorator.writelns  JJsO 4rr )__name__ __module__ __qualname____doc__rrrrr rrsJ) rrceZdZdZdZdZddfd ZdZfdZd Z fd Z fd Z fd Z fd Z fdZfdZfdZdZdZxZS)TextTestResultzhA test result class that can print formatted text results to a stream. Used by TextTestRunner. zF======================================================================zF----------------------------------------------------------------------N durationsctt| |||||_|dkD|_|dk(|_||_d|_||_y)zwConstruct a TextTestResult. Subclasses should accept **kwargs to ensure compatibility as the interface changes.rTN) superr"rr showAlldots descriptions_newliner$)r r r) verbosityr$ __class__s r rzTextTestResult.__init__&sK nd,V\9M  1} N ( "rc|j}|jr|rdjt||fSt|Sr)shortDescriptionr)joinstr)r testdoc_first_lines r getDescriptionzTextTestResult.getDescription1s=..0   99c$i89 9t9 rctt| ||jrg|jj |j ||jj d|jjd|_yy)N ... F) r&r" startTestr'r rr3flushr*r r1r,s r r6zTextTestResult.startTest8sd nd-d3 << KK  d11$7 8 KK  g & KK   !DM rct|t}|s |jr|js|jj |r|jj d|jj |j ||jj d|jj ||jjd|_y)Nz r5T) isinstancerr*r rrr3r7)r r1status is_subtests r _write_statuszTextTestResult._write_status@sh/ == ##% !!$' KK  d11$7 8 KK  g & F#  rc||jr?t|d|jr|j|dn|j|dnv|jrjt|d|jr|j j dn|j j d|j jtt|+|||y)NrFAILERRORFE) r' issubclassfailureExceptionr=r(r rr7r&r" addSubTest)r r1subtesterrr,s r rEzTextTestResult.addSubTestMs ?||c!fg&>&>?&&w7&&w8c!fg&>&>?KK%%c*KK%%c* !!# nd.tWcBrctt| ||jr|j |dy|j r6|j jd|j jyy)Nok.) r&r" addSuccessr'r=r(r rr7r8s r rKzTextTestResult.addSuccess\sW nd.t4 <<   tT * YY KK  c " KK   rctt| |||jr|j |dy|j r6|j jd|j jyy)Nr@rB) r&r"addErrorr'r=r(r rr7r r1rGr,s r rMzTextTestResult.addErrordsY nd,T37 <<   tW - YY KK  c " KK   rctt| |||jr|j |dy|j r6|j jd|j jyy)Nr?rA) r&r" addFailurer'r=r(r rr7rNs r rPzTextTestResult.addFailurelsY nd.tS9 <<   tV , YY KK  c " KK   rctt| |||jr"|j |dj |y|j r6|jjd|jjyy)Nz skipped {0!r}s) r&r"addSkipr'r=formatr(r rr7)r r1reasonr,s r rSzTextTestResult.addSkiptsd nd+D&9 <<   t_%;%;F%C D YY KK  c " KK   rc6tt| |||jr6|jj d|jj y|jr6|jjd|jj yy)Nzexpected failurex) r&r"addExpectedFailurer'r rr7r(rrNs r rXz!TextTestResult.addExpectedFailure|sl nd6tSA << KK   2 3 KK    YY KK  c " KK   rc4tt| ||jr6|jj d|jj y|jr6|jjd|jj yy)Nzunexpected successu) r&r"addUnexpectedSuccessr'r rr7r(rr8s r r[z#TextTestResult.addUnexpectedSuccesssj nd8> << KK   4 5 KK    YY KK  c " KK   rc|js |jr4|jj|jj |j d|j |j d|jt|dd}|rt|jj|j|D]/}|jjd|j|1|jj yy)Nr@r?unexpectedSuccessesr zUNEXPECTED SUCCESS: ) r(r'r rr7printErrorListerrorsfailuresr separator1r3)r r]r1s r printErrorszTextTestResult.printErrorss 99 KK   ! KK    GT[[1 FDMM2%d,A2F  KK   0+ ##&:4;N;Nt;T:U$VW, KK    rcz|D]\}}|jj|j|jj|d|j||jj|j|jjd|z|jj y)Nz: z%s)r rrar3 separator2r7)r flavourr_r1rGs r r^zTextTestResult.printErrorListsID# KK   0 KK  GD4G4G4M N O KK   0 KK  s + KK     r)rrrrrardrr3r6r=rErKrMrPrSrXr[rbr^ __classcell__)r,s@r r"r"sYJJEI #"  C         rr"c:eZdZdZeZ d ddddZdZdZdZ y) 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. NF) tb_localsr$c|tj}t||_||_||_||_||_||_| |_ ||_ |||_ yy)zConstruct a TextTestRunner. Subclasses should accept **kwargs to ensure compatibility as the interface changes. N) sysstderrrr r)r+failfastbufferrir$warnings resultclass) r r r)r+rmrnrprorir$s r rzTextTestRunner.__init__sc >ZZF'/ ("   ""   "*D  #rc |j|j|j|j|jS#t $r4|j|j|j|jcYSwxYw)Nr#)rpr r)r+r$ TypeError)r s r _makeResultzTextTestRunner._makeResultss 4##DKK1B1B$(NNdnn$N N 4##DKK1B1B$(NN4 4 4sz0TextTestRunner._printDurations..sQqTrT)keyreverserzSlowest test durationsrdFgMbP?z%.3fs10 zA (durations < 0.001s were hidden; use -v to show these durations))collectedDurationssortedr$r rhasattrrdr+)r rlshiddenr1elapseds r _printDurationszTextTestRunner._printDurationss((  F--> " >>A OT^^$B 45 6< ( KK   1 1 2MD'~~!go KK  g.? F G   KK  !B C KK   #rc|j}t||j|_|j|_|j|_t j 5|j rt j|j tj}t|dd}|| ||t|dd}|| tj}dddz }|j|j|j|t|dr%|jj!|j"|j$}|jj!d||dk7xrdxsd|fz|jj!d x} x} } t't(|j*|j,|j.f} | \} } } g} |j2sr|jj5d t)|j6t)|j8}}|r| j;d |z|rS| j;d |zn>|d k(r| s|jj5d n|jj5d| r| j;d| z| r| j;d| z| r| j;d| z| r/|jj!ddj=| dn|jj5d|jj?|S#t|dd}||wwxYw#1swYxYw#t0$rYwxYw)z&Run the given test case or test suite. startTestRunN stopTestRunrdzRan %d test%s in %.3fsrrRr|rFAILEDz failures=%dz errors=%dz NO TESTS RANOKz skipped=%dzexpected failures=%dzunexpected successes=%dz (z, )r) rsrrmrnrirocatch_warnings simplefiltertime perf_counterrrbr$rrr rrdtestsRunmaplenexpectedFailuresr]skippedr wasSuccessfulrr`r_appendr/r7)r r1r startTimerrstopTime timeTakenrun expectedFailsr]rresultsinfosfailederroreds r rzTextTestRunner.runs !!#v--  >>  $ $ &}}%%dmm4))+I"6>4@L' "V %fmTB *M((*H'y(  >> %   ( 6< ( KK   1 1 2oo 4 #("2s"8b)DE F 899 9+g B# 7 7 & : : & 01G ;B 7M.#v##% KK  h '!&//2C 4FGF ]V34 [723 AXg KK  n - KK  d #  LL/ 0  LL/-? @  LL25HH I  KK  499U+; = > KK  d #  e&fmTB *M+' &B   s7#AM2:M+M221M?M//M22M<? N  N )NTrFFNN) rrrrr"rprrsrrr rr rhrhs3 !KABJN+#t+*4$,Drrh)rrkrror|rcasersignalsr __unittestobjectr TestResultr"rhr rr rsN #     C V&&C L@V@r