Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/bsddb/test/test_compat.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(
sU
Test cases adapted from the test_bsddb.py module in Python's
regression test suite.
i�N(tdbthashopentbtopentrnopentverbosetget_new_database_pathtCompatibilityTestCasecBsGeZd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cCst�|_dS(N(Rtfilename(tself((s,/sys/lib/python2.7/bsddb/test/test_compat.pytsetUpscCs/ytj|j�Wntjk
r*nXdS(N(tostremoveRterror(R((s,/sys/lib/python2.7/bsddb/test/test_compat.pyttearDownscCs|jtd�dS(NR(tdo_bthash_testR(R((s,/sys/lib/python2.7/bsddb/test/test_compat.pyt
test01_btopenscCs|jtd�dS(NR(RR(R((s,/sys/lib/python2.7/bsddb/test/test_compat.pyttest02_hashopensc	Cs�dj�}trdGHnt|jd�}x,tt|��D]}||||d<q?W|d|d|df}tr�d|GHn|j|ddd	�|jd�}|dkr�|jdt	|��nd|d
<|j
�~t|jd�}d|d<d�}|jt||�d�}|jt
||�|d=|j�}x=|r�tri|GHny|j�}WqUtk
r�PqUXqUW|j
�dS(Ns-The quick brown fox jumped over the lazy dog.s
Testing: rnopentciiis%s %s %stquicksdata mismatch!tbrowns$recno database set_location failed: stwenty-fiveitwttwentyicSs|d}dS(Ni((tftrec((s,/sys/lib/python2.7/bsddb/test/test_compat.pytnoRec8scSs|d}dS(Nsa string((RR((s,/sys/lib/python2.7/bsddb/test/test_compat.pytbadKey<s(iR(tsplitRRRtrangetlentassertEqualtset_locationtfailtreprtclosetassertRaisestKeyErrort	TypeErrortfirsttnext(	RtdataRtxtgetTesttrvRRR((s,/sys/lib/python2.7/bsddb/test/test_compat.pyt
test03_rnopens@


			
	cCs t|jd�}|j�dS(Ntn(RRR!(RR((s,/sys/lib/python2.7/bsddb/test/test_compat.pyt
test04_n_flagNscCstrdG|GHn||jd�}tr2dGHn|rItrWdGHqWntrWdGHnd|d<d|d	<d
|d<d|d<d
|d<d|d<tr�d|d	|d|dfGHntr�dGHn|j|j�d�}|d!kr|jdt|��nxYy|j�}Wn5tk
rQ|j||j	�d�|j
�PnXtr
|GHq
q
|j|jd�d�|t
kr�|jd�}|d"kr�jdt|��q�y|jd�}Wntk
r�nX|jd�|j�|j�y)|r"tr0dGHq0ntr0dGHnWntjk
rGnX|jd�~trfdGHn||jd�}d|d<tr�dGHnx,|j�D]}||}tr�|GHq�q�Wd�}	|jt|	|�d �}
|jt|
|�|j�dS(#Ns

Testing: Rscreation...struth test: truestruth test: falsett0tGuidotatvantbtRossumtinventedtdtPythonRs%s %s %sskey ordering...isincorrect first() result: sError, last <> last!sError, missing key!teswrong key,value returned: s7set_location on non-existent key did not raise KeyErrorsException expectedsmodification...Rt
discovereds	access...cSs|d}dS(Nsno such key((RR((s,/sys/lib/python2.7/bsddb/test/test_compat.pyR�scSs|d}dS(Ni((RR((s,/sys/lib/python2.7/bsddb/test/test_compat.pyR�s(R/R.(RsPython(RRRR%RR R&R#Rtlasttprevioust
assertTruethas_keyRtsyncR!RtDBErrortkeysR"R$(RtfactorytwhatRtstartRR8tkeytwordRR((s,/sys/lib/python2.7/bsddb/test/test_compat.pyRSs�





!








		(	t__name__t
__module__R	R
RRR+R-R(((s,/sys/lib/python2.7/bsddb/test/test_compat.pyR
s					0	cCs
tjt�S(N(tunittestt	makeSuiteR(((s,/sys/lib/python2.7/bsddb/test/test_compat.pyt
test_suite�st__main__tdefaultTestRJ(t__doc__R
tstringRHttest_allRRRRRRtTestCaseRRJRFtmain(((s,/sys/lib/python2.7/bsddb/test/test_compat.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.