python (3.11.7)

(root)/
lib/
python3.11/
test/
__pycache__/
test_dbm_dumb.cpython-311.opt-2.pyc

eN,	ddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
ddlmZddl
mZejZdZGddejZedkrejdSdS)	N)support)	os_helper)partialcjdD]/}	tjt|z #t$rY,wxYwdS)N.dir.dat.bak)osunlink_fnameOSError)exts F/BuggyBox/python/3.11.7/bootstrap/lib/python3.11/test/test_dbm_dumb.py
_delete_filesrsW'	Ifsl####			D	s#
00ceZdZddddddddd	d
ddd
ddddiZdZejee	dde
jdZdZ
dZdZdZdZdZdZdZdZdZd Zd!Zd"Zd#Zd$Zd%Zd&Zd'Zd(Zd)Z e
jd*Z!eje
j"d+d,Z#d-Z$d.Z%d/Z&d0Z'd1Z(d2S)3DumbDBMTestCase0asPython:bsProgrammingcsthedswayfsGuidogsintendedüutf-8!cXtjtjtd5}|t
|g|jD]}|j|||<|	|ddddS#1swxYwYdSNc)

contextlibclosingdumbdbmopenr
assertEquallistkeys_dictread_helper)selffkeys   rtest_dumbdbm_creationz%DumbDBMTestCase.test_dumbdbm_creation%s

VS 9 9
:
:	 aT!&&((^^R000z
)
)C#Q		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 sA%BB#&B#umaskztest needs os.umask()c.	tjd}tjtdd}|tj|n#tj|wxYwd}tjdkrd}ddl}tjtdz}||j	|j
|tjtd	z}||j	|j
|dS)
Nr!iiposixirr	r)rr/r$r%r
closenamestatr&S_IMODEst_mode)r+	old_umaskr,
expected_moder5sts      rtest_dumbdbm_creation_modez*DumbDBMTestCase.test_dumbdbm_creation_mode,s	 IVS%00A
GGIIIHYBHY

