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

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


��Qc@s�dZddlZddlZddlZddlmZmZmZmZm	Z	m
Z
dejfd��YZd�Z
edkr�ejdd	�ndS(
s&Miscellaneous bsddb module test cases
i�N(tdbtdbshelvethashopenttest_supporttget_new_environment_pathtget_new_database_pathtMiscTestCasecBsbeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
cCst�|_t�|_dS(N(RtfilenameRthomeDir(tself((s*/sys/lib/python2.7/bsddb/test/test_misc.pytsetUpscCs$tj|j�tj|j�dS(N(RtunlinkRtrmtreeR(R	((s*/sys/lib/python2.7/bsddb/test/test_misc.pyttearDownscCs9tj|j�}|j�|jtj|jd�dS(Ntfoo(RtopenRtclosetassertRaisesRtDBErrortget(R	tdbs((s*/sys/lib/python2.7/bsddb/test/test_misc.pyttest01_badpointers
cCs�tj�}|j|jdk�|j|jtj�tj	ddkrd|j
|j|j�n|j
t|jd�|j�dS(Niitascii(RtDBEnvt
assertTruetdb_hometNoneRRt	DB_CREATEtsystversion_infotassertEqualtbytes(R	tenv((s*/sys/lib/python2.7/bsddb/test/test_misc.pyttest02_db_homescCs9t|j�}|j�t|�}|j|d�dS(Ns{}(RRRtreprR(R	Rtrp((s*/sys/lib/python2.7/bsddb/test/test_misc.pyttest03_repr_closed_db#s
cCs�t|j�}i}xHtd�D]:}td|�|t|�<td|�|t|�<q"W|j�t|j�}t|�}|j|t|��|j�dS(Nid(RRtxrangeR"RR(R	RtdtiR#((s*/sys/lib/python2.7/bsddb/test/test_misc.pyttest04_repr_db)s
cCsyzWtj�}|j|jdtjtjtjB�|j�}|j	dtj
�}Wd|j�tj
|j�XdS(Ns/foo(RtDBRRRtDB_BTREERt	DB_THREADtcursorRtDB_SETRRR(R	tdb1tcurstt((s*/sys/lib/python2.7/bsddb/test/test_misc.pyttest05_double_free_make_key_dbt<s
cCs�z�tj�}|j|jdtjtj�d|d<d|d<d|d<d|d<|j�}|j�|j	ddddg|�|j	|dd�|j	|dd�|j	|dd�|j	|dd�Wd|j
�tj|j�XdS(	Nseh?taseh zed.tas
eh zed eh?taas	eh eh eh!taaa(
RR)RRRtDB_HASHRtkeystsortRRRR(R	R.R7((s*/sys/lib/python2.7/bsddb/test/test_misc.pyttest06_key_with_null_bytesIs 





cCs"ztj�}|jtj�|j|jtjtj�d|d<d|d<|jdg|j	��|j
dd�|jddg|j	��|j�tj�}|j|jtj�|jd	d
g|j	��d|d<|jdg|j	��Wd|j�tj
|j�XdS(NtehR2tAtAasnew A(R2R;(R2R;(R2R<(R2R;(R2R<(R2snew A(RR)t	set_flagst
DB_DUPSORTRRR6RRtitemstputRRR(R	R.((s*/sys/lib/python2.7/bsddb/test/test_misc.pyttest07_DB_set_flags_persists\s"




cCs�|jttjt��x�tjj�D]w\}}|jd�r)|jd�r)|jt|tj�d|�|dkr�|j	t|t
�d|�q�q)q)W|jttjt
��|jttjt
��dS(NR)tErrortmsgtDBKeyEmptyErrortDBNotFoundError(sDBKeyEmptyErrorsDBNotFoundError(
Rt
issubclassRRt	Exceptiont__dict__R?t
startswithtendswithtassertFalsetKeyErrorRDRE(R	R'tj((s*/sys/lib/python2.7/bsddb/test/test_misc.pyttest08_ExceptionTypesus&(t__name__t
__module__R
R
RR!R$R(R1R9RARN(((s*/sys/lib/python2.7/bsddb/test/test_misc.pyRs				
			
		cCs
tjt�S(N(tunittestt	makeSuiteR(((s*/sys/lib/python2.7/bsddb/test/test_misc.pyt
test_suite�st__main__tdefaultTestRS(t__doc__tosRRQttest_allRRRRRRtTestCaseRRSROtmain(((s*/sys/lib/python2.7/bsddb/test/test_misc.pyt<module>s.z	

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.