ó ê=Nc@sdZddlmZddlmZddlZddd„ƒYZdejfd„ƒYZd dd „ƒYZ d dd „ƒYZ d ee fd„ƒYZ ddd„ƒYZ d„Z d„Zd„Zedƒd„Zdejfd„ƒYZedkrejƒndS(s Test cases for explorer iÿÿÿÿ(tunittest(texplorerNt SomeDohickeycBseZd„Zd„ZRS(cGs||jd/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pyt__init__ scCs|jS(N(R(R((s>/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pytbip#s(t__name__t __module__RR(((s>/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pyRs t TestBrowsercBseZd„Zd„ZRS(cCs2tj|_|jjƒdtdƒg|_dS(Ns&How many stairs must a man climb down?i*(Rt explorerPooltpooltclearRt testThing(R((s>/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pytsetUp(s  cCs{|jj|jdƒ}|j|jt|jƒƒ|j|jdƒ|jƒd}|j|jt|jdƒƒdS(sFollowing a chain of Explorers.RiN(R t getExplorerRt assertEqualtidt identifiert get_elements(Rtxplorertdxplorer((s>/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pyt test_chain.s (R R RR(((s>/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pyR 's tWatchercBs2eZdZd„Zd„Zd„Zd„ZRS(icCs g|_dS(N(tlinks(R((s>/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pyR9scCs|jj|ƒdS(N(Rtappend(Rtolink((s>/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pytreceiveBrowserObject<scCst|jƒ|_dS(N(tlenRtzero(R((s>/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pytsetZero?scCst|jƒ|jS(N(RRR(R((s>/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pyRBs(R R RRRR R(((s>/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pyR7s    tSetattrDohickeycBseZd„ZRS(cCs6tt|ƒƒ}|jƒdj|ƒ|j|/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pyt __setattr__Gs (R R R)(((s>/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pyR!Fst MiddleMancBseZRS((R R (((s>/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pyR*Lst FIXME_WatchcBs,eZd„Zd„Zd„Zd„ZRS(cCsFtƒjƒ|_i|_tj|j|jƒ|_tƒ|_dS(N( tglobalstcopytglobalNStlocalNSRt ObjectBrowsertbrowserRtwatcher(R((s>/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pyRQs cCs”tdƒ}|jj|d|jjƒ|jjƒd|_|j|jdƒ|j|jj ƒƒ|jj d}|j|j t |ƒƒdS(s6Triggering a watcher response by setting an attribute.tpencilRt someValueiÿÿÿÿN( RR1t watchObjectR2RR tsomeAttrRt failUnlessRRR(RRR((s>/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pyttest_setAttrPlainWs    cCs”tdƒ}|jj|d|jjƒ|jjƒd|_|j|jdƒ|j|jj ƒƒ|jj d}|j|j t |ƒƒdS(s=Setting an attribute on a watched object that has __setattr__R3RtZORTtTROZiÿÿÿÿN( R*R1R5R2RR R6RR7RRR(RRR((s>/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pyttest_setAttrChainfs    cCs«x¤tdƒtdƒfD]Š}|jj|d|jjƒ|jjƒ|jƒ}|j|dƒ|j |jj ƒƒ|jj d}|j|j t |ƒƒqWdS(s3Triggering a watcher response by invoking a method.R3RiÿÿÿÿN(spencil( RR*R1R5R2RR RRR7RRR(RRtrvalR((s>/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pyt test_methodvs   (R R RR8R;R=(((s>/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pyR+Ps   cCsdS(s-A function which accepts no arguments at all.N((((s>/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pytfunction_noArgs†scCs |||fS(s+A function which accepts several arguments.((Rtbtc((s>/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pytfunction_simpleŠscOs ||fS(s@A function which accepts a variable number of args and keywords.((Rtkw((s>/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pytfunction_variableŽsicKs|\}}|||||fS(s&A function with a mad crazy signature.((t.0R@tdRBtalphatbeta((s>/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pytfunction_crazy’s tTestBrowseFunctioncBs>eZd„Zd„Zd„Zd„Zd„Zd„ZRS(cCstj|_|jjƒdS(N(RR R R(R((s>/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pyR˜s cCs{xtdD]l}t|ƒ}|jj||ƒ}|j|jt|ƒƒ|jt|tjƒƒ|j|j |ƒqWdS(svBasic checks for browse_function. Was the proper type returned? Does it have the right name and ID? R>RARCRHN(sfunction_noArgssfunction_simplesfunction_variablesfunction_crazy( tevalR RRRR7t isinstanceRtExplorerFunctiontname(Rtf_nametfR((s>/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pyt test_sanityœs  cCs2|jjtdƒ}|jt|jƒdƒdS(s2Testing zero-argument function signature. R>iN(R RR>RRt signature(RR((s>/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pyttest_signature_noArgs­scCs5|jjtdƒ}d}|j|jj|ƒdS(s+Testing simple function signature. RARR?R@N(RR?R@(R RRARRQRM(RRtexpected_signature((s>/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pyttest_signature_simpleµscCsg|jjtdƒ}d}|j}|j|j|ƒ|j|jdƒƒ|j|jdƒƒdS(s6Testing variable-argument function signature. RCRRBiiN(Rskw( R RRCRQRRMR7t is_varlistt is_keyword(RRtexpected_namesRQ((s>/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pyttest_signature_variable¿s   cCs'|jjtdƒ}|j}idd6idd6tdƒd6idd6dd 6g}|j|jd ƒƒ|j|jd ƒd  ƒ|j|jdƒdƒt d „|jd ƒdj ƒƒ}|j|jd ƒdƒ|j|tdƒƒ|j|jd ƒdƒ|j|j d ƒƒdS(s/Testing function with crazy signature. RHR@RMREitdefaultRBitkeywordsicSs|jS(N(tvalue(tl((s>/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pytâsiiN( R RRHRQtrangeR7tget_namet get_defaultRtmapRRV(RRRQRSt arg_2_default((s>/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pyttest_signature_crazyÍs        (R R RRPRRRTRXRc(((s>/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pyRI–s     t__main__(((((t__doc__t twisted.trialRttwisted.manholeRttypesRtTestCaseR RR!R*R+R>RARCR^RHRIR tmain(((s>/usr/lib/python2.7/dist-packages/twisted/test/test_explorer.pyts  6   U