Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/bsddb/test/test_dbshelve.pyo

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


��Qc@s�dZddlZddlZddlZddlZddlZddlmZmZm	Z	m
Z
mZmZdd"d��YZ
dejfd��YZdefd	��YZd
efd��YZdefd
��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZd�Zedkr�ejd d!�ndS(#s*
TestCases for checking dbShelve objects.
i�N(tdbtdbshelvettest_supporttverbosetget_new_environment_pathtget_new_database_patht	DataClasscBs#eZd�Zd�Zd�ZRS(cCstj�|_dS(N(trandomtvalue(tself((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyt__init__scCsd|jS(NsDataClass %f(R(R	((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyt__repr__scCst|j|�S(N(tcmpR(R	tother((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyt__cmp__s(t__name__t
__module__R
RR(((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyRs		tDBShelveTestCasecBs�eZejdks3ejdkrBejdkrBdd�Znd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�ZRS(iiiicCs|j||kd|�S(Ntmsg(t
assertTrue(R	tatbR((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pytassertIn#scCsOtjddkr5ddlm}|t�|_nt�|_|j�dS(Niii�(tdo_proxy_db_py3k(	tsystversion_infottest_allRtFalset_flag_proxy_db_py3kRtfilenametdo_open(R	R((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pytsetUp's
cCsQtjddkr3ddlm}||j�n|j�tj|j�dS(Niii�(R(	RRRRRtdo_closeRtunlinkR(R	R((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyttearDown.s

cCs(tjddkr|St|d�SdS(s1Turn key into an appropriate key type for this dbiis	iso8859-1N(RRtbytes(R	tkey((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pytmk5scCs�x�tjD]�}d|||jd|�<t|�||jd|�<|gd||jd|�<t�}d||_t|�|_|gd|_|||jd|�<q
WdS(Ni
tStItLtO(tstringtlettersR%tordRR&R'R((R	tdtxtinst((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyt
populateDB=s	
cCstj|j�|_dS(N(RtopenRR-(R	((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyRKscCs|jj�dS(N(R-tclose(R	((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyR OscCs)tr%dGddGHd|jjGHn|j|j�|jj�|j�|j�|j}t|�}|j	�}|j
�}|j�}tr�dG|GHdG|GHdG|GHn|jd|j
|jd	���|jd
|j
|jd���|jd
|j
|jd���|j|jd��||jd�=|jd|j
|jd���|jd|j
|jd���|jt|�|d
�g}xS|j	�D]E}||}|j|�tr�||fGHn|j||�q�W|j�}	|jt|	�t|j	���tjdkr]|j�|	j�|j||	�nB|jdd��|	jdd��|jt|�t|	��|j�}
|jt|
�t|��x$|
D]\}}|j||�q�W|j|j|jd	��d�|j|j|jd	�d�d�|j|j|jd	�d�d�|j|j|jd	�d
d
dg�d
d
dg�|jd�|jtj|j|jd	��|jd
�|j|jd�d�|j|j|jd��d�|j||jd�d�dS(Ns
s-=isRunning %s.test01_basics...slength:skeys:sstats:isbad keyitIAtOAis%s: %siR$cSs
t|�S(N(tstr(R.((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyt<lambda>�scSs
t|�S(N(R5(R.((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyR6�ssa stringisnew keysnew data(ii(Rt	__class__RR0R-tsyncR RtlentkeyststattfdtassertEqualthas_keyR%tdeletetappendtcheckrectvaluesRRtsorttreprtitemstgettNonetset_get_returns_nonetassertRaisesRtDBNotFoundErrortput(R	R-tltktstfRBR$RtdbvaluesRE((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyt
test01_basicsTsl



			"""""

"

"%%7
"
"cCs�tr%dGddGHd|jjGHn|j|j�|j}d}|j�}|j�}xV|dk	r�|d}tr�|GHn|\}}|j||�t	|d��}q_W~|j
|t|��d}|j�}|j�}xP|dk	r>|d}tr|GHn|\}}|j||�|j
�}q�|j
|t|��|j|jd��|j�\}}|j||�~dS(	Ns
s-=isRunning %s.test02_cursors...iitnexttSS(RR7RR0R-tcursortfirstRGRAtgetattrR=R9tlasttprevtsetR%tcurrent(R	R-tcounttctrecR$R((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyttest02_cursors�s@
	

cCsEtr%dGddGHd|jjGHn|jtj|jjd�dS(Ns
s-=isRunning %s.test03_append...sunit test was here(RR7RRIRt
DBShelveErrorR-R@(R	((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyt
test03_append�s

cCs�|j|j�|j}|j�}t|�}|jt|�t|��x+|D]#}|j||�|j|�qTW|jt|�d�dS(Ni(R0R-R:RYR=R9Rtremove(R	R-R:tkeysetR$((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyttest04_iterable�s	
cCs�tjddkr7t|t�r7|jd�}q7n|d}|ddkr~|jt|�t�|j|d|�n>|ddkr�|jt|�t�|j|t	|��n�ddkr�jt|�t
�|j||gd�n�|dd	kr�tjddkrId
dlm}|jt|�|�n|jt|�t
�|j|jd|�|j|jt	|��|j|j|gd�n|jdd�dS(
Niis	iso8859-1iR&i
R'R(R)i�(tInstanceTypesUnknown key type, fix the test(RRt
isinstanceR#tdecodeR=ttypeR5tintR,tlistttypesRdRR&R'R(R(R	R$RR.Rd((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyRA�s,
(ii(ii(iiN(RRRRRGRRR"R%R0RR RQR^R`RcRA(((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyR s							G	*	
	tBasicShelveTestCasecBseZd�Zd�ZRS(cCs2tj�|_|jj|j|j|j�dS(N(RtDBShelfR-R1Rtdbtypetdbflags(R	((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyRscCs|jj�dS(N(R-R2(R	((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyR s(RRRR (((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyRk�s	tBTreeShelveTestCasecBseZejZejZRS((RRRtDB_BTREERmt	DB_CREATERn(((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyRos	tHashShelveTestCasecBseZejZejZRS((RRRtDB_HASHRmRqRn(((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyRr
s	tThreadBTreeShelveTestCasecBs!eZejZejejBZRS((RRRRpRmRqt	DB_THREADRn(((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyRts	tThreadHashShelveTestCasecBs!eZejZejejBZRS((RRRRsRmRqRuRn(((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyRvs	tBasicEnvShelveTestCasecBs,eZd�Zd�Zd�Zd�ZRS(cCs�tj�|_|jj|j|jtjBtjB�tj	j
|j�d|_tj
|j�|_|jj|j|j|j�dS(Ni(RtDBEnvtenvR1thomeDirtenvflagst
DB_INIT_MPOOLRqtostpathtsplitRRRlR-RmRn(R	((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyRscCs|jj�|jj�dS(N(R-R2Ry(R	((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyR )s
cCst�|_tj|�dS(N(RRzRR(R	((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyR.scCsQtjddkr3ddlm}||j�n|j�tj|j�dS(Niii�(R(	RRRRRR RtrmtreeRz(R	R((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyR"2s

(RRRR RR"(((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyRws	
		tEnvBTreeShelveTestCasecBs eZdZejZejZRS(i(RRR{RRpRmRqRn(((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyR�:s	tEnvHashShelveTestCasecBs eZdZejZejZRS(i(RRR{RRsRmRqRn(((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyR�@s	tEnvThreadBTreeShelveTestCasecBs*eZejZejZejejBZRS((	RRRRuR{RpRmRqRn(((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyR�Fs		tEnvThreadHashShelveTestCasecBs*eZejZejZejejBZRS((	RRRRuR{RsRmRqRn(((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyR�Ls		tRecNoShelveTestCasecBs>eZejZejZd�Zd�Zd�Z	d�Z
RS(cCs;tj|�ttdd��|_i|_i|_dS(Nii�(RkRRitrangetkey_pooltkey_mapt
intkey_map(R	((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyRYs
	cCsJ||jkr?|jjd�|j|<||j|j|<n|j|S(Ni(R�R�tpopR�(R	R$((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyR%ascCs$|j|}tj|||�dS(N(R�RkRA(R	tintkeyRR$((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyRAgs
cCs�tr%dGddGHd|jjGHnd|jd<d|jd<|jd	|jjd��|jd
|jjd��|jd|jjd	��|jd|jjd��|jd|jjd
��|jd|jjd��dS(Ns
s-=isRunning %s.test03_append...tspamiteggsiiisbaked beans(RR7RR-R=R@RF(R	((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyR`ks


(RRRtDB_RECNORmRqRnRR%RAR`(((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyR�Us					cCs�tj�}|jtjt��|jtjt��|jtjt��|jtjt��|jtjt��|jtjt	��|jtjt
��|jtjt��|jtjt��|jtjt
��|S(N(tunittestt	TestSuitetaddTestt	makeSuiteRRoRrRtRvR�R�R�R�R�(tsuite((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyt
test_suite|st__main__tdefaultTestR�((t__doc__R}R*RRR�RRRRRRRRtTestCaseRRkRoRrRtRvRwR�R�R�R�R�R�Rtmain(((s./sys/lib/python2.7/bsddb/test/test_dbshelve.pyt<module>s($.�		'	

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.