Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/twisted/test/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/twisted/test/test_rebuild.pyc


=Nc@sddlZddlZddlZddlmZddlmZddlZejZ	dddYa
dt
fdYZdefd	YZ
d
ee
fdYaddd
YZdadejfdYZdejfdYZdS(iN(tunittest(trebuildtFoocBseZRS((t__name__t
__module__(((s=/usr/lib/python2.7/dist-packages/twisted/test/test_rebuild.pyRstBarcBseZRS((RR(((s=/usr/lib/python2.7/dist-packages/twisted/test/test_rebuild.pyRstBazcBseZRS((RR(((s=/usr/lib/python2.7/dist-packages/twisted/test/test_rebuild.pyRstBuzcBseZRS((RR(((s=/usr/lib/python2.7/dist-packages/twisted/test/test_rebuild.pyRstHashRaisesRuntimeErrorcBs eZdZdZdZRS(s
    Things that don't hash (raise an Exception) should be ignored by the
    rebuilder.

    @ivar hashCalled: C{bool} set to True when __hash__ is called.
    cCs
t|_dS(N(tFalset
hashCalled(tself((s=/usr/lib/python2.7/dist-packages/twisted/test/test_rebuild.pyt__init__scCst|_tddS(Nsnot a TypeError!(tTrueR
tRuntimeError(R((s=/usr/lib/python2.7/dist-packages/twisted/test/test_rebuild.pyt__hash__s	(RRt__doc__RR(((s=/usr/lib/python2.7/dist-packages/twisted/test/test_rebuild.pyRs	tRebuildTestCasecBsVeZdZdZdZdZdZdZdZdZ	dZ
RS(	sH
    Simple testcase for rebuilding, to at least exercise the code.
    cCs|j|_tj|jtjj|jd|_tj|jttjj|jddjt	jj
d|jdS(Nttwisted_rebuild_fakelibs__init__.pytwi(tmktemptlibPathtostmkdirtpathtjointfakelibPathtfiletclosetsystinsert(R((s=/usr/lib/python2.7/dist-packages/twisted/test/test_rebuild.pytsetUp+s%cCstjj|jdS(N(RRtremoveR(R((s=/usr/lib/python2.7/dist-packages/twisted/test/test_rebuild.pyttearDown3scCsddlm}ddl}ddl}|j|tdtjj|j	dddl
m}|j}yt
Wntk
rnHXddlm}|j}d|jfdY}||_|}	|j}
|j|jd	|jd
|j|tdtjj|j	dtj|yt
Wntk
rTn9X|j}|j|jd|j|jd|j|
jd
|j|jddS(Ni(tsibpathsmyrebuilder1.pysmyrebuilder.py(tmyrebuilder(ttest_rebuildtCcBseZRS((RR(((s=/usr/lib/python2.7/dist-packages/twisted/test/test_rebuild.pyR%Dstag?smyrebuilder2.pytctdtb(ttwisted.python.utilR"tshutilttimetcopyfilet__file__RRRRRR#tAtobjectt	NameErrorttwisted.testR$tBR%tInherittassertEqualR&tsleepRR)(RR"R+R,R#R&R$R)R%R'titb2((s=/usr/lib/python2.7/dist-packages/twisted/test/test_rebuild.pyttestFileRebuild6s<
		


cCsYtjd}tjtdt|j|j|jtj|jttjdS(s1
        Rebuilding an unchanged module.
        R&tdoLogN(	tcrash_test_dummytXRR	tdotfailUnlessIdenticalt	__class__tftfoo(Rtx((s=/usr/lib/python2.7/dist-packages/twisted/test/test_rebuild.pyttestRebuild^s

cCstj}|jtjtj|jtj}tjtd|jtj}|j|j|j	tjddl
m}|jt
|jtjtjtjdS(Nii(t
components(R;t
XComponentt
setAdaptertIXtXAtgetComponentRtmethodR5R?ttwisted.pythonRDtfailUnlessRaisest
ValueErrortregisterAdapterR<(RRBtoldComponenttnewComponentRD((s=/usr/lib/python2.7/dist-packages/twisted/test/test_rebuild.pyttestComponentInteractionos
cCs|t}dd	dYadttfdYatj|t|ds]tdt|dsxtddS(
NRcBseZdZRS(cSsdS(N((R((s=/usr/lib/python2.7/dist-packages/twisted/test/test_rebuild.pyRAs(RRRA(((s=/usr/lib/python2.7/dist-packages/twisted/test/test_rebuild.pyRsRcBseZdZRS(i
(RRRB(((s=/usr/lib/python2.7/dist-packages/twisted/test/test_rebuild.pyRsRAs"Missing method on rebuilt instanceRBs+Missing class attribute on rebuilt instance((RRRRRtupdateInstancethasattrtAssertionError(RR)((s=/usr/lib/python2.7/dist-packages/twisted/test/test_rebuild.pyttestUpdateInstances	
cCs4ddlm}ddlm}|j|jdS(Ni(R(tbanana(RKRttwisted.spreadRVtlatestClasstBanana(RRRV((s=/usr/lib/python2.7/dist-packages/twisted/test/test_rebuild.pyttestBananaInteractionscCsCtad}|j|tjt|jtjtdS(s~
        Rebuilding something that has a __hash__ that raises a non-TypeError
        shouldn't cause rebuild to die.
        cSs
dadS(N(tNonetunhashableObject(((s=/usr/lib/python2.7/dist-packages/twisted/test/test_rebuild.pyt_cleanupsN(RR\t
addCleanupRR5R
R
(RR]((s=/usr/lib/python2.7/dist-packages/twisted/test/test_rebuild.pyttest_hashExceptions
		

(RRRRR!R9RCRQRURZR_(((s=/usr/lib/python2.7/dist-packages/twisted/test/test_rebuild.pyR's			(				tNewStyleTestCasecBszeZdZdZdZdZejdkrBde_ndZ	ejdkrfde	_nd	Z
d
ZRS(
sB
    Tests for rebuilding new-style classes of various sorts.
    cCs&tjd|_|jtjd<dS(Ntwhipping(ttypest
ModuleTypetmRtmodules(R((s=/usr/lib/python2.7/dist-packages/twisted/test/test_rebuild.pyRscCstjd=|`dS(NRa(RReRd(R((s=/usr/lib/python2.7/dist-packages/twisted/test/test_rebuild.pyR!s
cBszd}||jjU|jj}d|_||jjUej||j|jd|je||jjdS(sF
        Try to rebuild a new style class with slots defined.
        s2class SlottedClass(object):
    __slots__ = ['a']
iN(	Rdt__dict__tSlottedClassR&RRRR5tassertIdenticalttype(RtclassDefinitiontinst((s=/usr/lib/python2.7/dist-packages/twisted/test/test_rebuild.pyt
test_slotss	
iisO__class__ assignment for class with slots is only available starting Python 2.6cBsWd}||jjU|jj}d|_||jjU|jejej|dS(sX
        Try to rebuild a new style class with slots defined: this should fail.
        s2class SlottedClass(object):
    __slots__ = ['a']
iN(RdRfRgR&tassertRaisesRtRebuildErrorRR(RRjRk((s=/usr/lib/python2.7/dist-packages/twisted/test/test_rebuild.pyttest_errorSlotss	sI__class__ assignment for class with slots should work starting Python 2.6cBsd}||jjU|jj}|jd||jjUej||j|dd|je||jjdS(s6
        Try to rebuild a base type subclass.
        s#class ListSubclass(list):
    pass
iiN(	RdRftListSubclasstappendRRRR5RhRi(RRjRk((s=/usr/lib/python2.7/dist-packages/twisted/test/test_rebuild.pyttest_typeSubclasss

cBs]d}||jjU|jj}dg|_d}||jjU|jeej|dS(s
        Test that when rebuilding an instance with a __slots__ attribute, it
        fails accurately instead of giving a L{rebuild.RebuildError}.
        s(class NotSlottedClass(object):
    pass
R&s class NotSlottedClass:
    pass
N(RdRftNotSlottedClasst	__slots__Rmt	TypeErrorRRR(RRjRk((s=/usr/lib/python2.7/dist-packages/twisted/test/test_rebuild.pyttest_instanceSlotss(ii(ii(RRRRR!RlRtversion_infotskipRoRrRv(((s=/usr/lib/python2.7/dist-packages/twisted/test/test_rebuild.pyR`s					(((RRRbt
twisted.trialRRKRR;RAR@RRR0RRRR[R\tTestCaseRR`(((s=/usr/lib/python2.7/dist-packages/twisted/test/test_rebuild.pyt<module>s	~