grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026a ´iÈ4ã@s|dZddlZddlmZddlmZdZdd„ZGd d „d eƒZGd d„deƒZ Gd d „d eƒZ dd„Z Gdd„deƒZ dS)Ú TestSuiteéNé)Úcase)ÚutilTcCst||dd„ƒ}|ƒdS)NcSsdS©N©rrrú&/usr/lib64/python3.9/unittest/suite.pyÚ óz!_call_if_exists..)Úgetattr)ÚparentÚattrÚfuncrrrÚ_call_if_exists src@sneZdZdZdZddd„Zdd„Zdd „Zd d „Zd d „Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„ZdS)Ú BaseTestSuitezNA simple test suite that doesn't provide class or module shared fixtures. TrcCsg|_d|_| |¡dS©Nr)Ú_testsÚ_removed_testsÚaddTests)ÚselfÚtestsrrrÚ__init__szBaseTestSuite.__init__cCsdt |j¡t|ƒfS)Nz <%s tests=%s>)rÚstrclassÚ __class__Úlist©rrrrÚ__repr__szBaseTestSuite.__repr__cCs t||jƒstSt|ƒt|ƒkSr)Ú isinstancerÚNotImplementedr)rÚotherrrrÚ__eq__s zBaseTestSuite.__eq__cCs t|jƒSr)ÚiterrrrrrÚ__iter__"szBaseTestSuite.__iter__cCs$|j}|D]}|r || ¡7}q |Sr)rÚcountTestCases)rZcasesÚtestrrrr#%s zBaseTestSuite.countTestCasescCsLt|ƒstd t|ƒ¡ƒ‚t|tƒr|j| ¡7_d|j|<dS)z2Stop holding a reference to the TestCase at index.r#N)rr&Úhasattrrr#)rr4r$rrrr2Es  z BaseTestSuite._removeTestAtIndexcOs|j|i|¤ŽSr©r5)rÚargsÚkwdsrrrÚ__call__SszBaseTestSuite.__call__cCs|D] }| ¡qdS)ú7Run the tests without collecting errors in a TestResultN)Údebugr,rrrr<VszBaseTestSuite.debugN)r)Ú__name__Ú __module__Ú __qualname__Ú__doc__r1rrr r"r#r-rr5r2r:r<rrrrrs   rc@s^eZdZdZddd„Zdd„Zdd„Zd d „Zd d „Zddd„Z ddd„Z dd„Z dd„Z d S)ra³A 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. FcCsÔd}t|ddƒdurd|_}t|ƒD]ˆ\}}|jr8q°t|ƒrˆ| ||¡| ||¡| ||¡|j|_ t|jddƒs&t|ddƒrˆq&|s–||ƒn|  ¡|j r&|  |¡q&|rÐ| d|¡|  |¡d|_|S)NFÚ_testRunEnteredTÚ_classSetupFailedÚ_moduleSetUpFailed)r rAr/r0Ú _isnotsuiteÚ_tearDownPreviousClassÚ_handleModuleFixtureÚ_handleClassSetUprÚ_previousTestClassr<r1r2Ú_handleModuleTearDown)rr3r<ZtopLevelr4r$rrrr5fs2     ÿ    z TestSuite.runcCstƒ}| |d¡dS)r;TN)Ú _DebugResultr5)rr<rrrr<‡szTestSuite.debugc CsZt|ddƒ}|j}||krdS|jr(dSt|ddƒr8dSd}z d|_WntyXYn0t|ddƒ}t|ddƒ}|du�rVt|dƒzÂz |ƒWnltyþ}zTt|tƒr®‚d}z d|_WntyÎYn0t   |¡} |  ||d| ¡WYd}~n d}~00|�r<|du�r<|ƒ|j D]} |j || dd| | d ��qWt|d ƒn t|d ƒ0dS) NrHÚ__unittest_skip__FÚ setUpClassÚdoClassCleanupsÚ _setupStdoutTr©ÚinfoÚ_restoreStdout) r rrCrBr&rÚ ExceptionrrJrrÚ"_createClassOrModuleLevelExceptionÚtearDown_exceptions) rr$r3Ú previousClassÚ currentClassZfailedrLrMÚeÚ classNameÚexc_inforrrrGŽsR             þ  þ zTestSuite._handleClassSetUpcCs"d}t|ddƒ}|dur|j}|S)NrH)r r>)rr3ÚpreviousModulerUrrrÚ_get_previous_module¼s  zTestSuite._get_previous_modulec Cs0| |¡}|jj}||krdS| |¡d|_ztj|}WntyPYdS0t|ddƒ}|du�r,t |dƒz¬z |ƒWnFt yÄ}z.t |t ƒrš‚d|_|  ||d|¡WYd}~n d}~00|j�rz t ¡Wn6t �y}z|  ||d|¡WYd}~n d}~00Wt |dƒn t |dƒ0dS)NFÚ setUpModulerNTrQ)r[rr>rIrCÚsysÚmodulesÚKeyErrorr rrRrrJrSrÚdoModuleCleanups)rr$r3rZZ currentModuleÚmoduler\rWrrrrFÄsB        þ þzTestSuite._handleModuleFixtureNcCs$|›d|›d�}| ||||¡dS)Nz (ú))Ú_addClassOrModuleLevelException)rr3ÚexcZ method_namer rPÚ errorNamerrrrSész,TestSuite._createClassOrModuleLevelExceptioncCs^t|ƒ}t|ddƒ}|dur8t|tjƒr8||t|ƒƒn"|sN| |t ¡¡n | ||¡dS)NÚaddSkip) Ú _ErrorHolderr rrZSkipTestr.ZaddErrorr]rY)rr3Ú exceptionrerPÚerrorrfrrrrcîs z)TestSuite._addClassOrModuleLevelExceptionc Cs| |¡}|durdS|jr dSztj|}WntyBYdS0t|dƒz¾t|ddƒ}|dur°z |ƒWn@ty®}z(t|t ƒrŠ‚|  ||d|¡WYd}~n d}~00z t   ¡WnBt�yþ}z(t|t ƒrÚ‚|  ||d|¡WYd}~n d}~00Wt|dƒn t|dƒ0dS)NrNÚtearDownModulerQ) r[rCr]r^r_rr rRrrJrSrr`)rr3rZrarjrWrrrrIús@      þ  þzTestSuite._handleModuleTearDownc Cs^t|ddƒ}|j}||ks"|dur&dSt|ddƒr6dSt|ddƒrFdSt|ddƒrVdSt|ddƒ}t|ddƒ}|dur‚|dur‚dSt|dƒzÀ|durìz |ƒWnJtyê}z2t|tƒr¼‚t |¡}| ||d|¡WYd}~n d}~00|du�r@|ƒ|j D]<} t|tƒ�r| d ‚t |¡}|j|| d d|| d ��qWt|d ƒn t|d ƒ0dS) NrHrBFrCrKÚ tearDownClassrMrNrrOrQ) r rrrRrrJrrrSrT) rr$r3rUrVrkrMrWrXrYrrrrEsN          þ     ý z TestSuite._tearDownPreviousClass)F)N)N) r=r>r?r@r5r<rGr[rFrSrcrIrErrrrr\s !.&ÿ ÿ #c@sTeZdZdZdZdd„Zdd„Zdd„Zd d „Zd d „Z d d„Z dd„Z dd„Z dS)rgz¾ Placeholder for a TestCase inside a result. As far as a TestResult is concerned, this looks exactly like a unit test. Used to insert arbitrary errors into a test suite run. NcCs ||_dSr©Ú description)rrmrrrrTsz_ErrorHolder.__init__cCs|jSrrlrrrrÚidWsz_ErrorHolder.idcCsdSrrrrrrÚshortDescriptionZsz_ErrorHolder.shortDescriptioncCs d|jfS)Nzrlrrrrr]sz_ErrorHolder.__repr__cCs| ¡Sr)rnrrrrÚ__str__`sz_ErrorHolder.__str__cCsdSrr©rr3rrrr5csz_ErrorHolder.runcCs | |¡Srr7rqrrrr:hsz_ErrorHolder.__call__cCsdSrrrrrrr#ksz_ErrorHolder.countTestCases) r=r>r?r@ZfailureExceptionrrnrorrpr5r:r#rrrrrgHs rgcCs&z t|ƒWnty YdS0dS)z?A crude way to tell apart testcases and suites with duck-typingTF)r!r&)r$rrrrDns   rDc@seZdZdZdZdZdZdS)rJzCUsed by the TestSuite to hold previous class when running in debug.NF)r=r>r?r@rHrCr0rrrrrJwsrJ) r@r]ÚrrZ __unittestrÚobjectrrrgrDrJrrrrÚs  Lm&