7g"M
WVf_
%
%bj11=AAA
WVf_
%
%bj11=AAAAAsAAA0ctjt}d|d<||dd||dS)Nrr)r$r%r
r&r3r+r,s  rtest_close_twicez DumbDBMTestCase.test_close_twiceBsRL  $4$'''										rc|tjtjt
d5}dx|jd<|d<||||	ddd||ddddddS#1swxYwYdS)Nwsindentedrxxxfoo)
init_dbr"r#r$r%r
r)r*r&
setdefaultr=s  rtest_dumbdbm_modificationz)DumbDBMTestCase.test_dumbdbm_modificationIs

VS 9 9
:
:	0a)44DJtqwQQ\\&&996BBBQvY///	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0sA+B99B=B=cR|tjtjt
d5}|||tjd5d|d<dddn#1swxYwY|tjd5|d=dddn#1swxYwY|	|
d|jd|	|
ddd||
d|
t5|ddddn#1swxYwYddddS#1swxYwYdS)Nrz'The database is opened for reading onlyxrrrArB)rCr"r#r$r%r
r*assertRaisesRegexerrorr&getr)assertIsNoneassertRaisesKeyErrorr=s  rtest_dumbdbm_readz!DumbDBMTestCase.test_dumbdbm_readRsx

VS 9 9
:
:
	aQ''
$MOO

$














''
$MOO

dG















QUU4[[$*T*:;;;QUU6622F;;;aeeFmm,,,""8,,

&		















	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	s6F7B	=F	B
	
FB
	#F4C8FC	FC	B#F/	F8FF	FF	FF #F c|tjtjt
5}||}ddddS#1swxYwYdSN)rCr"r#r$r%r
keys_helper)r+r,r(s   rtest_dumbdbm_keysz!DumbDBMTestCase.test_dumbdbm_keyscs

V 4 4
5
5	'##A&&D	'	'	'	'	'	'	'	'	'	'	'	'	'	'	'	'	'	'sA##A'*A'ctjtjt5}d|d<|d|ddddS#1swxYwYdS)Nhello1)r"r#r$r%r
assertInr=s  rtest_write_containsz#DumbDBMTestCase.test_write_containshs

V 4 4
5
5	#AdGMM$"""	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#sAAAc`tjtjt5}d|d<d|d<dddn#1swxYwYtjtjt5}||ddddddS#1swxYwYdS)NrUrVhello2)r"r#r$r%r
r&r=s  rtest_write_write_readz%DumbDBMTestCase.test_write_write_readms

V 4 4
5
5	 AdGAdG	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 
V 4 4
5
5	1QtWi000	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1s#AA
A9B##B'*B'c,|tjtjt
d5}||d|jddddddS#1swxYwYdS)NrGrr)	rCr"r#r$r%r
r&r)encoder=s  r
test_str_readzDumbDBMTestCase.test_str_readus

VS 9 9
:
:	PaQx[$*X__W5M5M*NOOO	P	P	P	P	P	P	P	P	P	P	P	P	P	P	P	P	P	Ps;B		B
B
cP|tjtjt
5}d|d<d|d<dddn#1swxYwYtjtjt
d5}|d|||dd|j	dd||ddddddS#1swxYwYdS)	Nrra1rGrrVr)
rCr"r#r$r%r
rWr&r]r)r=s  rtest_str_write_containsz'DumbDBMTestCase.test_str_write_containszs

V 4 4
5
5	AhKAcF															
VS 9 9
:
:	,aMM(A&&&Qxw778!Z(@(@A
C
C
CQtWd+++		,	,	,	,	,	,	,	,	,	,	,	,	,	,	,	,	,	,s%AAABDD"Dctjtjt5}d|d<d|d<dddn#1swxYwYtjtdzd5}|}dddn#1swxYwYtjdkr|	dd	}n|	d	d}tjtdzd
5}|
|dddn#1swxYwYtjt}||dd||dddS)NrUrVrZ2rrb

s
wb)r"r#r$r%r
ioreadrlinesepreplacewriter&)r+r,filedatas    rtest_line_endingsz!DumbDBMTestCase.test_line_endingss
V 4 4
5
5	 AdGAdG	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 
WVf_d
+
+	t99;;D															
:<<w//DD<<//D
WVf_d
+
+	tJJt															
L  4(+++4),,,,,s5AA
A+BBB1DDDc||}|jD])}||j|||*dSrQ)rRr)r&)r+r,r(r-s    rr*zDumbDBMTestCase.read_helpersS"":	6	6CTZ_af5555	6	6rctjtjtd5}|jD]}|j|||<	ddddS#1swxYwYdSNn)r"r#r$r%r
r)r+r,ks   rrCzDumbDBMTestCase.init_dbs

VS 9 9
:
:	%aZ
%
%z!}!
%	%	%	%	%	%	%	%	%	%	%	%	%	%	%	%	%	%	%sAAAct|}t|j}||||SrQ)sortedr(r)r&)r+r,r(dkeyss    rrRzDumbDBMTestCase.keys_helpersKaffhhtz(())u%%%rcBddl}i}tdD]}tjt	jt5}tdD]}|d}|dkr||vr||=||=:|d|dz}|||<|||<|	|||	dddn#1swxYwYtjt	jt5}td|D}t|}|	||dddn#1swxYwYdS)	Nrd
abcdefghijklmg?)rrri'c3JK|]\}}|d|fVdS)zlatin-1N)r]).0rvvs   r	<genexpr>z.DumbDBMTestCase.test_random.<locals>.<genexpr>s7!Q!Qtq!188I#6#6":!Q!Q!Q!Q!Q!Qr)randomranger"r#r$r%r
choice	randranger&rxitems)	r+rddummyr,rvrexpectedgots	         rtest_randomzDumbDBMTestCase.test_randoms


1XX	0	0E#GL$8$899
2Q"3ZZ
2
2E

o66A}},,66 !! !!"MM*<==@P@PQV@W@WW ! !((1q1111
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2#GL$8$899
0Q!!Q!Qqwwyy!Q!Q!QQQQWWYY''  3///
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0	0	0s&BC--C1	4C1	#A#FF	F	ctjtd5}d|d<dddn#1swxYwYtjtd5}|t	|dgdddn#1swxYwY|tj5|ddddS#1swxYwYdS)Nr!zcontext managerzdumbdbm context managerrGsdumbdbm context manager)r$r%r
r&r'r(rMrJ)r+dbs  rtest_context_managerz$DumbDBMTestCase.test_context_managers
\&#
&
&	>",=B()	>	>	>	>	>	>	>	>	>	>	>	>	>	>	>\&#
&
&	L"T"''))__/I.JKKK	L	L	L	L	L	L	L	L	L	L	L	L	L	L	L

w}
-
-		GGIII																		s0-117BBB?C!!C%(C%cftjtd}|t	t
j|t	t
j|dt	t
j|t	t
j	|fD]l}|
tj5}|ddddn#1swxYwY|t|jdmtjdtjdtjdt fD]l}|
tj5}||dddn#1swxYwY|t|jdmdS)Nr!btestz"DBM object has already been closedr(iterkeysr)r$r%r
r3roperatordelitemsetitemgetitemcontainsrMrJr&str	exceptionmethodcallerlen)r+r,methcms    rtest_check_closedz!DumbDBMTestCase.test_check_closedsL%%				X-q11X-q#66X-q11X.224	C	CD""7=11
RV














S..A
C
C
C
C*622*:66*733	C	CD""7=11
RQ














S..A
C
C
C
C
	C	Cs$7CC	C	%E==F	F	cVtjtd5}|jD]}|j|||<	dddn#1swxYwYtjtd5}||gddddS#1swxYwYdSrs)r$r%r
r)r&r(rus   rtest_create_newzDumbDBMTestCase.test_create_news 
\&#
&
&	%!Z
%
%z!}!
%	%	%	%	%	%	%	%	%	%	%	%	%	%	%	%\&#
&
&	+!QVVXXr***	+	+	+	+	+	+	+	+	+	+	+	+	+	+	+	+	+	+s#AA
A()BB"%B"cttdzdd5}|ddddn#1swxYwYtj5}|t5tjt5}	dddn#1swxYwYdddn#1swxYwY||	dddddS#1swxYwYdS)Nrr@r)encodingzstr(print('Hacked!')), 0
)
r%r
rmrcaptured_stdoutrM
ValueErrorr$r&getvalue)r+streamstdoutr,s    r	test_evalzDumbDBMTestCase.test_evals
&6/3
9
9
9	7VLL5666	7	7	7	7	7	7	7	7	7	7	7	7	7	7	7

$
&
&	4&"":..

\&))Q















V__..333		4	4	4	4	4	4	4	4	4	4	4	4	4	4	4	4	4	4si=AAC56B5BB5B""B5%B"&B5)C55B9	9C5<B9	=+C55C9<C9cdD]}t|t5tjt
|dddn#1swxYwY|tj	t
dz|tj	t
dzdS)NrGr@rr
)
rrMFileNotFoundErrorr$r%r
assertFalserpathexists)r+values  rtest_missing_dataz!DumbDBMTestCase.test_missing_datas	>	>EOOO""#455
,
,VU+++
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,RW^^FVO<<===RW^^FVO<<====	>	>sAA	A	c.tjtd5}	dddn#1swxYwYtjtdzdD]}|t5tjt|dddn#1swxYwY|tj	tdz|tj	tdzdS)Nrtrrr
)
r$r%r
rrrMrrrr)r+r,rs   rtest_missing_indexz"DumbDBMTestCase.test_missing_indexsa
\&#
&
&	!															
	&6/"""	>	>E""#455
,
,VU+++
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,RW^^FVO<<===RW^^FVO<<====		>	>s)--.BB	B	cdD]O}|td5tjt|dddn#1swxYwYPdS)N)xrfNz)Flag must be one of 'r', 'w', 'c', or 'n')rIrr$r%r
)r+flags  rtest_invalid_flagz!DumbDBMTestCase.test_invalid_flags%	+	+D''
)@AA
+
+VT***
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+	+	+sAA	A	ctj5}tj|d}tj|d5}|t|	g|j
D]}|j
|||<	dddn#1swxYwYtj|dztj
tj|dztj
tj|tj
tjztj|d5}|t|	t|j
|dddn#1swxYwYddddS#1swxYwYdS)Nrrtrr	rG)rtemp_dirrrjoinr$r%r&r'r(r)chmodr5S_IRUSRS_IXUSRrxr3)r+dirfnamer,r-s     rtest_readonly_filesz#DumbDBMTestCase.test_readonly_files
s$


!
!	SGLLd++EeS))
-Q  affhh444:--C!Z_AcFF-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
HUV^T\222HUV^T\222HS$,t|3444eS))
Q  !1!16$*3E3EFFF			














																		s\6F7
AB'F7'B+	+F7.B+	/BF77AFF7F#	#F7&F#	'F77F;>F;z*requires OS support of non-ASCII encodingsctj}dD]%}|tj||z&t	j|d5}d|d<dddn#1swxYwY|tj	|dz|tj	|dzt	j|d5}|
t|dg|d|v|
|ddddddS#1swxYwYdS)Nrr!svalueskeyr	rrG)
rTESTFN_NONASCII
addCleanuprr$r%
assertTruerrrr&r'r()r+filenamesuffixrs    rtest_nonascii_filenamez&DumbDBMTestCase.test_nonascii_filenames,.	A	AFOOI,h.?@@@@
\(C
(
(	"B!BvJ	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"x&'899:::x&'899:::
\(C
(
(	3BT"''))__vh777OOFbL)))RZ222	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3s%
AA #A &A*EE!$E!ctjtjtddSr )r$r%rFakePathr
r3r+s rtest_open_with_pathlib_pathz+DumbDBMTestCase.test_open_with_pathlib_path+s1Y'//55;;=====rctjtjtddSr )r$r%rfsencoder
r3rs rtest_open_with_bytes_pathz)DumbDBMTestCase.test_open_with_bytes_path.s0R[((#..4466666rctjtjt	jtddSr )r$r%rrrrr
r3rs r!test_open_with_pathlib_bytes_pathz1DumbDBMTestCase.test_open_with_pathlib_bytes_path1s;Y'F(;(;<<cBBHHJJJJJrc"tdSrQrrs rtearDownzDumbDBMTestCase.tearDown4rc"tdSrQrrs rsetUpzDumbDBMTestCase.setUp7rrN))__name__
__module____qualname__r]r)r.unittest
skipUnlesshasattrrrskip_unless_working_chmodr;r>rErOrSrXr[r^rbrpr*rCrRrrrrrrrrrrrrrrrrrrrrs
3
:
>
6
6
8
;
__W
%
%
E   XW--/FGG(BB)(HGB(000"'''
###
111PPP
	,	,	,---,666
%%%
000,CCC,+++444>>>>>>+++()(X2EGG33GG3>>>777KKKrr__main__)r"rirrr5rdbm.dumbdumbr$rrtest.supportr	functoolsrTESTFNr
rTestCaserrmainrrr<module>rs								""""""		^^^^^h'^^^B	zHMOOOOOr