��Qc@s�dZddlZddlZddlZddlmZmZmZmZm Z m
Z
dejfd��YZd�Z
edkr�ejdd �ndS(
s&Miscellaneous bsddb module test cases
i�N(tdbtdbshelvethashopenttest_supporttget_new_environment_pathtget_new_database_pathtMiscTestCasecBsbeZd�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.pytsetUpscCs$tj|j�tj|j�dS(N(RtunlinkRtrmtreeR(R ((s*/sys/lib/python2.7/bsddb/test/test_misc.pyttearDownscCs9tj|j�}|j�|jtj|jd�dS(Ntfoo(RtopenRtclosetassertRaisesRtDBErrortget(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_CREATEtsystversion_infotassertEqualtbytes(R tenv((s*/sys/lib/python2.7/bsddb/test/test_misc.pyttest02_db_homescCs9t|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�tj
|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�tj
|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
��|jttjt
��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
|