B t `3@sdZddlZddlZddlZddlmZddlmZddlm Z ddl m Z m Z m Z ddlZeeZdgZGdddejZGd d d ejZGd d d eZGd ddeZdS)znose unittest.TestCase subclasses. It is not necessary to subclass these classes when writing tests; they are used internally by nose.loader.TestLoader to create test cases from test functions and methods in test classes. N) isfunction)Config)Failure) resolve_name test_addresstry_runTestc@seZdZdZdZdddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZeedddZddZddZddZdS) rzThe universal test case wrapper. When a plugin sees a test, it will always see an instance of this class. To access the actual test case that will be run, access the test property of the nose.case.Test instance. FNcCsbt|tjstd|||_|dkr,t}||_d|_d|_||_ |j |_ d|_ t j |dS)NzTnose.case.Test called with argument %r that is not callable. A callable is required.) isinstance collectionsCallable TypeErrortestrconfigZtbinfoZcapturedOutput resultProxypluginsZpassedunittestTestCase__init__)selfr rrr-/tmp/pip-unpacked-wheel-cjhnoqsi/nose/case.pyrs z Test.__init__cOs |j||S)N)run)rargkwargrrr__call__-sz Test.__call__cCs"|j|}|dk r|St|jS)N)rZtestNamestrr )rnamerrr__str__0s z Test.__str__cCs d|jS)NzTest(%r))r )rrrr__repr__6sz Test.__repr__cCs.y |j}Wntk rYn X||jdS)z>Called after test is complete (after result.stopTest) N) afterTestAttributeErrorr )rresultrrrrr9s  zTest.afterTestcCs.y |j}Wntk rYn X||jdS)zr:r)rrNr rrE method_namerrrr<s   zMethodTestCase.__init__cCsN|\}}t|dr|j}n|j}d|jj|jj|f}|rJd||f}|S)NrKz%s.%s.%sz%s%s)r=r)rKr5rQr,)rr@rrrrrr`s   zMethodTestCase.__str__cCs"|jdk rt|jSt|jSdS)zReturn a round-trip name for this test, a name that can be fed back as input to loadTestByName and (assuming the same plugin configuration) result in the loading of this test. N)rErrN)rrrrr(ns  zMethodTestCase.addresscCs|jS)N)rQ)rrrrr-xszMethodTestCase._contextz Get context (class) of this testcCst|jddS)N)rHrF)rrR)rrrrrF}szMethodTestCase.setUpcCst|jddS)N)rJrG)rrR)rrrrrGszMethodTestCase.tearDowncCs"|jr|j|jfS|j|jfSdS)agGet the descriptors of the test method: the method and arguments that will be used to construct the test name. In most cases, this is the method itself and no arguments. For tests generated by generator methods, the original (generator) method and args passed to the generated method or function are returned. N)rErrN)rrrrr=s zMethodTestCase._descriptors)r5r,r6r7r8rLrrrr(r-r9r*rFrGr=rrrrrM4s$  rM)r7loggingr#rinspectrZ nose.configrZ nose.failurerZ nose.utilrrrr getLoggerr5log__all__rrr:rBrMrrrrs    *b