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_dirdbm.pyc


.Nc@sdZddlZddlZddlZddlmZddlmZdejfdYZ	de	fdYZ
e	e
gZdS(	s
Test cases for dirdbm module.
iN(tunittest(tdirdbmtDirDbmTestCasecBsGeZdZdZdZdZdZdZdZRS(cCs:|j|_tj|j|_ddd	f|_dS(
Ntabctfoos/lalaltt
tbaz(sabcR(s/lalalR(RR(tmktemptpathRtopentdbmtitems(tself((s</usr/lib/python2.7/dist-packages/twisted/test/test_dirdbm.pytsetUpscCsDdjd}d|j|<d|j|<|j|j|ddS(Ns//==tbase64ta(tdecodeRtassertEqual(R
tk((s</usr/lib/python2.7/dist-packages/twisted/test/test_dirdbm.pyttestAlls

cCsJddlm}ddlm}|jd}d|d<|j|dS(Ni(R(trebuildsdirdbm.rebuild.testtvaluetkey(ttwisted.persistedRttwisted.pythonRtShelf(R
RRts((s</usr/lib/python2.7/dist-packages/twisted/test/test_dirdbm.pyttestRebuildInteractions

cCs|j}g}t}x;|jD]0\}}|||<|j||j|q"W|jxN|jD]C\}}|j|std|||ksjtdqjWy|dWntk
rnXdstdt	|j
}t|j}t|j}|jt|j}	||ks`tdt|t|f||kstdt|t|f|	|kstdt|	t|f|j
}
|j|
}t	|j
}t|j}
t|j}|j||ksEtd	t|t|f||
ksstd
t|t|
f||kstdt|t|f|jt|j
t|jkot|jkodknstdtj|
x:|jD]/\}}||=|j|std
qWt|j
dksptdt|jdkstdt|jdkstddS(Nshas_key() failedsdatabase has wrong valuetXXXis)didn't raise KeyError on non-existent keys%.keys() output didn't match: %s != %ss'.values() output didn't match: %s != %ssitems() didn't match: %s != %ss'.copyTo().keys() didn't match: %s != %ss).copyTo().values() didn't match: %s != %ss(.copyTo().items() didn't match: %s != %ss.clear() faileds#has_key() even though we deleted itsdatabase has keyssdatabase has valuessdatabase has items(RtsetRtappendtaddtsortthas_keytAssertionErrortKeyErrortlisttkeystvaluestreprRtcopyTotcleartlentshutiltrmtree(R
tdR&R'RtvtdbkeystdbvaluestdbitemsRtcopyPathtd2tcopykeyst
copyvaluest	copyitems((s</usr/lib/python2.7/dist-packages/twisted/test/test_dirdbm.pyttestDbm(sT		


 

...
...
W
 $$cCsLddl}d|jd<|jt|j|jjddkdS(NiR/Ri(ttimeRtassert_tabstgetModificationTime(R
R9((s</usr/lib/python2.7/dist-packages/twisted/test/test_dirdbm.pyttestModificationTimeds

cCs|jjd}ttjj|j|dd}|jd|j|jjd}ttjj|j|d}|jd|jttjj|j|dd}|jd|jttjj|jdd}|jd	|jtj	|j}|ddks4t
|ddksJt
tjtjj|jd
srt
tjtjj|jdst
dS(
s8DirDBM: test recovery from directory after a faked crashtkey1s.rpltwbRtkey2tcorrecttwrongsaa.newtdeleteds*.news*.rplN(Rt_encodeR
tosR	tjointwritetcloseRtDirDBMR#tglob(R
Rtftk2R((s</usr/lib/python2.7/dist-packages/twisted/test/test_dirdbm.pyttestRecoveryss&%

!

%

!

(cCs|jt|jjddy |jt|jjddWn*tjk
rh|j|jtjnX|jt|jj	d|jt|jj
d|jt|jjd|jt|jjd|jt|jj
ddS(s
        L{dirdbm.DirDBM} operations only support string keys: other types
        should raise a C{AssertionError}. This really ought to be a
        C{TypeError}, but it'll stay like this for backward compatibility.
        it3t2iN(tassertRaisesR#Rt__setitem__RtFailTesttassertIsInstanceRRt__getitem__t__delitem__R"t__contains__R<(R
((s</usr/lib/python2.7/dist-packages/twisted/test/test_dirdbm.pyttest_nonStringKeyss (	t__name__t
__module__RRRR8R=RMRW(((s</usr/lib/python2.7/dist-packages/twisted/test/test_dirdbm.pyRs			
	<		t
ShelfTestCasecBseZdZRS(cCsI|j|_tj|j|_dd
dddddff|_dS(NRRs/lalalRRRtintitfloatg(@ttuple(sabcsfoo(s/lalals(s
sbaz(sinti(sfloatg(@(Ni(RR	RRRtNoneR(R
((s</usr/lib/python2.7/dist-packages/twisted/test/test_dirdbm.pyRs	(RXRYR(((s</usr/lib/python2.7/dist-packages/twisted/test/test_dirdbm.pyRZs(t__doc__RER,RJt
twisted.trialRRRtTestCaseRRZt	testCases(((s</usr/lib/python2.7/dist-packages/twisted/test/test_dirdbm.pyt<module>s$