tzh
2024-08-22 c7d0944258c7d0943aa7b2211498fd612971ce27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
R\¬Qc@südZddlZddlZddlZddlZddlmZmZddlmZ    ddlm
Z
d„Z dej fd„ƒYZ d    d
„Zd ej fd „ƒYZd dd„ƒYZddd„ƒYZd„ZedkrøeƒndS(s3
  Test cases for the repr module
  Nick Mathewson
iÿÿÿÿN(t run_unittesttcheck_py3k_warnings(trepr(tReprcCs*d}xt|ƒD]}|f}qW|S(N((trange(tnestingttti((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyt nestedTuples t    ReprTestscBs†eZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z    d„Z
d    „Z d
„Z d „Z d „Zd „ZRS(cCsÚ|j}|tdƒdƒ|tdƒdƒdddd}t|ƒd d    t|ƒd
}|t|ƒ|ƒ|td ƒtd ƒƒd dd d}t|ƒd d    t|ƒd
}|t|ƒ|ƒdS(Ntabcs'abc'tabcdefghijklmnops'abcdefghijklmnop'taitbi s...iòÿÿÿs"'s"t'id(t assertEqualtrR(tselfteqtstexpected((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyt test_strings    ""cCsu|j}|tdƒdƒd    }|t|ƒdƒtƒ}d|_t|ƒd d}||j|ƒ|ƒdS(
Nis(1,)iis    (1, 2, 3)iþÿÿÿs...)(i(iii(RRRtmaxtupleR(RRtt3tr2R((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyt
test_tuple&s            c
Csddlm}ddlm}|j}|td0ƒdƒ|td1ƒdƒ|td2ƒd    ƒ|td3ƒd ƒ|td4ƒdƒ|tgƒdƒ|tdgƒdƒ|tdddgƒdƒ|tdddd
d d gƒdƒ|tdddd
d d dgƒdƒ|ttgƒƒdƒ|ttdgƒƒdƒ|ttdddgƒƒdƒ|ttdddd
d d gƒƒdƒ|ttdddd
d d dgƒƒdƒ|ttgƒƒdƒ|ttdgƒƒdƒ|ttdddgƒƒdƒ|ttdddd
d d gƒƒdƒ|ttdddd
d d dgƒƒdƒ|t|dddd
d d dgƒƒdƒ|tiƒd ƒidd!6dd"6dd#6d
d$6}|t|ƒd%ƒd|d&<|t|ƒd'ƒ|t|d(ƒƒd)ƒ|t|d(dgƒƒd*ƒ|t|d(ddgƒƒd+ƒ|t|d(dddgƒƒd,ƒ|t|d(dddd
gƒƒd-ƒ|t|d(dddd
d gƒƒd.ƒ|t|d(dddd
d d gƒƒd/ƒdS(5Niÿÿÿÿ(tarray(tdeques()is(1,)iis    (1, 2, 3)iiis(1, 2, 3, 4, 5, 6)is(1, 2, 3, 4, 5, 6, ...)s[]s[1]s    [1, 2, 3]s[1, 2, 3, 4, 5, 6]s[1, 2, 3, 4, 5, 6, ...]sset([])sset([1])sset([1, 2, 3])sset([1, 2, 3, 4, 5, 6])sset([1, 2, 3, 4, 5, 6, ...])s frozenset([])sfrozenset([1])sfrozenset([1, 2, 3])sfrozenset([1, 2, 3, 4, 5, 6])s"frozenset([1, 2, 3, 4, 5, 6, ...])sdeque([1, 2, 3, 4, 5, 6, ...])s{}talicetbobtcharlestdaves/{'alice': 1, 'bob': 2, 'charles': 3, 'dave': 4}tarthurs6{'alice': 1, 'arthur': 1, 'bob': 2, 'charles': 3, ...}Rsarray('i', [])sarray('i', [1])sarray('i', [1, 2])sarray('i', [1, 2, 3])sarray('i', [1, 2, 3, 4])sarray('i', [1, 2, 3, 4, 5])s array('i', [1, 2, 3, 4, 5, ...])((i(iii(iiiiii(iiiiiii(Rt collectionsRRRtsett    frozenset(RRRRtd((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyttest_container2sJ    %("+."+.."
"%(+'cCs›|j}|tdƒtdƒƒ|tdƒtdƒƒ|tddƒtddƒƒd
}t|ƒd dt|ƒd    }|t|ƒ|ƒdS( Ni{l{gð?il
idis...iíÿÿÿlDG¨†dªrÓâÈYâ|gÄO¬s&YR5I(RRR(RRtnR((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyt test_numbersgs    !"cCsñ|j}tdƒ}|t|ƒt|ƒƒtddƒ}t|ƒd dt|ƒd}|t|ƒ|ƒtƒ}|t|ƒdt|ƒƒttƒ}|j|jdƒƒ|j|jd    ƒƒ|j|j    dƒd
kƒdS( NR txièi s...iòÿÿÿs%<ClassWithFailingRepr instance at %x>s<class t>i(
Rt ClassWithReprRRtClassWithFailingReprtidt
assertTruet
startswithtendswithtfind(RRti1ti2Rti3R((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyt test_instanceqs     "     cCscttjƒ}|jt|ƒjdtjƒƒ|jƒ|jt|ƒjdtjƒƒdS(Ns<open file %r, mode 'r' at 0xs<closed file %r, mode 'r' at 0x(topentunittestt__file__R-RR.tclose(Rtfp((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyt    test_file‚s 
cCs#|jtd„ƒjdƒƒdS(NcSs|S(N((R(((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyt<lambda>‹ss<function <lambda(R-RR.(R((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyt test_lambdaŠscCs?|j}|ttƒdƒ|jtdjƒjdƒƒdS(Ns<built-in function hash>ts*<built-in method split of str object at 0x(RRthashR-tsplitR.(RR((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyttest_builtin_functions    cCsa|j}|ttdƒƒdƒ|ttddƒƒdƒ|ttdddƒƒdƒdS(Nis    xrange(1)is xrange(1, 2)isxrange(1, 4, 3)(RRtxrange(RR((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyt test_xrange—s    cCs%|j}|tgggggggƒdƒ|tggggggggƒdƒ|ttdƒƒdƒ|ttdƒƒdƒ|titdƒtdƒ6ƒdƒ|titdƒtdƒ6ƒd    ƒ|tiggggggƒd
ƒ|tigggggggƒdƒdS( Ns[[[[[[[]]]]]]]s[[[[[[[...]]]]]]]is(((((((),),),),),),)is(((((((...),),),),),),)is&{((((((),),),),),): ((((((),),),),),)}s,{((((((...),),),),),): ((((((...),),),),),)}s[[[[[[{}]]]]]](RRR(RR((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyt test_nestings    %(%cCs<tƒtdƒ}WdQX|jt|ƒjdƒƒdS(Ntfoos<read-only buffer for 0x(RtbufferR-RR.(RR(((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyt test_buffer®s
cCsdS(N((R((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyt    test_cellµscCsŒ|j}|ttjƒdƒddd„ƒY}t|jƒ}|jt|ƒjdƒƒt|jƒ}|jt|ƒjdƒƒdS(Ns"<method 'items' of 'dict' objects>tCcBseZd„ZRS(cSsdS(N((tcls((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyRDÂs(t__name__t
__module__RD(((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyRHÁss<staticmethod object at 0xs<classmethod object at 0x((    RRtdicttitemst staticmethodRDR-R.t classmethod(RRRHR(((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyttest_descriptors¹s    cCsWtdddgƒ}t|ƒ}idd6dd6}t|ƒt|ƒt|ƒdS(Nyð?y@y@ii(R"R#R(RR(tytz((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyttest_unsortableÈs  
 
(RJRKRRR%R'R4R:R<R@RBRCRFRGRPRS(((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyR    s            5    
                                   R=cCs*t|dƒ}|j|ƒ|jƒdS(Ntw(R5twriteR8(tpathttextR9((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyttouchÒs t LongReprTestcBsYeZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z    d„Z
RS(    cCsöd}tjj|ƒ|_tjj||ƒ|_tj|jdtƒtj|jƒt    tjj|jdtj
dƒƒtj|jdtƒtj|jƒt    tjj|jdtj
dƒƒtj ƒ|_ t jjd|j ƒdS(Nt3areallylongpackageandmodulenametotestreprtruncationt ignore_errorst__init__tpyi(tosRVtjointpkgnamet
subpkgnametshutiltrmtreetTruetmkdirRXtextseptgetcwdtheretsystinsert(Rtlongname((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pytsetUpØs''cCsÏg}xTtj|jƒD]@\}}}x.||D]"}|jtjj||ƒƒq3WqW|j|jƒ|jƒ|jƒx=|D]5}tjj|ƒr°tj    |ƒqˆtj
|ƒqˆWt jd=dS(Ni( R^twalkR`tappendRVR_tsorttreversetisdirtrmdirtremoveRi(Rtactionstdirpathtdirnamest    filenamestnametp((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyttearDownçs"$
 
 cCs}|j}ttjj|j|jtjdƒƒddlm    }|t
|ƒd|j |j fƒ|t
t ƒdƒdS(NR]iÿÿÿÿ(RZs<module '%s' from '%s'>s<module 'sys' (built-in)>(RRXR^RVR_RaR`Rftgareallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncationRZRRJR7Ri(RRRZ((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyt test_moduleös     * cCsd|j}ttjj|jdtjdƒdƒddlm}|t    |jƒd|j
ƒdS(NRDR]sclass foo(object):
    pass
iÿÿÿÿ(RDs<class '%s.foo'>( RRXR^RVR_RaRfR{RDRRJ(RRRD((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyt    test_typeþs     #cCsdS(N((R((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyt test_objectscCsdttjj|jdtjdƒdƒddlm}|jt    |jƒj
d|j ƒƒdS(NtbarR]sclass bar:
    pass
iÿÿÿÿ(Rs<class %s.bar at 0x( RXR^RVR_RaRfR{RR-RR.RJ(RR((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyt
test_class s
#cCsmttjj|jdtjdƒdƒddlm}|jƒ}|jt    |ƒj
d|j ƒƒdS(NtbazR]sclass baz:
    pass
iÿÿÿÿ(Rs<%s.baz instance at 0x( RXR^RVR_RaRfR{RR-RR.RJ(RRtibaz((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyR4s # cCs•|j}ttjj|jdtjdƒdƒddlm}|t    |j
j ƒdƒ|j
ƒ}|j t    |j ƒj d|jfƒƒdS(NtquxR]sìclass aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:
    def amethod(self): pass
iÿÿÿÿ(Rƒsá<unbound method aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.amethod>s½<bound method aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.amethod of <%s.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa instance at 0x(RRXR^RVR_RaRfR{RƒRtÈaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaatamethodR-R.RJ(RRRƒtiqux((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyt test_method!s    # cCsdS(N((R((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyR@1s( RJRKRlRzR|R}R~R€R4R‡R@(((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyRY×s                
       
   
   R*cBseZd„Zd„ZRS(cCs ||_dS(N(R(RR((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyR\6scCs d|jS(NsClassWithLongRepr(%r)(R(R((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyt__repr__8s(RJRKR\Rˆ(((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyR*5s    R+cBseZd„ZRS(cCstdƒ‚dS(Ns+This should be caught by Repr.repr_instance(t    Exception(R((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyRˆ=s(RJRKRˆ(((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyR+<scCsttƒttƒdS(N(RR    RY(((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyt    test_mainAs
t__main__(((t__doc__RiR^RbR6ttest.test_supportRRRRRRtTestCaseR    RXRYR*R+RŠRJ(((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_repr.pyt<module>s         ¼ ^