ó {G_Tc#@sdZddlZddlmZdddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&g#ZgZd'„Zd(fd)„ƒYZd*Zx eD]Z ee ƒej UqÀW[ [d+ej fd,„ƒYZ d-„Zed.kreƒndS(/s@Test the functionality of Python classes implementing operators.iÿÿÿÿN(t test_supporttaddtraddtsubtrsubtmultrmultdivtrdivtmodtrmodtdivmodtrdivmodtpowtrpowtrshifttrrshifttlshifttrlshifttandtrandtortrortxortrxortcontainstgetitemtgetslicetsetitemtsetslicetdelitemtdelslicetnegtpostabstinitcs‡fd†}|S(Ncs#tjˆj|fƒˆ||ŽS(N(tcallLsttappendt__name__(targstkwargs(tf(s+/usr/local/lib/python2.7/test/test_class.pyttrackGs((R)R*((R)s+/usr/local/lib/python2.7/test/test_class.pyt trackCallFstAllTestscBs¤eZeZed„ƒZed„ƒZed„ƒZed„ƒZed„ƒZed„ƒZed„ƒZ ed„ƒZ ed„ƒZ ed „ƒZ RS( cGs |f|S(N((tselfR'((s+/usr/local/lib/python2.7/test/test_class.pyt __coerce__OscGstt|ƒƒS(N(thashtid(R-R'((s+/usr/local/lib/python2.7/test/test_class.pyt__hash__SscGsdS(NR,((R-R'((s+/usr/local/lib/python2.7/test/test_class.pyt__str__WscGsdS(NR,((R-R'((s+/usr/local/lib/python2.7/test/test_class.pyt__repr__[scGsdS(Ni((R-R'((s+/usr/local/lib/python2.7/test/test_class.pyt__int___scGsdS(Ngð?((R-R'((s+/usr/local/lib/python2.7/test/test_class.pyt __float__cscGsdS(Nl((R-R'((s+/usr/local/lib/python2.7/test/test_class.pyt__long__gscGsdS(Nt01((R-R'((s+/usr/local/lib/python2.7/test/test_class.pyt__oct__kscGsdS(Nt0x1((R-R'((s+/usr/local/lib/python2.7/test/test_class.pyt__hex__oscGsdS(Ni((R-R'((s+/usr/local/lib/python2.7/test/test_class.pyt__cmp__ss( R&t __module__R+R.R1R2R3R4R5R6R8R:R;(((s+/usr/local/lib/python2.7/test/test_class.pyR,Lss5@trackCall def __%(method)s__(self, *args): pass t ClassTestscBsªeZd„Zd„Zd„Zd„Zd„Zejd„ƒZ d„Z d„Z d„Z d „Z d „Zd „Zd „Zd „Zd„Zd„Zd„ZRS(cCs gt(dS(N(R$(R-((s+/usr/local/lib/python2.7/test/test_class.pytsetUp…scCs1t}||kr-|jd||fƒndS(Ns=Expected call list: %s does not match actual call list %s(R$tfail(R-texpected_callstactualCallList((s+/usr/local/lib/python2.7/test/test_class.pytassertCallStackˆs  cCs&tƒ}|jd|ffgƒdS(Nt__init__(R,RB(R-tfoo((s+/usr/local/lib/python2.7/test/test_class.pyttestInits cCsštƒ}gt(|d|jd|dffd|dffgƒgt(d||jd|dffd|dffgƒgt(|d|jd|dffd|dffgƒgt(d||jd|dffd|dffgƒgt(|d|jd|dffd|dffgƒgt(d||jd|dffd|dffgƒdd d krìgt(|d|jd|dffd |dffgƒgt(d||jd|dffd |dffgƒngt(|d|jd|dffd |dffgƒgt(d||jd|dffd|dffgƒgt(t|dƒ|jd|dffd|dffgƒgt(td|ƒ|jd|dffd|dffgƒgt(|d|jd|dffd|dffgƒgt(d||jd|dffd|dffgƒgt(|d?|jd|dffd|dffgƒgt(d|?|jd|dffd|dffgƒgt(|d>|jd|dffd|dffgƒgt(d|>|jd|dffd|dffgƒgt(|d@|jd|dffd|dffgƒgt(d|@|jd|dffd|dffgƒgt(|dB|jd|dffd|dffgƒgt(d|B|jd|dffd|dffgƒgt(|dA|jd|dffd|dffgƒgt(d|A|jd|dffd|dffgƒdS(NiR.t__add__t__radd__t__sub__t__rsub__t__mul__t__rmul__iit__div__t__rdiv__t__mod__t__rmod__t __divmod__t __rdivmod__t__pow__t__rpow__t __rshift__t __rrshift__t __lshift__t __rlshift__t__and__t__rand__t__or__t__ror__t__xor__t__rxor__(R,R$RBR (R-ttestme((s+/usr/local/lib/python2.7/test/test_class.pyt testBinaryOps“s” +++++++.++ + ++++++++++++c Cs›tƒ}ddd„ƒY}yd|ƒk|jdƒWntk rMnXgt(d|k|jd|dffgƒgt(|d|jd|dffgƒgt(d|d<|jd|ddffgƒgt(|d=|jd|dffgƒgt(|d |jd |d d ffgƒgt(d |d *|jd |d d d ffgƒgt(|d 4|jd|d d ffgƒgt(|ddd…|jd|tdddƒffgƒgt(d|ddd…<|jd|tdddƒdffgƒgt(|ddd…=|jd|tdddƒffgƒgt(|dd …dddd…ddf|jd|tdd dƒttdddƒddfffgƒgt(d|dd …dddd…ddf<|jd|tdd dƒttdddƒddfdffgƒgt(|dd …dddd…ddf=|jd|tdd dƒttdddƒddfffgƒtj}t`tj }t` tj }t` gt(|d |jd|td d dƒffgƒgt(d |d *|jd|td d dƒd ffgƒgt(|d 4|jd|td d dƒffgƒ|t_|t_ |t_ dS(NtEmptycBseZRS((R&R<(((s+/usr/local/lib/python2.7/test/test_class.pyR`ÿsis$failed, should have raised TypeErrort __contains__t __getitem__t __setitem__t __delitem__i*t __getslice__is The Answert __setslice__t __delslice__iii sA lot.iidtStrange(( R,R?t TypeErrorR$RBtslicetNonetEllipsisReRfRg(R-R^R`RRR((s+/usr/local/lib/python2.7/test/test_class.pyttestListAndDictOpsús–      "((&(%   ( (  cCsMddd„ƒY}|ƒ}ddlm}||dƒ|j|jƒdS(NtAcBseZeZd„ZRS(cSs t|_dS(N(tTruetok(R-tkey((s+/usr/local/lib/python2.7/test/test_class.pyRdes(R&R<tFalseRpRd(((s+/usr/local/lib/python2.7/test/test_class.pyRncsiÿÿÿÿ(tsequence_delitemi((t _testcapiRst assertTrueRp(R-RntaRs((s+/usr/local/lib/python2.7/test/test_class.pyt testDelItemas   cCsStƒ}gt(| |jd|ffgƒgt(| |jd|ffgƒgt(t|ƒ|jd|ffgƒgt(t|ƒ|jd|ffgƒgt(t|ƒ|jd|ffgƒgt(t|ƒ|jd|ffgƒgt(t|ƒ|jd|ffgƒgt(t|ƒ|jd|ffgƒdS( Nt__neg__t__pos__t__abs__R4R6R5R8R:( R,R$RBR"tinttlongtfloattoctthex(R-R^((s+/usr/local/lib/python2.7/test/test_class.pyt testUnaryOpsns2       cCsãtƒ}gt(t|ƒ|jd|ffgƒgt(t|ƒ|jd|ffgƒgt(t|ƒ|jd|ffgƒgt(|dk|jd|dffd|dffgƒgt(|dk|jd|dffd|dffgƒgt(|dk|jd|dffd|dffgƒgt(tdƒ|jd|dffd|dffgƒgt(|dk|jd|dffd|dffgƒgt(d|k|jd|dffdd|ffgƒgt(d|k|jd|dffdd|ffgƒgt(d|k|jd|dffdd|ffgƒgt(tdƒ|jd|dffdd|ffgƒgt(d|k|jd|dffdd|ffgƒdS( NR1R3R2iR.R;s testme <> 1s 1 <> testme(R,R$R/RBtreprtstrteval(R-R^((s+/usr/local/lib/python2.7/test/test_class.pyttestMisc‹sP     + + + + + + + + + cCs¥dtfd„ƒY}|ƒ}gt(|j|jd|dffgƒgt(d|_|jd|ddffgƒgt(|`|jd|d ffgƒdS( Nt ExtraTestscBs5eZed„ƒZed„ƒZed„ƒZRS(cWsdS(NtSomeVal((R-R'((s+/usr/local/lib/python2.7/test/test_class.pyt __getattr__ÆscWsdS(N((R-R'((s+/usr/local/lib/python2.7/test/test_class.pyt __setattr__ÊscWsdS(N((R-R'((s+/usr/local/lib/python2.7/test/test_class.pyt __delattr__Îs(R&R<R+R‡RˆR‰(((s+/usr/local/lib/python2.7/test/test_class.pyR…ÅsR‡tspamsspam, spam, spam and hamRˆteggsR‰tcardinal(R,R$RŠRBR‹RŒ(R-R…R^((s+/usr/local/lib/python2.7/test/test_class.pyttestGetSetAndDelÃs  csXg‰dd‡fd†ƒY}|ƒ}~ddl}|jƒ|jdgˆƒdS(NtDelTestcseZ‡fd†ZRS(csˆjdƒdS(Nscrab people, crab people(R%(R-(tx(s+/usr/local/lib/python2.7/test/test_class.pyt__del__ås(R&R<R((R(s+/usr/local/lib/python2.7/test/test_class.pyRŽäsiÿÿÿÿscrab people, crab people((tgctcollectt assertEqual(R-RŽR^R‘((Rs+/usr/local/lib/python2.7/test/test_class.pyttestDelás   cCsSddd„ƒY}x9tttttttgD]}|jt||ƒƒq/WdS(Nt BadTypeClasscBs5eZd„ZeZeZeZeZeZeZRS(cSsdS(N(Rk(R-((s+/usr/local/lib/python2.7/test/test_class.pyR4ðs( R&R<R4R5R6R2R3R8R:(((s+/usr/local/lib/python2.7/test/test_class.pyR•ïs (( R{R}R|R‚RR~Rt assertRaisesRi(R-R•R)((s+/usr/local/lib/python2.7/test/test_class.pyttestBadTypeReturnedís "cCsÄddd„ƒY}|ƒ}gt(t|ƒ}|jt|ƒtƒ|j|dƒ|jd|ffgƒgt(t|ƒ}|jt|ƒtƒ|j|dƒ|jd|ffgƒdS(NtIntLongMixClasscBs&eZed„ƒZed„ƒZRS(cSsdS(Nl*((R-((s+/usr/local/lib/python2.7/test/test_class.pyR4ÿscSsdS(Ni@((R-((s+/usr/local/lib/python2.7/test/test_class.pyR6s(R&R<R+R4R6(((s+/usr/local/lib/python2.7/test/test_class.pyR˜þsl*R4i@R6((R$R{R“ttypeR|RB(R-R˜t mixIntAndLongtas_inttas_long((s+/usr/local/lib/python2.7/test/test_class.pyttestMixIntsAndLongsüs   cCsvddd„ƒY}t|ƒƒddd„ƒY}|jtt|ƒƒdd d„ƒY}|jtt|ƒƒdS( NtC0cBseZRS((R&R<(((s+/usr/local/lib/python2.7/test/test_class.pyRžstC1cBseZd„ZRS(cSsdS(Ni((R-tother((s+/usr/local/lib/python2.7/test/test_class.pyR;s(R&R<R;(((s+/usr/local/lib/python2.7/test/test_class.pyRŸstC2cBseZd„ZRS(cSsdS(Ni((R-R ((s+/usr/local/lib/python2.7/test/test_class.pyt__eq__$s(R&R<R¢(((s+/usr/local/lib/python2.7/test/test_class.pyR¡#s((((R/R–Ri(R-RžRŸR¡((s+/usr/local/lib/python2.7/test/test_class.pyt testHashStuffs  cCsXddd„ƒY}|ƒ|_|ƒ}y |ƒWntk rFnX|jdƒdS(NRncBseZRS((R&R<(((s+/usr/local/lib/python2.7/test/test_class.pyRn,ssFailed to raise RuntimeError((t__call__t RuntimeErrorR?(R-RnRv((s+/usr/local/lib/python2.7/test/test_class.pyttestSFBug532646)s    csàd„‰dd ‡fd†ƒY}y|ƒjWn9tk rk}t|ƒdkrl|jd|ƒqlnXdd ‡fd†ƒY}|ƒ|ƒkdd ‡fd †ƒY}y |ƒWntk rÎ}nX|jd ƒdS(NcSstdƒ‚dS(Ntbooh(tAttributeError(R-((s+/usr/local/lib/python2.7/test/test_class.pyR§;sRncseZeˆƒZRS((R&R<tpropertyRv((R§(s+/usr/local/lib/python2.7/test/test_class.pyRn>sR§s(attribute error for A().a got masked: %stEcseZeˆƒZRS((R&R<R©R¢((R§(s+/usr/local/lib/python2.7/test/test_class.pyRªFstIcseZeˆƒZRS((R&R<R©RC((R§(s+/usr/local/lib/python2.7/test/test_class.pyR«Jss)attribute error for I.__init__ got masked((((RvR¨R‚R?(R-RnRRªR«((R§s+/usr/local/lib/python2.7/test/test_class.pyt)testForExceptionsRaisedInInstanceGetattr28s  cCszddd„ƒY}d|fd„ƒY}|dƒ}|dƒ}|j|j|jƒ|j|j|jƒ|j|j|jƒ|j|j|dƒjƒ|jt|jƒt|jƒƒ|jt|jƒt|dƒjƒƒ|j|j|jƒ|j|j|jƒ|j|j|jƒ|jt|jƒt|jƒƒ|t|jjƒdAƒ}t|jƒdS( NRncBs5eZd„Zd„Zd„Zd„Zd„ZRS(cSs ||_dS(N(R(R-R((s+/usr/local/lib/python2.7/test/test_class.pyRCXscSsdS(N((R-((s+/usr/local/lib/python2.7/test/test_class.pyR)ZscSsdS(N((R-((s+/usr/local/lib/python2.7/test/test_class.pytg\scSs|j|jkS(N(R(R-R ((s+/usr/local/lib/python2.7/test/test_class.pyR¢^scSs|jS(N(R(R-((s+/usr/local/lib/python2.7/test/test_class.pyR1`s(R&R<RCR)R­R¢R1(((s+/usr/local/lib/python2.7/test/test_class.pyRnWs     tBcBseZRS((R&R<(((s+/usr/local/lib/python2.7/test/test_class.pyR®bsiiiÿÿÿÿ((R“R)tassertNotEqualR­R/tim_func(R-RnR®ta1ta2Rv((s+/usr/local/lib/python2.7/test/test_class.pyttestHashComparisonOfMethodsUs    "("cCsrddd„ƒY}xX||ƒfD]G}|jtt|ƒj|gƒ|jtt|ƒj|ggƒq#WdS(NtCcBseZRS((R&R<(((s+/usr/local/lib/python2.7/test/test_class.pyR´xs((R–RiR™t__getattribute__Rˆ(R-R´tc((s+/usr/local/lib/python2.7/test/test_class.pyt testAttrSlotsws(R&R<R>RBRER_RmRt cpython_onlyRwR€R„RR”R—RR£R¦R¬R³R·(((s+/usr/local/lib/python2.7/test/test_class.pyR=„s"    g g  8       "cCs?tjdtfdtfdtfƒtjtƒWdQXdS(Ns).+__(get|set|del)slice__ has been removedsclassic int divisions<> not supported(Rtcheck_py3k_warningstDeprecationWarningt run_unittestR=(((s+/usr/local/lib/python2.7/test/test_class.pyt test_main~s   t__main__(t__doc__tunittestttestRt testmethsR$R+R,tmethod_templatetmethodtlocalst__dict__tTestCaseR=R¼R&(((s+/usr/local/lib/python2.7/test/test_class.pytsb   1 ÿû