ó {G_Tc@sèdZddlZddlZd„Zddd„ƒYZddd„ƒYZddd „ƒYZd dd „ƒYZd dd „ƒYZddd„ƒYZ ddd„ƒYZ ddl m Z m Z d„Zdejfd„ƒYZdS(s3 Tests common to tuple, list and UserList.UserList iÿÿÿÿNccsx|D] }|VqWdS(sRegular generatorN((tseqnti((s*/usr/local/lib/python2.7/test/seq_tests.pytiterfunc s tSequencecBs eZdZd„Zd„ZRS(sSequence using __getitem__cCs ||_dS(N(R(tselfR((s*/usr/local/lib/python2.7/test/seq_tests.pyt__init__scCs |j|S(N(R(RR((s*/usr/local/lib/python2.7/test/seq_tests.pyt __getitem__s(t__name__t __module__t__doc__RR(((s*/usr/local/lib/python2.7/test/seq_tests.pyRs tIterFunccBs)eZdZd„Zd„Zd„ZRS(s Sequence using iterator protocolcCs||_d|_dS(Ni(RR(RR((s*/usr/local/lib/python2.7/test/seq_tests.pyRs cCs|S(N((R((s*/usr/local/lib/python2.7/test/seq_tests.pyt__iter__scCsD|jt|jƒkr!t‚n|j|j}|jd7_|S(Ni(RtlenRt StopIteration(Rtv((s*/usr/local/lib/python2.7/test/seq_tests.pytnexts  (RRR RR R(((s*/usr/local/lib/python2.7/test/seq_tests.pyR s  tIterGencBs eZdZd„Zd„ZRS(s9Sequence using iterator protocol defined with a generatorcCs||_d|_dS(Ni(RR(RR((s*/usr/local/lib/python2.7/test/seq_tests.pyR%s ccsx|jD] }|Vq WdS(N(R(Rtval((s*/usr/local/lib/python2.7/test/seq_tests.pyR (s(RRR RR (((s*/usr/local/lib/python2.7/test/seq_tests.pyR#s t IterNextOnlycBs eZdZd„Zd„ZRS(s Missing __getitem__ and __iter__cCs||_d|_dS(Ni(RR(RR((s*/usr/local/lib/python2.7/test/seq_tests.pyR.s cCsD|jt|jƒkr!t‚n|j|j}|jd7_|S(Ni(RR RR (RR((s*/usr/local/lib/python2.7/test/seq_tests.pyR1s  (RRR RR(((s*/usr/local/lib/python2.7/test/seq_tests.pyR,s t IterNoNextcBs eZdZd„Zd„ZRS(sIterator missing next()cCs||_d|_dS(Ni(RR(RR((s*/usr/local/lib/python2.7/test/seq_tests.pyR9s cCs|S(N((R((s*/usr/local/lib/python2.7/test/seq_tests.pyR <s(RRR RR (((s*/usr/local/lib/python2.7/test/seq_tests.pyR7s t IterGenExccBs)eZdZd„Zd„Zd„ZRS(sTest propagation of exceptionscCs||_d|_dS(Ni(RR(RR((s*/usr/local/lib/python2.7/test/seq_tests.pyRAs cCs|S(N((R((s*/usr/local/lib/python2.7/test/seq_tests.pyR DscCs dddS(Nii((R((s*/usr/local/lib/python2.7/test/seq_tests.pyRFs(RRR RR R(((s*/usr/local/lib/python2.7/test/seq_tests.pyR?s  t IterFuncStopcBs)eZdZd„Zd„Zd„ZRS(sTest immediate stopcCsdS(N((RR((s*/usr/local/lib/python2.7/test/seq_tests.pyRKscCs|S(N((R((s*/usr/local/lib/python2.7/test/seq_tests.pyR MscCs t‚dS(N(R (R((s*/usr/local/lib/python2.7/test/seq_tests.pyROs(RRR RR R(((s*/usr/local/lib/python2.7/test/seq_tests.pyRIs  (tchaintimapcCs(ttd„ttt|ƒƒƒƒƒS(s Test multiple tiers of iteratorscSs|S(N((tx((s*/usr/local/lib/python2.7/test/seq_tests.pytUs(RRRRR(R((s*/usr/local/lib/python2.7/test/seq_tests.pyt itermultiSst CommonTestcBs°eZdZd„Zd„Zd„Zd„Zd„Zd„Z d„Z d„Z d„Z d „Z d „Zd „Zd „Zd „Zd„Zd„Zd„Zd„ZRS(cCsCg}dg}ddg}|jƒ}|j|ƒ}|j|ƒ}|j|ƒ}|j|ƒ}|j|ƒ} |j|ƒ} |j|ƒ} |jt|ƒƒ} ddd„ƒY} | |ƒ}|j|ƒ}|jt|ƒt|ƒƒd}|j|ƒ}|jt|ƒt|ƒƒxddtdƒdtd d d ƒfD]ó}xEtttt t fD].}|j|j||ƒƒ|j|ƒƒqdW|j|jt |ƒƒ|jƒƒ|j|jd„dDƒƒ|jdƒƒ|j t |jt|ƒƒ|j t |jt|ƒƒ|j t|jt|ƒƒqHWdS(NiitOtherSeqcBs#eZd„Zd„Zd„ZRS(cSs ||_dS(N(t_OtherSeq__data(Rtinitseq((s*/usr/local/lib/python2.7/test/seq_tests.pyRlscSs t|jƒS(N(R R(R((s*/usr/local/lib/python2.7/test/seq_tests.pyt__len__nscSs |j|S(N(R(RR((s*/usr/local/lib/python2.7/test/seq_tests.pyRps(RRRRR(((s*/usr/local/lib/python2.7/test/seq_tests.pyRks  sthis is also a sequencet123tiètdog333333ó?iÐi˜icss|] }|VqdS(N((t.0tc((s*/usr/local/lib/python2.7/test/seq_tests.pys €s((R"g333333ó?(t type2testttuplet assertEqualR trangetxrangeRR RRRRt assertRaisest TypeErrorRRtZeroDivisionErrorR(Rtl0tl1tl2tutu0tu1tu2tuutuu0tuu1tuu2RRtstv0tvvtg((s*/usr/local/lib/python2.7/test/seq_tests.pyttest_constructors[s8    . ,%,cCs0|j|jƒƒ|j|jdgƒƒdS(Ni*(t assertFalseR%t assertTrue(R((s*/usr/local/lib/python2.7/test/seq_tests.pyt test_truth…scCs |jdddddgƒ}xHtt|ƒƒD]4}|j|||ƒ|j|t|ƒ|ƒq1Wx`tt|ƒ dƒD]H}|j||t|ƒ|ƒ|j|t|ƒt|ƒ|ƒq€W|jt|jt|ƒ dƒ|jt|jt|ƒƒ|jt|jt dddƒƒ|jƒ}|jt|jdƒ|jt|jdƒ|jt |jƒ|jddgƒ}|j|ddƒ|j|ddƒ|j|d dƒ|j|ddƒ|jt|jd ƒ|jt|jdƒdS( Niiiiiiÿÿÿÿi i iþÿÿÿiýÿÿÿ( R%R)R R'tlongR*t IndexErrorRt ValueErrortsliceR+(RR0Rta((s*/usr/local/lib/python2.7/test/seq_tests.pyt test_getitem‰s*(!" cCsRdddddg}|j|ƒ}|j|dd!|jƒƒ|j|dd!|jdgƒƒ|j|dd!|jdgƒƒ|j|dd !|ƒ|j|d d!|jgƒƒ|j||ƒ|j|dd!|jddddgƒƒ|j|dd!|jdddgƒƒ|j|ddd…|ƒ|j|ddd…|jdddgƒƒ|j|ddd…|jddgƒƒ|j|ddd…|jdddddgƒƒ|j|ddd…|jdddgƒƒ|j|ddd…|jddgƒƒ|j|ddd…|jgƒƒ|j|ddd…|jdgƒƒ|j|ddd…|jdgƒƒ|j|ddd…|jddgƒƒ|j|ddd …|jdgƒƒ|j|d d d…|jgƒƒ|j|d d d…|ƒ|j|d d d…|ddd…ƒ|j|d d d…|jgƒƒ|j|d d d…|jdddgƒƒ|jdddddgƒ}|j|tddƒ d!|jdddgƒƒ|j|dtddƒ!|jddgƒƒ|jt|jƒdS(Niiiiiiþÿÿÿiÿÿÿÿiüÿÿièiœÿÿÿidlÿÿÿÿdldll€l‘(R%R'tNonetpowR*R+t __getslice__(RtlR0RD((s*/usr/local/lib/python2.7/test/seq_tests.pyt test_getslice£s<## ,)/,5/,&)),)&*&/3/cCs‹|jdddgƒ}x|D]}|j||ƒqWx8t|ƒdt|ƒdfD]}|j||ƒqZW|jt|jƒdS(Niii(R%tassertIntmintmaxt assertNotInR*R+t __contains__(RR0R((s*/usr/local/lib/python2.7/test/seq_tests.pyt test_containsÉs  'cCsRddd„ƒY}|j|ƒ|jgƒƒ|j|ƒ|jdgƒƒdS(NtAllEqcBseZd„ZdZRS(cSstS(N(tTrue(Rtother((s*/usr/local/lib/python2.7/test/seq_tests.pyt__eq__×sN(RRRTRFt__hash__(((s*/usr/local/lib/python2.7/test/seq_tests.pyRQÓs i((RNR%RK(RRQ((s*/usr/local/lib/python2.7/test/seq_tests.pyttest_contains_fakeÒscs‰dtfd„ƒY‰dd‡fd†ƒY}|jd|ƒgƒ}|jd|ƒ|j|ƒdgƒ}|jˆ|jdƒdS(Nt DoNotTestEqcBseZRS((RR(((s*/usr/local/lib/python2.7/test/seq_tests.pyRWást StopComparescseZ‡fd†ZRS(cs ˆ‚dS(N((RRS(RW(s*/usr/local/lib/python2.7/test/seq_tests.pyRTäs(RRRT((RW(s*/usr/local/lib/python2.7/test/seq_tests.pyRXãsi((t ExceptionR%RKR*RO(RRXt checkfirstt checklast((RWs*/usr/local/lib/python2.7/test/seq_tests.pyttest_contains_orderÝs cCs‰|jt|jƒƒdƒ|jt|jgƒƒdƒ|jt|jdgƒƒdƒ|jt|jdddgƒƒdƒdS(Niiii(R'R R%(R((s*/usr/local/lib/python2.7/test/seq_tests.pyttest_lenìs"cCsH|jdddgƒ}|jt|ƒdƒ|jt|ƒdƒdS(Niii(R%R'RLRM(RR0((s*/usr/local/lib/python2.7/test/seq_tests.pyt test_minmaxòscCsQ|jdgƒ}|jddgƒ}|j|||jƒƒ|j||jƒ|ƒ|j||jdgƒ|ƒ|j|jdgƒ||jddgƒƒ|j|jƒ|dƒ|j|jƒd|ƒ|j|jƒ|dƒ|j|jƒd|ƒ|j||dƒ|j|d|ƒ|j||dƒ|j|d|ƒ|j|||dƒ|j||d|ƒ|j|||dƒ|j||d|ƒ|j||||dƒ|j|||d|ƒd |jfd „ƒY}|ddgƒ}|j||dƒ|j||dƒdS( NiiiÿÿÿÿllilitsubclasscBseZRS((RR(((s*/usr/local/lib/python2.7/test/seq_tests.pyR_ s(R%R't assertIsNot(RR2R3R_tu3((s*/usr/local/lib/python2.7/test/seq_tests.pyt test_addmul÷s0 /c Cs|jddgƒ}||jƒ7}|j||jddgƒƒ||jddgƒ7}|j||jddddgƒƒ||jddgƒ7}|j||jddddddgƒƒ|jdƒ}||jdƒ7}|j||jd ƒƒdS( Niiiiiitspamteggstspameggs(R%R'(RR0((s*/usr/local/lib/python2.7/test/seq_tests.pyt test_iadds%+c CsN|jddgƒ}|d9}|j||jddddddgƒƒdS(Niii(R%R'(RR0((s*/usr/local/lib/python2.7/test/seq_tests.pyt test_imul s cCs?d|jfd„ƒY}|jt|dƒƒjƒdƒdS(NtTcBseZd„ZRS(cSst|ƒdS(Ns!!!(tstr(Rtkey((s*/usr/local/lib/python2.7/test/seq_tests.pyR(s(RRR(((s*/usr/local/lib/python2.7/test/seq_tests.pyRh'sii(ii(R%R'titerR(RRh((s*/usr/local/lib/python2.7/test/seq_tests.pyttest_getitemoverwriteiter%scCs·x°tdƒD]¢}tt|ƒƒ}xAtddƒD]0}|j|j||ƒ|j|ƒ|ƒq5W|j|j|ƒd|jgƒƒ|jt|ƒt|dƒƒq WdS(Niiýÿÿÿiiüÿÿÿi(R)R&R(R'R%tid(RtmR8tn((s*/usr/local/lib/python2.7/test/seq_tests.pyt test_repeat,s .&cCs|ddl}|jdkrx|jdgƒ}|d9}|jt|jdƒt|dƒrx|jt|jd ƒqxndS( Niÿÿÿÿiÿÿÿiiit__imul__iii(tsystmaxintR%R*t MemoryErrort__mul__thasattrRq(RRrR((s*/usr/local/lib/python2.7/test/seq_tests.pyttest_bigrepeat4s  cCsÊ|jddgƒ}|j|jdƒdƒ|j|jdƒdƒ|j|jdƒdƒ|j|jdƒdƒ|jt|jdƒ|jt|jdƒ|j|jtd d ƒƒ|jdgƒƒ|j|jtd d ƒƒ|jdgƒƒ|j|jtd d ƒƒ|jddgƒƒ|j|jtd dƒƒ|jddgƒƒ|j|jtdd ƒƒ|jgƒƒ|jt|jtd dd ƒƒ|jt|jd ƒdS(Ni i lllÿÿÿÿlÿÿÿÿiýÿÿÿiiiiiR(R%R'RR*RARCRBR+(RRD((s*/usr/local/lib/python2.7/test/seq_tests.pyttest_subscript=s..11+"csÆ|jdddgƒd}|j|jdƒdƒ|j|jdƒdƒ|j|jdƒdƒ|jt|jƒdtfd„ƒY‰dd ‡fd†ƒY}|jˆ|j|ƒƒdS( NiiiitBadExccBseZRS((RR(((s*/usr/local/lib/python2.7/test/seq_tests.pyRyUstBadCmpcseZ‡fd†ZRS(cs|dkrˆƒ‚ntS(Ni(tFalse(RRS(Ry(s*/usr/local/lib/python2.7/test/seq_tests.pyRTYs  (RRRT((Ry(s*/usr/local/lib/python2.7/test/seq_tests.pyRzXs((R%R'tcountR*R+RY(RRDRz((Rys*/usr/local/lib/python2.7/test/seq_tests.pyt test_countMscs0|jddgƒ}|j|jdƒdƒ|j|jdƒdƒ|jt|jdƒ|jddddddgƒ}|j|jdƒdƒ|j|jdƒdƒ|j|jddƒdƒ|j|jddƒdƒ|j|jddƒdƒ|j|jdddƒdƒ|jt|jdddƒ|jt|jƒd tfd „ƒY‰d d‡fd †ƒY}|jddddgƒ}|jˆ|j|ƒƒ|jddddddgƒ}|j|jdƒdƒ|j|jddƒdƒ|j|jdd ƒdƒ|j|jddƒdƒ|j|jddƒdƒ|j|jddƒdƒ|j|jdddƒdƒ|j|jdddƒdƒ|j|jdd tj dtj ƒdƒ|jt|jddtj d tj ƒ|jt|jdddƒdS(NiiiiþÿÿÿiÿÿÿÿiöÿÿÿiiRycBseZRS((RR(((s*/usr/local/lib/python2.7/test/seq_tests.pyRyqsRzcseZ‡fd†ZRS(cs|dkrˆƒ‚ntS(Ni(R{(RRS(Ry(s*/usr/local/lib/python2.7/test/seq_tests.pyRTus  (RRRT((Ry(s*/usr/local/lib/python2.7/test/seq_tests.pyRztsiüÿÿÿiýÿÿÿ(( R%R'tindexR*RBR|R+RYRrRs(RR0RzRD((Rys*/usr/local/lib/python2.7/test/seq_tests.pyt test_index`s:!!-*N(RRRFR%R<R?RERJRPRVR\R]R^RbRfRgRlRpRwRxR}R(((s*/usr/local/lib/python2.7/test/seq_tests.pyRWs& *   &         ((((((((R tunittestRrRRR RRRRRt itertoolsRRRtTestCaseR(((s*/usr/local/lib/python2.7/test/seq_tests.pyts