python (3.11.7)

(root)/
lib/
python3.11/
test/
__pycache__/
test_dbm.cpython-311.pyc

ePdZddlZddlZddlZddlmZddlmZ	ddlmZn
#e$rdZYnwxYwej	Z
eje
ej	Z
dZdZdZGd	d
ZGddejZeD]SZejd
sJejddZdeZeeeejfdeiee<TedkrejdSdS)z=Test script for the dbm.open function based on testdumbdbm.pyN)
import_helper)	os_helper)ndbmc#KtjD]9}	t|dg}n#t$rY"wxYw|tj|<|V:dS)Nopen)fromlist)dbm_names
__import__ImportError_modules)namemods  A/BuggyBox/python/3.11.7/bootstrap/lib/python3.11/test/test_dbm.pydbm_iteratorrss
	TVH555CC			H	 T				
s%
22c8tjtdSN)rrmtreedirnamercleaunup_test_dirr s
WrcTttjtdSr)rosmkdirrrrrsetup_test_dirr#s$HWrceZdZdddddddZdZd	Zd
ZdZdZd
Z	dZ
dZdZdZ
dZdZdZdZdZdZdZdS)AnyDBMTestCasePython:sProgrammingstheswaysGuidosintended)abcdfgctjtd}|jD]%}|j|||d<&|dS)Nnascii)r	r_fname_dictencodeclose)selfr$ks   rinit_dbzAnyDBMTestCase.init_db1sTHVS!!	1	1A#':a=Aahhw  						rctd|D}t|j}||||S)Nc3@K|]}|dVdS)r(N)decode).0r.s  r	<genexpr>z-AnyDBMTestCase.keys_helper.<locals>.<genexpr>8s.::Aahhw''::::::r)sortedkeysr*assertEqual)r-r$r6dkeyss    rkeys_helperzAnyDBMTestCase.keys_helper7sZ:::::::tz(())u%%%rcj|t|jjtdSr)
assertTrue
issubclassmoduleerrorOSErrorr-s r
test_errorzAnyDBMTestCase.test_error=s)
4;#4g>>?????rcf|tjtjtdSr)assertRaisesr	r>rr)r@s rtest_anydbm_not_existingz'AnyDBMTestCase.test_anydbm_not_existing@s$#)SXv66666rcPtjtd}|t	|g|jD]%}|j|||d<&|||	dS)Nr"r()
r	rr)r7listr6r*r+read_helperr,r-r$keys   rtest_anydbm_creationz#AnyDBMTestCase.test_anydbm_creationCsHVS!!affhh,,,:	5	5C%)Z_Acjj!!""						rctjttjtd5}|t
|dddddS#1swxYwYdS)Nr'r)rcreate_empty_filer)r	rr7lenr-r$s  r8test_anydbm_creation_n_file_exists_with_invalid_contentszGAnyDBMTestCase.test_anydbm_creation_n_file_exists_with_invalid_contentsKs#F+++
Xfc
"
"	(aSVVQ'''	(	(	(	(	(	(	(	(	(	(	(	(	(	(	(	(	(	(s$A%%A),A)c^|tjtd}dx|jd<|d<||||ddd||dd|dS)Nr"sindentedr%gxxxfoo)	r/r	rr)r*rGr7
setdefaultr,rNs  rtest_anydbm_modificationz'AnyDBMTestCase.test_anydbm_modificationQsHVS!!$//
3!D'ff55v>>>6F+++						rc4|tjtd}||||d|jd||ddd||d|	t5|ddddn#1swxYwY|dS)Nrar rRrS)r/r	rr)rGr7getr*assertIsNonerCKeyErrorr,rNs  rtest_anydbm_readzAnyDBMTestCase.test_anydbm_read[sHVS!!tdjo666vv..777!%%--(((


