ó {G_Tc@s¬dZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ej jr¢d„Zn d„Zdfd„ƒYZdejfd„ƒYZd efd „ƒYZd ejfd „ƒYZd eje jjfd„ƒYZde jjfd„ƒYZdefd„ƒYZdefd„ƒYZdejfd„ƒYZd„Ze dkr¨eƒndS(sÒUnit tests for the bytes and bytearray types. XXX This is a mess. Common tests should be moved to buffer_tests.py, which itself ought to be unified with string_tests.py (and the latter should be modernized). iÿÿÿÿNcs"tjˆƒ‡fd†ƒ}|S(Ncs0tjjdtfƒˆ||ŽSWdQXdS(Nt(ttestt test_supporttcheck_warningst BytesWarning(targstkw(tfunc(s+/usr/local/lib/python2.7/test/test_bytes.pytwrappers(t functoolstwraps(RR((Rs+/usr/local/lib/python2.7/test/test_bytes.pytcheck_bytes_warningsscCs|S(N((R((s+/usr/local/lib/python2.7/test/test_bytes.pyR st IndexablecBseZdd„Zd„ZRS(icCs ||_dS(N(tvalue(tselfR ((s+/usr/local/lib/python2.7/test/test_bytes.pyt__init__#scCs|jS(N(R (R((s+/usr/local/lib/python2.7/test/test_bytes.pyt __index__%s(t__name__t __module__RR(((s+/usr/local/lib/python2.7/test/test_bytes.pyR "s t BaseBytesTestcBsÇeZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z e d„ƒZ d „Z d „Z d „Zd „Zd „Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z!d„Z"d „Z#d!„Z$d"„Z%d#„Z&d$„Z'd%„Z(d&„Z)d'„Z*d(„Z+d)„Z,d*„Z-d+„Z.d,„Z/d-„Z0d.„Z1d/„Z2d0„Z3RS(1cCs?|jƒ}|jt|ƒ|jƒ|j|j|jƒdS(N(t type2testt assertEqualttypet __class__(Rtb((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_basics+s cs9|jƒ‰|jtˆƒdƒ|jt‡fd†ƒ|jt‡fd†ƒ|jt‡fd†ƒ|jt‡fd†ƒ|jt‡fd†ƒ|jt‡fd†ƒ|jt‡fd†ƒ|jt‡fd †ƒ|jt‡fd †ƒ|jt‡fd †ƒ|jt‡fd †ƒdS( NicsˆdS(Ni(((R(s+/usr/local/lib/python2.7/test/test_bytes.pyt3scsˆdS(Ni(((R(s+/usr/local/lib/python2.7/test/test_bytes.pyR4scs ˆtjS(N(tsystmaxint((R(s+/usr/local/lib/python2.7/test/test_bytes.pyR5scsˆtjdS(Ni(RR((R(s+/usr/local/lib/python2.7/test/test_bytes.pyR6scsˆdS(Ni idlDG¨†dªrÓâÈYâ|gÄO¬s&YR5I(((R(s+/usr/local/lib/python2.7/test/test_bytes.pyR7scsˆdS(Niÿÿÿÿ(((R(s+/usr/local/lib/python2.7/test/test_bytes.pyR8scsˆdS(Niþÿÿÿ(((R(s+/usr/local/lib/python2.7/test/test_bytes.pyR9scs ˆtj S(N(RR((R(s+/usr/local/lib/python2.7/test/test_bytes.pyR:scsˆtj dS(Ni(RR((R(s+/usr/local/lib/python2.7/test/test_bytes.pyR;scsˆtj dS(Ni(RR((R(s+/usr/local/lib/python2.7/test/test_bytes.pyR<scsˆdS(Ni idlDG¨†dªrÓâÈYâ|gÄO¬s&YR5IléÿÿÿDG¨†dªrÓâÈYâ|gÄO¬s&YR5I(((R(s+/usr/local/lib/python2.7/test/test_bytes.pyR=s(RRtlent assertRaisest IndexError(R((Rs+/usr/local/lib/python2.7/test/test_bytes.pyttest_empty_sequence0s cCs[ttdƒƒ}|jd„|Dƒƒ}|jt|ƒdƒ|jt|ƒ|ƒdS(Nicss|] }|VqdS(N((t.0ti((s+/usr/local/lib/python2.7/test/test_bytes.pys As(tlisttrangeRRR(RtintsR((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_from_list?scCs”|jtƒtdƒtdƒtdƒgƒ}|jt|ƒddddgƒ|jt|jtdƒgƒ|jt|jtdƒgƒdS(Niiþiÿiiÿÿÿÿi(RR RR#Rt ValueError(RR((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_from_indexEs "cCs·|j|jdƒdƒ|j|jdƒdƒ|j|jdƒdƒ|jt|jdƒ|j|jdd ƒdƒ|j|jdƒdƒ|jt|jtjdƒdS( NiRititiÿÿÿÿt0tascii(RRRR't OverflowErrorRtmaxsize(R((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_from_ssizeLscCs{|jt|jdƒddd„ƒY}|jt|jdgƒ|jt|jdgƒ|jt|j|ƒgƒdS(NgtCcBseZRS((RR(((s+/usr/local/lib/python2.7/test/test_bytes.pyR0Xs((Rt TypeErrorRtNone(RR0((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_constructor_type_errorsVs cCs|jt|jdgƒ|jt|jtj gƒ|jt|jtj dgƒ|jt|jtj dgƒ|jt|jd gƒ|jt|jdgƒ|jt|jdgƒ|jt|jtjgƒ|jt|jtjdgƒ|jt|jd gƒdS( Niÿÿÿÿiii idiilDG¨†dªrÓâÈYâ|gÄO¬s&YR5IléÿÿÿDG¨†dªrÓâÈYâ|gÄO¬s&YR5IlDG¨†dªrÓâÈYâ|gÄO¬s&YR5I(RR'RRR(R((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_constructor_value_errors`s!! cCsv|jdddgƒ}|jdddgƒ}|jddgƒ}|j||ƒ|j||kƒ|j||kƒ|j||kƒ|j||kƒ|j||kƒ|j||kƒ|j||kƒ|j||kƒ|j||kƒ|j||kƒ|j||kƒ|j||kƒ|j||kƒ|j||kƒ|j||kƒdS(Niii(RRt assertTruet assertFalse(Rtb1tb2tb3((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_comparels&cCs¾|j|jdƒdktƒ|j|jdƒdktƒ|j|jdƒdktƒ|j|jdƒdktƒ|j|jƒtƒktƒ|j|jƒtƒktƒdS(Ntabcuabct abctabct abc(RRtFalsetunicodetTrue(R((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_compare_to_strƒs cCsTtttdƒƒ}|j|ƒ}tt|ƒƒ}|jƒ|j||ƒdS(NtHello(R#tmaptordRtreversedtreverseR(RtinputRtoutput((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_reversedŽs  csŒ‡fd†}|dƒ}ˆj|d |dƒƒˆj|dd!|dƒƒˆj|dd!|dƒƒˆj|d|d ƒƒˆj|dd !|d ƒƒˆj|dd !|d ƒƒˆj|d |dƒƒˆj|d d !|dƒƒˆj|d d!|dƒƒˆj|d|d ƒƒˆj|dd !|d ƒƒˆj|dd !|d ƒƒˆj|dd!|dƒƒdS(Ncsˆjtt|ƒƒS(N(RRDRE(ts(R(s+/usr/local/lib/python2.7/test/test_bytes.pytby–ss Hello, worldiRCitellois, tworldi idiùÿÿÿiõÿÿÿiûÿÿÿiœÿÿÿ(R(RRLR((Rs+/usr/local/lib/python2.7/test/test_bytes.pyt test_getslice•s c Cs•ttdƒƒ}|j|ƒ}d }xg|D]_}xV|D]N}xE|dD]9}|j||||…|j||||…ƒƒqLWq;Wq.WdS( Niÿiiiiidiÿÿÿÿiþÿÿÿiáÿÿÿiœÿÿÿ( iNiiiidiÿÿÿÿiþÿÿÿiáÿÿÿiœÿÿÿ(R#R$RR2R(RtLRtindiceststarttstoptstep((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_extended_getslice©s  cCsd}xBdD]:}|j||ƒ}|j||j|j|ƒƒƒq W|jt|j|dƒ|j|ddƒ}|j||j|d dƒƒdS( NuHello world áˆ´å™¸éª¼í»°tutf8tutf16tlatin1tignoreiüÿÿÿsutf-8(sutf8sutf16(RRtencodeRtUnicodeEncodeError(RtsampletencR((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_encoding´s &cCs²d}x9d D]1}|j||ƒ}|j|j|ƒ|ƒq Wd}|j|dƒ}|jt|jdƒ|j|jddƒdƒ|j|jddd dƒdƒdS( NuHello world ሴ噸骼\def0\def0RVRWuHello world €ÂþÿRXRYs Hello world terrorstencoding(sutf8sutf16(RRtdecodeRtUnicodeDecodeError(RR\R]R((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_decode½s cCs‡|jdƒ}|j||jƒƒ|jdƒ}|j||jdgdƒƒ|jdƒ}|j||jdgdƒƒdS(Nii i'(RR(RR((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_from_intÉs  csœ|jdƒ‰|jdƒ‰|jˆˆdƒ|jˆtdƒdƒ|jtdƒˆdƒ|jt‡fd†ƒ|jt‡fd†ƒdS(NtabctdeftabcdeftdefabccsˆdS(Nudef(((R7(s+/usr/local/lib/python2.7/test/test_bytes.pyR×scsdˆS(Nuabc(((R8(s+/usr/local/lib/python2.7/test/test_bytes.pyRØs(RRtbytesRR1(R((R7R8s+/usr/local/lib/python2.7/test/test_bytes.pyt test_concatÑscs±xªd|jdƒfD]“‰|jˆddƒ|jˆddƒ|jˆddƒ|jt‡fd†ƒ|jt‡fd†ƒ|jttf‡fd †ƒqWdS( NReit abcabcabciRiÿÿÿÿcsˆdS(Ng…ëQ¸ @(((R(s+/usr/local/lib/python2.7/test/test_bytes.pyRßscsdˆS(Ng…ëQ¸ @(((R(s+/usr/local/lib/python2.7/test/test_bytes.pyRàscs ˆtjS(N(RR.((R(s+/usr/local/lib/python2.7/test/test_bytes.pyRãs(RRRR1R-t MemoryError(R((Rs+/usr/local/lib/python2.7/test/test_bytes.pyt test_repeatÚscCs7|j|jdƒd|jtdƒgdƒƒdS(Ntxid(RRRE(R((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_repeat_1charåscsÛ|jdƒ‰|jtdƒˆƒ|jttdƒƒˆƒ|jdˆƒ|jt‡fd†ƒ|jt‡fd†ƒ|jt‡fd†ƒ|jt‡fd†ƒ|jt‡fd†ƒxtt fD]ø}|j|d ƒˆƒ|j|dƒˆƒ|j|d ƒˆƒ|j|d ƒˆƒ|j|d ƒˆƒ|j|d ƒˆƒ|j|dƒˆƒ|j|dƒˆƒ|j|dƒˆƒ|j|dƒˆƒ|j|dƒˆƒqÛWdS(NRetaiÈcs dˆkS(Ni,(((R(s+/usr/local/lib/python2.7/test/test_bytes.pyRíscs dˆkS(Niÿÿÿÿ(((R(s+/usr/local/lib/python2.7/test/test_bytes.pyRîscs dˆkS(N(R2((R(s+/usr/local/lib/python2.7/test/test_bytes.pyRïscsttdƒƒˆkS(NRp(tfloatRE((R(s+/usr/local/lib/python2.7/test/test_bytes.pyRðscs dˆkS(Nua(((R(s+/usr/local/lib/python2.7/test/test_bytes.pyRñsRRtctabtbctactdtdabtabd( RtassertInREtintt assertNotInRR'R1Rit bytearray(Rtf((Rs+/usr/local/lib/python2.7/test/test_bytes.pyt test_containsès*cCs;|jt|jjƒ|jt|jjdƒ|j|jjdƒ|jƒƒtdddgƒ}|j|jjdƒ|ƒ|j|jjdƒ|ƒ|j|jjdƒd ƒ|jt|jjd ƒ|jt|jjd ƒ|jt|jjd ƒ|jt|jjd ƒ|jt|jjdƒdS(Niuii+i0u1a2B30u 1A 2B 30 u0000tuaurtu1a b cduu 12 34(RR1RtfromhexRR|R'(RR((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_fromhexÿs"cCs2|j|jdƒjgƒdƒ|j|jdƒjdgƒdƒx¼dgddgddgdddggD]}tt|j|ƒƒ}|j|jdƒj|ƒdƒ|j|jdƒjt|ƒƒdƒ|j|jdƒjt|ƒƒdƒqrW|j|jdƒjdd gƒd ƒdS( NRReRpRtRsRrRt.tcdsab.cd(RRtjoinR#RDttupletiter(Rtlst((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_join s"%1"(,cCs^|jdƒ}|j|jdƒdƒ|j|jdƒdƒ|j|jdƒdƒdS(Nt mississippiR"itssitwi(RRtcount(RR((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_countscCs|jdƒ}|j|jƒjdƒƒ|j|jdƒƒ|j|jdƒƒ|j|jdƒƒ|j|jdƒƒ|j|jdƒƒdS(Nthellotanythingthelththellowtha(RR6t startswithR5(RR((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_startswithscCsš|jdƒ}|jtƒjdƒƒ|j|jdƒƒ|j|jdƒƒ|j|jdƒƒ|j|jdƒƒ|j|jdƒƒdS(NRŽRtllototwhellotno(RR6R|tendswithR5(RR((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_endswith'scCs¸|jdƒ}|j|jdƒdƒ|j|jddƒdƒ|j|jdddƒdƒ|j|jdddƒdƒ|j|jd ƒdƒ|j|jd ƒdƒdS( NR‰RŠiiiiiiÿÿÿÿR‹t mississippian(RRtfind(RR((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_find0scCs™|jdƒ}|j|jdƒdƒ|j|jddƒdƒ|j|jdddƒdƒ|j|jdƒd ƒ|j|jd ƒd ƒdS( NR‰RŠiiiiiR‹iÿÿÿÿRœ(RRtrfind(RR((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_rfind9s cCsq|jdƒ}|j|jdƒdƒ|j|jdƒdƒ|jt|jdƒ|jt|jdƒdS(NRNR‹itorlitwormtldo(RRtindexRR'(RR((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_indexAs cCsq|jdƒ}|j|jdƒdƒ|j|jdƒdƒ|jt|jdƒ|jt|jdƒdS(NRNR‹iR¡iR¢R£(RRtrindexRR'(RR((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_rindexHs cCsK|jdƒ}|j|jddƒdƒ|j|jddƒdƒdS(NR‰R"Rpt massassappaRŠRnt mixixippi(RRtreplace(RR((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_replacePscCsy|jdƒ}|j|jdƒdddddgƒ|j|jdƒdddgƒ|j|jd ƒ|gƒdS( NR‰R"tmRŠtppRtmitippiR‹(RRtsplit(RR((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_splitUs("cCsixzdD]r}|j|ƒ}|j|jƒddgƒ|j|jdƒddgƒ|j|jdd ƒddgƒqWx6dD].}|j|ƒ}|j|jƒ|gƒq„W|j|jdƒjddƒdgƒ|j|jdƒjddƒddgƒ|j|jdƒjdd ƒdddgƒ|j|jdƒjddƒdddgƒdS(Ns arf barf sarf barfsarf barfsarf barfsarf barfsarf barftarftbarfisabsabsabsabs a bb c is a bb c iRpsbb c tbbsc iRr(s arf barf sarf barfsarf barfsarf barfsarf barfsarf barf(sabsabsabsab(RRR°R2(RR((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_split_whitespace[s & (+.cCs#|jt|jdƒjdƒdS(Nsa bu (RR1RR°(R((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_split_string_errorjscCs,|jdƒ}|j|jƒdgƒdS(Ns s(RRR°(RR((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_split_unicodewhitespacemscCsy|jdƒ}|j|jdƒdddddgƒ|j|jdƒdddgƒ|j|jd ƒ|gƒdS( NR‰R"R¬RŠR­RR®R¯R‹(RRtrsplit(RR((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_rsplitqs("cCs0xzdD]r}|j|ƒ}|j|jƒddgƒ|j|jdƒddgƒ|j|jdd ƒddgƒqW|j|jd ƒjdd ƒd gƒ|j|jd ƒjdd ƒddgƒ|j|jd ƒjdd ƒdddgƒ|j|jd ƒjddƒdddgƒdS(Ns arf barf sarf barfsarf barfsarf barfsarf barfsarf barfR²R³is a bb c is a bb cis a bbRrs aR´iRp(s arf barf sarf barfsarf barfsarf barfsarf barfsarf barf(RRR¸R2(RR((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_rsplit_whitespacews &(+.cCs#|jt|jdƒjdƒdS(Nsa bu (RR1RR¸(R((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_rsplit_string_errorƒscCs,|jdƒ}|j|jƒdgƒdS(Ns s(RRR¸(RR((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_rsplit_unicodewhitespace†scCsE|jdƒ}|j|jdƒdƒ|j|jdƒdƒdS( NR‰RŠR®tissippiR‹R(smisssR½(s mississippiRR(RRt partition(RR((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_partitionŠscCs^|jdƒ}|j|jdƒd ƒ|j|jdƒd ƒ|j|jdƒd ƒdS( NR‰RŠtmissiR¯R"t mississippRR‹(RÀssssippi(RÁR"R(RRs mississippi(RRt rpartition(RR((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_rpartitionscCssxlttjdƒD]W}xNdD]F}|j|ƒ}tj||ƒ}tj|ƒ}|j||ƒq!WqWdS(NiRRpResÿab€tÿ(RRpsabcsÿab€RÄ(R$tpickletHIGHEST_PROTOCOLRtdumpstloadsR(RtprotoRtpstq((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_pickling•s  cCs©|jdƒ}|j|jdƒdƒ|j|jdƒdƒ|j|jdƒdƒ|j|jdƒd ƒ|j|jd ƒd ƒ|j|j|ƒd ƒdS( NR‰R"RÁR¬t ississippitpitmississtimtssissipptpimtssissR(RRtstrip(RR((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_stripscCs|jdƒ}|j|jdƒdƒ|j|jdƒdƒ|j|jdƒdƒ|j|jdƒdƒ|j|jdƒdƒdS( NR‰R"R¬RÍRÎRÐt ssissippiRÒ(RRtlstrip(RR((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_lstrip¦s cCs|jdƒ}|j|jdƒdƒ|j|jdƒdƒ|j|jdƒdƒ|j|jdƒdƒ|j|jdƒdƒdS( NR‰R"RÁR¬RÎRÏRÐRÒ(RRtrstrip(RR((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_rstrip®s cCsU|jdƒ}|j|jƒdƒ|j|jƒdƒ|j|jƒdƒdS(Ns abc Res abc s abc(RRRÔR×RÙ(RR((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_strip_whitespace¶scCs||j|jdƒjtdƒƒdƒ|j|jdƒjtdƒƒdƒ|j|jdƒjtdƒƒdƒdS(NReRuRRtRs(RRRÔt memoryviewR×RÙ(R((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_strip_bytearray¼s((cCsa|jt|jdƒjdƒ|jt|jdƒjdƒ|jt|jdƒjdƒdS(NReub(RR1RRÔR×RÙ(R((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_strip_string_errorÁscCsb|jdƒ}|jgtt|ƒƒD]}t|||d!ƒ^q(dddddgƒdS(NtA€ÿiiiAii€iÿ(RRR$RRE(RRR"((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_ordÆs9cCsž|jdƒ}|jdƒ}|jdƒ}|jdƒ}|jdƒ}|jd|j|dƒƒ|jd|j|ddƒƒ|jd|j|ddƒƒ|jd |j|ddƒƒ|jd|j|dƒƒ|jd|j|ddƒƒ|jd|j|ddƒƒ|jd |j|ddƒƒ|jd|j|dƒƒ|jd|j|ddƒƒ|jd|j|ddƒƒ|jd |j|ddƒƒ|jd|j|dƒƒ|jd|j|ddƒƒ|jd|j|ddƒƒ|jd |j|ddƒƒ|jd|j|dƒƒ|jd |j|ddƒƒ|jd |j|ddƒƒ|jd |j|ddƒƒ|jt|j |dƒƒ|jt|j |ddƒƒ|jt|j |ddƒƒ|jt |j |ddƒƒ|jt|j |dƒƒ|jt|j |ddƒƒ|jt|j |ddƒƒ|jt |j |ddƒƒdS( NRŽtlR‘RnR—iiiþÿÿÿii( RRRR2RŸR¤R¦RŒRARšR?R”(RRRáR‘RnR—((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_none_argumentsËsBcCs|jdƒ}|jdƒ}|jtd|j|dddƒ|jtd|j|dddƒ|jtd|j|dddƒ|jtd|j|dddƒ|jtd|j|dddƒ|jtd|j |dddƒ|jtd |j |dddƒdS( NRŽRns\bfind\bs \brfind\bs \bindex\bs \brindex\bs \bcount\bs\bstartswith\bs \bendswith\b( RtassertRaisesRegexpR1RR2RŸR¤R¦RŒR”Rš(RRRn((s+/usr/local/lib/python2.7/test/test_bytes.pyt*test_find_etc_raise_correct_error_messagesös (4RRRR R&R(R/R3R4R:R RBRJRORUR^RcRdRjRmRoR~RRˆRR•R›RžR R¥R§R«R±RµR¶R·R¹RºR»R¼R¿RÃRÌRÕRØRÚRÛRÝRÞRàRâRä(((s+/usr/local/lib/python2.7/test/test_bytes.pyR)sb                                 +t ByteArrayTestcBsÝeZeZd„Zd„Zd„Zd„Zd„Zd„Z d„Z d„Z d„Z d „Z d „Zd „Zd „Zd „Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(cCs|jtttƒƒdS(N(RR1thashR|(R((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_nohash sc CsKd}|ddt|ƒ}tjƒ}zñt|dƒ}|j|ƒWdQXt|dƒ"}tdƒ}|j|ƒ}WdQX|j|t|ƒƒd„|Dƒ}|jt|ƒt|ƒƒt|dƒ}|j|ƒWdQXt|dƒ}|j|j ƒ|ƒWdQXWdyt j |ƒWnt j k rEnXXdS(Ns Hello world R)itwbtrbcss|]}t|ƒVqdS(N(RE(R!RK((s+/usr/local/lib/python2.7/test/test_bytes.pys s( RttempfiletmktemptopentwriteR|treadintoRR#treadtostremoveterror(Rt short_sampleR\ttfnR}Rtntb_sample((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_bytearray_apis(   cCs|tdƒ}|j|jƒdƒ|j|dƒtdƒ}|jƒ|j|dƒtƒ}|jƒ|j|ƒdS(NRŽtollehthello1t1olleh(R|RRGR2R6(RR((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_reverse,s     cCsGd„}|dƒ}|jtjd|ƒ|dƒ|dƒgƒdS(NcSsttt|ƒƒS(N(R|RDRE(RK((s+/usr/local/lib/python2.7/test/test_bytes.pyRL8ss Hello, worlds\w+RCRN(Rtretfindall(RRLR((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_regexps7s  cCs‹tdddgƒ}d|d<|j|tdddgƒƒd|d<|j|tdddgƒƒtdƒ|d<|j|tdddgƒƒyd|d<|jd ƒWntk rÄnXyd|d <|jd ƒWntk rónXyd |d<|jd ƒWntk r"nXy!tdƒ|d<|jd ƒWntk rWnXyd|d<|jd ƒWntk r†nXdS(NiiiidiÈiÿÿÿÿi isDidn't raise IndexErroriöÿÿÿisDidn't raise ValueErrorsDidn't raise TypeError(R|RR tfailRR'R2R1(RR((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_setitem=s@           c Cs”ttdƒƒ}|d=|j|ttddƒƒƒ|d=|j|ttddƒƒƒ|d=|j|tddddd d d gƒƒdS( Ni iiiÿÿÿÿi iiiiii(R|R$R(RR((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_delitem_scCs?ttdƒƒ}|jt|ƒttdƒƒƒtdddddgƒ|dd+|j|tddddddddddg ƒƒ|dd 5|j|tdddddgƒƒtddd d d gƒ|dd+|j|ttdƒƒƒtd dgƒ|dd+|j|tddd d ddddgƒƒd d ddg|d d+|j|ttdƒƒƒdddg|d d+|j|tddd dddd d dddddg ƒƒd|d )|j|tddd dddgƒƒtdƒ|d *|j|tddddddgƒƒg|d d +|j|tdddddgƒƒtdƒ|d)|j|tdddddgƒƒxXdd dtdƒddddggggD])}|jtƒ||d d +WdQXqÅWxFdddgdd ggD])}|jtƒ||d d +WdQXqWdS(!Ni iiiiiii iûÿÿÿiiiidieiùÿÿÿiýÿÿÿi*tfooifiotuuuuiugPïâÖäKDustrgffffff@uaubiþiÿiiÿÿÿi(#( R|R$RR#RÜtlongRR1R'(RRtelem((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_setslicehs8""4 %".= (( %%4"c Csddddddd ddd d f }xá|D]Ù}xÐ|D]È}x¿|dD]³}ttd ƒƒ}t|ƒ}||||…}|jƒ|||||…<|||||…<|j|t|ƒƒ||||…=||||…=|j|t|ƒƒqLWq;Wq.WdS( Niiiii,iMiÿÿÿÿiþÿÿÿiáÿÿÿiÔþÿÿiÿl(R2R#R$R|RGR(RRQRRRSRTRPRtdata((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_extended_set_del_slice’s'    cCsRttdƒƒ}||d)|j|tttdƒƒttdƒƒƒƒdS(Nii(R|R$RR#(RR((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_setslice_trap¦s cCsœtdƒ}|}|d7}|j|dƒ|j||ƒ|j||kƒ|d7}|j|dƒy|d7}Wntk rŠnX|jdƒdS(NReRfRgtxyzt abcdefxyzus'bytes += unicode didn't raise TypeError(R|RR5R1Rÿ(RRR7((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_iconcat­s    cCsStdƒ}|}|d9}|j|dƒ|j||ƒ|j||kƒdS(NReiRk(R|RR5(RRR7((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_irepeat½s   cCsWtdƒ}|}|d9}|j|ddƒ|j||ƒ|j||kƒdS(NRnid(R|RR5(RRR7((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_irepeat_1charÅs   cCs—tƒ}|jƒ}|j|dkƒ|g}x_tdƒD]Q}|d7}|jƒ}|j|t|ƒkƒ||kr>|j|ƒq>q>WdS(NiidRn(R|t __alloc__R5R$Rtappend(RRtalloctseqR"((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_allocÍs      cCsúd}t|ƒ}|j|ƒ|j|||ƒ|j|d|ƒtdƒ}|jtt|dƒƒ|jd„|dDƒƒ|j||dƒ|j|d|ƒtdƒ}|jttt|dƒƒƒ|j||dƒ|j|d|ƒtdƒ}|jttt|dƒƒƒ|j||dƒ|j|d|ƒtdƒ}|jt|jdd d d gƒ|jt|jdd d d gƒ|jt |ƒdƒtdƒ}|jt td ƒƒgƒ|j|d ƒdS(NRŽiRicss|]}t|ƒVqdS(N(RE(R!Rn((s+/usr/local/lib/python2.7/test/test_bytes.pys âsi2iûÿÿÿiiiiiÿÿÿÿRp( R|textendRRDRER†R#RR'RR (RtorigRp((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_extendÙs2        "" cstdƒ‰ˆjtdƒƒ|jˆdƒˆjtdƒƒ|jˆdƒ|jt‡fd†ƒ|jt‡fd†ƒ|jt‡fd†ƒˆjtdƒƒˆjtd ƒƒ|jˆd ƒ|jt‡fd †ƒˆjttd ƒƒƒ|jˆd ƒdS( NRŽRáthelotheocsˆjtdƒƒS(NRá(RñRE((R(s+/usr/local/lib/python2.7/test/test_bytes.pyRûscs ˆjdƒS(Ni(Rñ((R(s+/usr/local/lib/python2.7/test/test_bytes.pyRüscs ˆjdƒS(Nue(Rñ((R(s+/usr/local/lib/python2.7/test/test_bytes.pyRýsR—R‘tecs ˆjdƒS(Nue(Rñ((R(s+/usr/local/lib/python2.7/test/test_bytes.pyRsR(R|RñRERRR'R1R (R((Rs+/usr/local/lib/python2.7/test/test_bytes.pyt test_removeõs cs²tdƒ‰|jˆjƒtdƒƒ|jˆjdƒtdƒƒ|jˆjdƒtdƒƒ|jt‡fd†ƒ|jtd„ƒ|jtd ƒjƒd ƒdS( NRNRviR‹iþÿÿÿtrcs ˆjdƒS(Ni (tpop((R(s+/usr/local/lib/python2.7/test/test_bytes.pyR scSs tƒjƒS(N(R|R(((s+/usr/local/lib/python2.7/test/test_bytes.pyR ssÿiÿ(R|RRRERR(R((Rs+/usr/local/lib/python2.7/test/test_bytes.pyttest_pops cCs|jtd„ƒdS(NcSs tƒjƒS(N(R|tsort(((s+/usr/local/lib/python2.7/test/test_bytes.pyRs(RtAttributeError(R((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_nosortscsÉtdƒ‰ˆjtdƒƒ|jˆdƒ|jˆjdƒdƒtƒ‰ˆjtdƒƒ|jtˆƒdƒ|jt‡fd†ƒtƒ‰ˆjttdƒƒƒ|jˆdƒdS(NthellR—RŽidtAics ˆjdƒS(Nuo(R((R(s+/usr/local/lib/python2.7/test/test_bytes.pyRs( R|RRERR2RRR1R (R((Rs+/usr/local/lib/python2.7/test/test_bytes.pyt test_appends   cCs­tdƒ}|jdtdƒƒ|jdtdƒƒ|jdtdƒƒ|jdtdƒƒ|j|dƒtƒ}|jdttd ƒƒƒ|j|d ƒdS( NtmssssppiR"iiþÿÿÿièR‰iR"(R|tinsertRERR (RR((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_insert s  cCstdƒ}|j||jdddƒkƒtgtdƒD] }|^q>ƒ}tdƒ}|j||j|ƒkƒdS(NRetcdeiiR(R|R6RªR$t translate(RRR"ttRn((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_copied-s  "% cCsVtdƒjdƒ\}}}|j|dƒ|j|dƒ|j||k ƒ|d7}|j|dƒtdƒjdƒ\}}}|j|dƒ|j|dƒtdƒjdƒ\}}}|j|dƒ|j|dƒ|j||k ƒ|d7}|j|dƒtdƒjdƒ\}}}|j|dƒ|j|dƒdS(NRntyRt!(R|R¾RR5RÂ(RRpRRr((s+/usr/local/lib/python2.7/test/test_bytes.pyt0test_partition_bytearray_doesnt_share_nullstring7s$  csYttdƒƒ‰tˆƒ}‡fd†}|dƒˆ}|jt|dƒ|jˆ|ƒ|jt|dƒ|jˆ|ƒ|jt|dƒ|jˆ|ƒ|jtˆjdƒ|jˆ|ƒ|jtˆjˆdƒ|jˆ|ƒ‡fd†}|jt|ƒ|jˆ|ƒ‡fd†}|jt|ƒ|jˆ|ƒdS( Ni cs&t|dd|dƒˆdd+dS(Niiiÿÿÿÿ(R$(Rõ(R(s+/usr/local/lib/python2.7/test/test_bytes.pytresizeSsi i iics ˆd=dS(Ni(((R(s+/usr/local/lib/python2.7/test/test_bytes.pytdelitembscsdˆddd…tdƒ}t|ƒ}t|ƒ}|j|t|ƒƒdS(NsHello world €þÿ(RiRÜR|R(RR\tbufR((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_from_bytearray§s   cCsš|jtdƒdƒ|jtdƒdƒ|jtdƒdƒ|jttdƒƒdƒ|jttdƒƒdƒ|jttdƒƒd ƒdS( NRsb''Rnsb'x's€sb'\x80'sbytearray(b'')sbytearray(b'x')sbytearray(b'\x80')(RR7R|(R((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_to_str­s cCs}d d d d g}x-|D]%\}}|j|t|dƒƒqWx4tddƒD]#}|jttdt|ƒƒqRWdS( NsWonderful spamsWonderful spam toosª€s\xaa\x00\000\200slatin-1i€isb"%s"(sWonderful spamsWonderful spam(sWonderful spam toosWonderful spam too(sª€sª€(s\xaa\x00\000\200s\xaa\x00\000\200(RR|R$Rt SyntaxErrortevaltchr(RttestsRRKRr((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_literal¶s  cCsd}t|ƒ}ttddƒƒ}tdƒ|tdƒ<|j|dƒ}|j|dƒ|j|dƒ|j|dƒ}|j|dƒ|j|dƒ|jddƒ}|j|dƒ|jddƒ}|j|dƒ|jt|jddƒ|jt|jddƒdS( NRŽiiRR—Rátheethllo(R|R$RER(RR2RR1(RRtbatrosettaRr((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_translateÃs  cCs)|jdjtdƒƒddgƒdS(Nsa bt RpR(RR°RÜ(R((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_split_bytearrayÕscCs)|jdjtdƒƒddgƒdS(Nsa bRKRpR(RR¸RÜ(R((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_rsplit_bytearrayØs(RRR R9R:RRtrequires_docstringsR=R?R@RERJRLRM(((s+/usr/local/lib/python2.7/test/test_bytes.pyR5ss    tBytearrayPEP3137TestcBseZd„Zd„ZRS(cCs t|ƒS(N(R|(RRn((s+/usr/local/lib/python2.7/test/test_bytes.pytmarshalìscCs°|jdƒ}xSdD]K}t||ƒ}|dƒ}|j||ƒ|j||k |dƒqWxDdD]<}t|ƒ}|j||ƒ|j||k |dƒqlWdS(Nt1234tzfilltrjusttljusttcenteris" returned self on a mutable objectsval.split()[0]sval.rsplit()[0]sval.partition(".")[0]sval.rpartition(".")[2]sval.splitlines()[0]sval.replace("", "")s! returned val on a mutable object(szfillsrjustsljustscenter(sval.split()[0]sval.rsplit()[0]sval.partition(".")[0]sval.rpartition(".")[2]sval.splitlines()[0]sval.replace("", "")(RPtgetattrRR5RB(Rtvaltmethnametmethodtnewvaltexpr((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_returns_new_copyïs    (RRRPR\(((s+/usr/local/lib/python2.7/test/test_bytes.pyROês tFixedStringTestcBs>eZd„Zd„Zd„Zd„Zd„Zd„ZRS(cCs2t|tƒr|jdƒStt|ƒj|ƒS(Nsutf-8(t isinstanceR7RZtsuperR]tfixtype(Rtobj((s+/usr/local/lib/python2.7/test/test_bytes.pyR`s cCsdS(N((R((s+/usr/local/lib/python2.7/test/test_bytes.pyR~ scCsdS(N((R((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_expandtabs scCsdS(N((R((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_upperscCsdS(N((R((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_lowerscCsdS(N((R((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_hashs(RRR`R~RbRcRdRe(((s+/usr/local/lib/python2.7/test/test_bytes.pyR]s      tByteArrayAsStringTestcBseZeZRS((RRR|R(((s+/usr/local/lib/python2.7/test/test_bytes.pyRfstByteArraySubclasscBseZRS((RR(((s+/usr/local/lib/python2.7/test/test_bytes.pyRgstByteArraySubclassTestcBs5eZd„Zd„Zd„Zd„Zd„ZRS(cCs:|jtttƒƒ|jtƒtƒd\}}t|ƒt|ƒ}}|j||kƒ|j||kƒ|j||kƒ|j||kƒ|j||kƒ|j||kƒ|j||k ƒ|j||||ƒ|j||||ƒ|j||||ƒ|j|d|dkƒdS(Ntabcdtefghi(RiRj(R5t issubclassRgR|tassertIsInstanceR(RRpRt_at_b((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_basic!s cCs…tdƒ}tƒj|gƒ}|j||k ƒ|jt|ƒtkt|ƒƒ|jdgƒ}|jt|ƒtkƒdS(NRi(RgR|R„R5R(Rts1ts2ts3((s+/usr/local/lib/python2.7/test/test_bytes.pyRˆ9s  "cCs÷tdƒ}d|_tdƒ|_xÌttjdƒD]·}tjtj||ƒƒ}|jt |ƒt |ƒƒ|j ||ƒ|j |j|jƒ|j |j|jƒ|j t |ƒt |ƒƒ|j t |jƒt |jƒƒq8WdS(NRii Rji( RgRnR+R$RÅRÆRÈRÇtassertNotEqualtidRR(RRpRÉR((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_pickleFs  cCsçtdƒ}d|_tdƒ|_x¼tjtjfD]¨}||ƒ}|jt|ƒt|ƒƒ|j||ƒ|j|j|jƒ|j|j|jƒ|jt|ƒt|ƒƒ|jt|jƒt|jƒƒq7WdS(NRii Rj( RgRnR+tcopytdeepcopyRsRtRR(RRpt copy_methodR((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_copySs   cCsadtfd„ƒY}|dddƒ}|j|dƒ|ddddƒ}|j|dƒdS(NtsubclasscBseZdd„ZRS(ic_stj|||ŽdS(N(R|R(RtnewargRtkwargs((s+/usr/local/lib/python2.7/test/test_bytes.pyRbs(RRR(((s+/usr/local/lib/python2.7/test/test_bytes.pyRzasitsourceRiR{(R|R(RRzRn((s+/usr/local/lib/python2.7/test/test_bytes.pyttest_init_override`s (RRRoRˆRuRyR~(((s+/usr/local/lib/python2.7/test/test_bytes.pyRhs   cCstjjttttƒdS(N(RRt run_unittestRåRfRhRO(((s+/usr/local/lib/python2.7/test/test_bytes.pyt test_mainis  t__main__(!R<RðRüRRvR RÅRêtunittestttest.test_supportRttest.string_teststtest.buffer_teststflagst bytes_warningR R tTestCaseRRåR5t buffer_teststMixinBytesBufferCommonTestsROt string_teststBaseTestR]RfR|RgRhR€R(((s+/usr/local/lib/python2.7/test/test_bytes.pyts:              ÿâÿjw J