ó K9•Qc@sdZddlZddddddd d gZdefd „ƒYZd „Zd „Zd„Zd„Zddd„Z d„Z d„Z dS(s8Tools not exempt from being descended into in tracebacksiÿÿÿÿNtmake_decoratortraisest set_tracettimedt with_setupt TimeExpiredtistesttnottestcBseZRS((t__name__t __module__(((s9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyR scs‡fd†}|S(s¨ Wraps a test decorator so as to properly replicate metadata of the decorated function, including nose's additional stuff (namely, setup and teardown). cs—tˆdƒrˆj}n ˆj}ˆj|_ˆj|_ˆj|_t|dƒsiˆjj|_ny ||_Wnt k r’||_nX|S(Ntcompat_func_nametcompat_co_firstlineno( thasattrR Rt__dict__t__doc__R t func_codetco_firstlinenoR t TypeError(tnewfunctname(tfunc(s9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pytdecorates        ((RR((Rs9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyRscs;djgˆD]}|j^q ƒ‰‡‡fd†}|S(s‘Test must raise one of expected exceptions to pass. Example use:: @raises(TypeError, ValueError) def test_raises_type_error(): raise TypeError("This test passes") @raises(Exception) def test_that_fails_by_passing(): pass If you want to test many assertions about exceptions in a single test, you may want to use `assert_raises` instead. s or cs7ˆj‰‡‡‡‡fd†}tˆƒ|ƒ}|S(NcsNyˆ||ŽWnˆk r$n&‚nXdˆˆf}t|ƒ‚dS(Ns%s() did not raise %s(tAssertionError(targtkwtmessage(t exceptionsRRtvalid(s9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyR:s (RR(RR(RR(RRs9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyR8s  (tjoinR(RteR((RRs9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyR's%cCsMddl}ddl}|j}|j|_|jƒj|jƒjƒdS(sÂCall pdb.set_trace in the calling frame, first restoring sys.stdout to the real output stream. Note that sys.stdout is NOT reset to whatever it was before the call once pdb is done! iÿÿÿÿN(tpdbtsyststdoutt __stdout__tPdbRt _getframetf_back(RRR ((s9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyRIs     cs‡fd†}|S(s•Test must finish within specified time limit to pass. Example use:: @timed(.1) def test_that_fails(): time.sleep(.2) cs(‡‡fd†}tˆƒ|ƒ}|S(NcsNtjƒ}ˆ||Ž}tjƒ}||ˆkrJtdˆƒ‚n|S(NsTime limit (%s) exceeded(ttimeR(RRtstarttresulttend(Rtlimit(s9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyR_s   (R(RR(R)(Rs9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyR^s((R)R((R)s9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyRUs  cCs||d„}|S(sDecorator to add setup and/or teardown methods to a test function:: @with_setup(setup, teardown) def test_something(): " ... " Note that `with_setup` is useful *only* for test functions, not for test methods or inside of TestCase subclasses. cs”ˆrHt|dƒr<|j‰‡‡fd†}||_qHˆ|_nˆrt|dƒr„|j‰‡‡fd†}||_qˆ|_n|S(NtsetupcsˆƒˆƒdS(N(((t_old_sR*(s9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyt_systteardowncsˆƒˆƒdS(N(((t_old_tR-(s9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyt_t‚s(R R*R-(RR*R-R,R/((R+R.R*R-s9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyRus      ((R*R-R((s9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyRks cCs t|_|S(s5Decorator to mark a function or method as a test (tTruet__test__(R((s9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyRŒs cCs t|_|S(s;Decorator to mark a function or method as *not* a test (tFalseR1(R((s9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyR“s ( RR%t__all__RRRRRRtNoneRRR(((s9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyts   " !