g4dZddlZddlmZddlmZdZdZGdd eZGd deZ Gd d eZ d Z GddeZ y) TestSuiteN)case)utilTc.t||d}|y)NcyNr 5/opt/alt/python312/lib64/python3.12/unittest/suite.pyz!_call_if_exists.. sr )getattr)parentattrfuncs r _call_if_existsr s 64 .DFr cXeZdZdZdZddZdZdZdZdZ dZ d Z d Z d Z d Zd Zy) BaseTestSuitezNA simple test suite that doesn't provide class or module shared fixtures. TcBg|_d|_|j|yNr)_tests_removed_testsaddTests)selftestss r __init__zBaseTestSuite.__init__s  er c`dtj|jdt|dS)N)rstrclass __class__listrs r __repr__zBaseTestSuite.__repr__s"&--"?dLLr cht||jstSt|t|k(Sr ) isinstancer!NotImplementedr")rothers r __eq__zBaseTestSuite.__eq__s)%0! !DzT%[((r c,t|jSr )iterrr#s r __iter__zBaseTestSuite.__iter__"sDKK  r cX|j}|D]}|s||jz }|Sr )rcountTestCases)rcasestests r r.zBaseTestSuite.countTestCases%s4##D,,.. r c t|s#tdjt|t |t r+t |tjtfr td|jj|y)Nz{} is not callablezNTestCases and TestSuites must be instantiated before passing them to addTest()) callable TypeErrorformatreprr&type issubclassrTestCaserrappendrr0s r addTestzBaseTestSuite.addTest,sj~077T CD D dD !j26--1K'M?@ @ 4 r cjt|tr td|D]}|j|y)Nz0tests must be an iterable of tests, not a string)r&strr3r;)rrr0s r rzBaseTestSuite.addTests6s. eS !NO OD LL r ct|D]:\}}|jr|S|||js*|j|<|Sr ) enumerate shouldStop_cleanup_removeTestAtIndex)rresultindexr0s r runzBaseTestSuite.run<sL$T?KE4    L}}''. +  r c |j|}t|dr#|xj|jz c_d|j|<y#t$rYywxYw)z2Stop holding a reference to the TestCase at index.r.N)rhasattrrr.r3)rrDr0s r rBz BaseTestSuite._removeTestAtIndexEs^ &;;u%Dt-.##t':':'<<#!%DKK    sA AAc&|j|i|Sr rE)rargskwdss r __call__zBaseTestSuite.__call__Sstxx&&&r c2|D]}|jy)7Run the tests without collecting errors in a TestResultN)debugr:s r rOzBaseTestSuite.debugVsD JJLr N)r )__name__ __module__ __qualname____doc__rArr$r)r,r.r;rrErBrLrOr r r rrsDH M) !!  &'r rcPeZdZdZd dZdZdZdZdZ d dZ d d Z d Z d Z y)raA test suite is a composite test consisting of a number of TestCases. For use, create an instance of TestSuite, then add test case instances. When all tests have been added, the suite can be passed to a test runner, such as TextTestRunner. It will run the individual test cases in the order in which they were added, aggregating the results. When subclassing, do not forget to call the base class constructor. c4d}t|dddur dx|_}t|D]\}}|jrnt |rl|j |||j |||j|||j|_ t|jdds t|ddr|s ||n|j|js|j||r*|j d||j|d|_|S)NF_testRunEnteredT_classSetupFailed_moduleSetUpFailed)rrVr?r@ _isnotsuite_tearDownPreviousClass_handleModuleFixture_handleClassSetUpr!_previousTestClassrOrArB_handleModuleTearDown)rrCrOtopLevelrDr0s r rEz TestSuite.runfs 6,e 4 =04 4F "X$T?KE4  4 ++D&9))$7&&tV4,0NN)DNN,?GF$8%@V  }}''.)+,   ' 'f 5  & &v .%*F " r c<t}|j|dy)rNTN) _DebugResultrE)rrOs r rOzTestSuite.debugs r ct|dd}|j}||k(ry|jryt|ddryd} d|_t|dd}t|dd}|Wt |d ||r3|1||jD]} |j|| dd | t |d yy#t$rYwxYw#t $r^}t|trd} d|_n#t$rYnwxYwtj|} |j||d| Yd}~d}~wwxYw#t |d wxYw) Nr]__unittest_skip__F setUpClassdoClassCleanups _setupStdoutTrinfo_restoreStdout) rr!rXrWr3r Exceptionr&rarr "_createClassOrModuleLevelExceptiontearDown_exceptions) rr0rC previousClass currentClassfailedrdree classNameexc_infos r r\zTestSuite._handleClassSetUps~( !,0A4H  ! FN 3 : GLo9#%$0$D$D?? & \9%-@/%E  (891 "   ! G!&,7!F9= 6$ $ l ;I;;FA D( C>- B98B9< C;,C61D(6C;;D(> D%D D( D%%D((D6Nc<|d|d}|j||||y)Nz ())_addClassOrModuleLevelException)rrCexc method_namerrh errorNames r rkz,TestSuite._createClassOrModuleLevelExceptions("m2fXQ/  ,,VS)TJr ct|}t|dd}|-t|tjr||t |y|s%|j |tjy|j ||y)NaddSkip) _ErrorHolderrr&rSkipTestr=addErrorrxrr)rrC exceptionrrherrorrs r rz)TestSuite._addClassOrModuleLevelExceptions`Y'&)T2  :i#G E3y> *s||~6t,r c$|j|}|y|jry tj|}t |d t |dd}| | tjt |dy#t$rYywxYw#t$r/}t|tr|j||d|Yd}~dd}~wwxYw#t$r/}t|tr|j||d|Yd}~d}~wwxYw#t |dwxYw)NrftearDownModuleri) rurXrxryrzrrrjr&rarkrr{)rrCrtr}rrps r r^zTestSuite._handleModuleTearDowns+226:  !   $ $  [[0F / 6$V-=tDN)L"$ H%%' F$4 51   !L!&,7;;FA9D>CD C>%C94D9C>>DDct|dd}|j}||k(s|yt|ddryt|ddryt|ddryt|dd}t|dd}||yt|d | ||[||jD]E} t |t r| d t j|}|j|| d d|| Gt|d y#t$rD}t |t rt j|}|j||d|Yd}~d}~wwxYw#t|d wxYw) Nr]rWFrXrc tearDownClassrerfrrgri) rr!rrjr&rarr rkrl) rr0rCrmrnrrerprqrrs r rZz TestSuite._tearDownPreviousClassst(rsW    IFIXi6 i6X$6$L6r