x
(
(		
fII																					s$	C99C=C=c|tjtd}||}|dS)NrW)r/r	rr)r9r,)r-r$r6s   rtest_anydbm_keyszAnyDBMTestCase.test_anydbm_keysgsDHVS!!""						rc~ttjdddkr|dtjt
d}||gd|d<||dg|d|||dd||	dd||
dd|dS)NlibraryzBerkeley DBzCBerkeley DB doesn't distinguish the empty value from the absent oner"rsempty)getattrr	_defaultmodskipTestrr)r7r6assertInrYrTr,rNs  rtest_empty_valuezAnyDBMTestCase.test_empty_valuems3?It44
EEMM0
1
1
1HVS!!2&&&(H:...

h"""8c***x#...h//555						rc|tjtd}dd}|||||dksJ|dS)NrWr r(r)r/r	rr)r+rdr,rHs   rtest_anydbm_accessz!AnyDBMTestCase.test_anydbm_access{skHVS!!jj!!

c1v####						rctjtjtddSNr")r	rrfsencoder)r,r@s rtest_open_with_bytesz#AnyDBMTestCase.test_open_with_bytess0V$$c**0022222rctjtjtddSri)r	rrFakePathr)r,r@s rtest_open_with_pathlib_pathz*AnyDBMTestCase.test_open_with_pathlib_paths1#F++S117799999rctjtjt	jtddSri)r	rrrmrrjr)r,r@s r!test_open_with_pathlib_path_bytesz0AnyDBMTestCase.test_open_with_pathlib_path_bytess;#BK$7$788#>>DDFFFFFrc||}|jD]<}||j|||d=dS)Nr()r9r*r7r+)r-r$r6rIs    rrGzAnyDBMTestCase.read_helpersd"":	F	FCTZ_a

70C0C.DEEEE	F	FrcTtjtd5|gddg}|D]
\}}||<|ttd|D|D]7\}}|||||8|d|tfdddddS#1swxYwYdS)Nr")rXb)s12345678910s019237410982340912840198242c3 K|]	\}}|V
dSrr)r3r.vs   rr4z+AnyDBMTestCase.test_keys.<locals>.<genexpr>s&5H5HFQa5H5H5H5H5H5HrrRcdS)NrRr)r#sr<lambda>z*AnyDBMTestCase.test_keys.<locals>.<lambda>s&	r)
r	rr)r7r6r5rdassertNotInrCr[)r-r r.rur#s    @r	test_keyszAnyDBMTestCase.test_keysst
Xfc
"
"
	;aQVVXXr***OPA

1!VAFFHH--v5H5Ha5H5H5H/H/HIII
*
*1

a###  1q))))VQ'''h(9(9(9(9:::
	;
	;
	;
	;
	;
	;
	;
	;
	;
	;
	;
	;
	;
	;
	;
	;
	;
	;sC4DD!$D!c|ttdtj|jt_|t
t
dS)Nrb)
addCleanupsetattrr	rbr=rrr@s rsetUpzAnyDBMTestCase.setUpsJmS_EEE+)***rN)__name__
__module____qualname__r*r/r9rArDrJrOrUr\r^rergrkrnrprGryr}rrrrr(s: 

E@@@777(((


333:::GGGFFF
;;;rrcPeZdZdZejeddZdZdS)WhichDBTestCasecf|ttdtjt	jt}ttjt|tj|g}tD]'}|j
}t|t_|td5dddn#1swxYwY|D]0}|
||j|1|td5}d|d<|d||
|dddddn#1swxYwY|D]0}|
||j|1)dS)Nrbr"w1)r{r|r	rbrrjr)rrmrr~rrr7whichdbrd)r-_bytes_fnamefnamesr=rpathr$s       rtest_whichdbzWhichDBTestCase.test_whichdbsmS_EEE{6**),V44	 2< @ @B"nn	?	?F?D$COVS))/////////////////
?
?  tx'7'7'='=>>>>VS))
0Q$

dA&&&  4$///
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
?
?  tx'7'7'='=>>>>
?#	?	?s$CC	C	-8E11E5	8E5	zTest requires ndbm)reasoncdttdzd5dddn#1swxYwYtjt}tt	jt|t	j|g}|D]/}||j|0dS)Nz.dbwb)	rr)rrjrrmrZr	r)r-rrrs    rtest_whichdb_ndbmz!WhichDBTestCase.test_whichdb_ndbms&5.$
'
'-----------------{6**),V44	 2< @ @B	6	6Ddh..t445555	6	6s&**c|tttjd|_dS)Nr	)r{rrrimport_fresh_moduler	r@s rr}zWhichDBTestCase.setUps7)*** 4U;;rN)	r~rrrunittest
skipUnlessrrr}rrrrrsa???2X&:;;;66<;6<<<<<rrzdbm.	TestCase_r=__main__)__doc__rr	rtest.supportrrrrTESTFNrrjoinr)rrrrTestCaserrr~
startswithsuffixtestnametypeglobalsmainrrr<module>rsCC



				&&&&&&""""""DDD
	gy/	0	0

zzzzzzzzz'<'<'<'<'<h''<'<'<T<>>00C<""6*****
\!""
F#6##H$x .0AB (#00GGIIh
zHMOOOOOs#--