ñÕYfï(ã@s¬dZddlZddlmZddlmZdZdd„ZGd d „d eƒZGd d„deƒZ Gd d „d eƒZ dd„Z Gdd„deƒZ dS)Ú TestSuiteéNé)Úcase)ÚutilTcCs#t||dd„ƒ}|ƒdS)NcSsdS)N©rrrú3/opt/alt/python35/lib64/python3.5/unittest/suite.pyÚ sz!_call_if_exists..)Úgetattr)ÚparentÚattrÚfuncrrrÚ_call_if_exists sr c@s£eZdZdZdZfdd„Zdd„Zdd„Zd d „Zd d „Z d d„Z dd„Z dd„Z dd„Z dd„Zdd„ZdS)Ú BaseTestSuitezNA simple test suite that doesn't provide class or module shared fixtures. TcCs#g|_d|_|j|ƒdS)Nr)Ú_testsÚ_removed_testsÚaddTests)ÚselfÚtestsrrrÚ__init__s  zBaseTestSuite.__init__cCs dtj|jƒt|ƒfS)Nz <%s tests=%s>)rÚstrclassÚ __class__Úlist)rrrrÚ__repr__szBaseTestSuite.__repr__cCs,t||jƒstSt|ƒt|ƒkS)N)Ú isinstancerÚNotImplementedr)rÚotherrrrÚ__eq__szBaseTestSuite.__eq__cCs t|jƒS)N)Úiterr)rrrrÚ__iter__"szBaseTestSuite.__iter__cCs4|j}x$|D]}|r||jƒ7}qW|S)N)rÚcountTestCases)rZcasesÚtestrrrr%s   zBaseTestSuite.countTestCasescCsnt|ƒs'tdjt|ƒƒƒ‚t|tƒrZt|tjt fƒrZtdƒ‚|j j |ƒdS)Nz{} is not callablezNTestCases and TestSuites must be instantiated before passing them to addTest()) ÚcallableÚ TypeErrorÚformatÚreprrÚtypeÚ issubclassrZTestCaserrÚappend)rr rrrÚaddTest,s   zBaseTestSuite.addTestcCs=t|tƒrtdƒ‚x|D]}|j|ƒq"WdS)Nz0tests must be an iterable of tests, not a string)rÚstrr"r()rrr rrrr6s  zBaseTestSuite.addTestscCsKxDt|ƒD]6\}}|jr#P||ƒ|jr |j|ƒq W|S)N)Ú enumerateÚ shouldStopÚ_cleanupÚ_removeTestAtIndex)rÚresultÚindexr rrrÚrun<s   zBaseTestSuite.runc Cs[y|j|}Wntk r%Yn2Xt|dƒrJ|j|jƒ7_d|j|ós,      *z TestSuite._tearDownPreviousClassN) r6r7r8r9r0r5r@rPr?rIrBr>rrrrr\s !     c@s|eZdZdZdZdd„Zdd„Zdd„Zd d „Zd d „Z d d„Z dd„Z dd„Z dS)rWz¾ 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 ||_dS)N)Ú description)rr\rrrrsz_ErrorHolder.__init__cCs|jS)N)r\)rrrrÚidsz_ErrorHolder.idcCsdS)Nr)rrrrÚshortDescription sz_ErrorHolder.shortDescriptioncCsd|jfS)Nz)r\)rrrrr#sz_ErrorHolder.__repr__cCs |jƒS)N)r])rrrrÚ__str__&sz_ErrorHolder.__str__cCsdS)Nr)rr.rrrr0)sz_ErrorHolder.runcCs |j|ƒS)N)r0)rr.rrrr4.sz_ErrorHolder.__call__cCsdS)Nrr)rrrrr1sz_ErrorHolder.countTestCases) r6r7r8r9ZfailureExceptionrr]r^rr_r0r4rrrrrrWs        rWc Cs+yt|ƒWntk r&dSYnXdS)z?A crude way to tell apart testcases and suites with duck-typingTF)rr")r rrrr=4s   r=c@s(eZdZdZdZdZdZdS)rCzCUsed by the TestSuite to hold previous class when running in debug.NF)r6r7r8r9rAr<r+rrrrrC=s rC) r9rRÚrrZ __unittestr ÚobjectrrrWr=rCrrrrÚs  L²&