HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/test/__pycache__/test_dbm.cpython-310.opt-2.pyc
o

�iq�@s	ddlZddlZddlZddlmZddlmZzddlmZWney,dZYnwejZ	ej
�e	ej�Zdd�Z
dd�Zd	d
�ZGdd�d�ZGd
d�dej�Ze
�D]Zejdd�Zde��Zeeeejfdei�e�e<qWedkr~e��dSdS)�N)�
import_helper)�	os_helper)�ndbmc	csH�tjD]}z	t|dgd�}Wn	tyYqw|tj|<|VqdS)N�open)�fromlist)�dbmZ_names�
__import__�ImportErrorZ_modules)�name�mod�r�*/usr/local/lib/python3.10/test/test_dbm.py�dbm_iterators�
�
�rcCst�t�dS�N)r�rmtree�dirnamerrrr
�cleaunup_test_dir srcCst�t�t�dSr)r�os�mkdirrrrrr
�setup_test_dir#src@s�eZdZddddddd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zd d!�Zd"d#�Zd$S)%�AnyDBMTestCasesPython:sProgrammingstheswaysGuidosintended)�a�b�c�d�f�gcCs8t�td�}|jD]}|j|||�d�<q	|��dS)N�n�ascii)rr�_fname�_dict�encode�close)�selfr�krrr
�init_db1s
zAnyDBMTestCase.init_dbcCs4tdd�|��D��}t|j���}|�||�|S)Ncss�|]}|�d�VqdS)rN)�decode)�.0r$rrr
�	<genexpr>8s�z-AnyDBMTestCase.keys_helper.<locals>.<genexpr>)�sorted�keysr �assertEqual)r#rr*Zdkeysrrr
�keys_helper7szAnyDBMTestCase.keys_helpercCs|�t|jjt��dSr)Z
assertTrue�
issubclass�module�error�OSError�r#rrr
�
test_error=szAnyDBMTestCase.test_errorcCs|�tjtjt�dSr)�assertRaisesrr/rrr1rrr
�test_anydbm_not_existing@sz'AnyDBMTestCase.test_anydbm_not_existingcCsVt�td�}|�t|���g�|jD]}|j|||�d�<q|�|�|�	�dS)Nrr)
rrrr+�listr*r r!�read_helperr"�r#r�keyrrr
�test_anydbm_creationCs

z#AnyDBMTestCase.test_anydbm_creationcCsLt�t�t�td��}|�t|�d�Wd�dS1swYdS)Nrr)rZcreate_empty_filerrrr+�len�r#rrrr
�8test_anydbm_creation_n_file_exists_with_invalid_contentsKs
"�zGAnyDBMTestCase.test_anydbm_creation_n_file_exists_with_invalid_contentscCs`|��t�td�}d|jd<|d<|�|�|�|�dd�d�|�|dd�|��dS)Nrsindentedr�g�xxx�foo)	r%rrrr r6r+�
setdefaultr"r;rrr
�test_anydbm_modificationQs
z'AnyDBMTestCase.test_anydbm_modificationcCs�|��t�td�}|�|�|�|�d�|jd�|�|�dd�d�|�|�d��|�	t
��|dWd�n1sAwY|��dS)N�r�arr>r?)r%rrrr6r+�getr �assertIsNoner3�KeyErrorr"r;rrr
�test_anydbm_read[s

�zAnyDBMTestCase.test_anydbm_readcCs*|��t�td�}|�|�}|��dS)NrB)r%rrrr,r")r#rr*rrr
�test_anydbm_keysgs
zAnyDBMTestCase.test_anydbm_keyscCs�ttjdd�dkr|�d�t�td�}|�|��g�d|d<|�|��dg�|�d|�|�|dd�|�|�	d�d�|�|�
d�d�|��dS)NZlibraryzBerkeley DBzCBerkeley DB doesn't distinguish the empty value from the absent oner�sempty)�getattrr�_defaultmodZskipTestrrr+r*�assertInrDr@r"r;rrr
�test_empty_valuems
zAnyDBMTestCase.test_empty_valuecCs6|��t�td�}d�d�}|�||�|��dS)NrBrr)r%rrrr!rLr"r7rrr
�test_anydbm_access{s

z!AnyDBMTestCase.test_anydbm_accesscCs6|�|�}|jD]}|�|j|||�d��qdS)Nr)r,r r+r!)r#rr*r8rrr
r6�s

�zAnyDBMTestCase.read_helpercs�t�td��V�|����g�ddg}|D]\}}|�|<q|�t����tdd�|D���|D]\}}|�|��|��||�q1|�d��|�t	�fdd��Wd�dS1s_wYdS)	Nr)rC�b)s12345678910s019237410982340912840198242css�|]\}}|VqdSrr)r'r$�vrrr
r(�s�z+AnyDBMTestCase.test_keys.<locals>.<genexpr>r>cs�dS)Nr>rr�rrr
�<lambda>�sz*AnyDBMTestCase.test_keys.<locals>.<lambda>)
rrrr+r*r)rLZassertNotInr3rF)r#rr$rPrrQr
�	test_keys�s
""�zAnyDBMTestCase.test_keyscCs.|�ttdtj�|jt_|�t�t�dS)NrK)�
addCleanup�setattrrrKr.rrr1rrr
�setUp�s

zAnyDBMTestCase.setUpN)�__name__�
__module__�__qualname__r r%r,r2r4r9r<rArGrHrMrNr6rSrVrrrr
r(s,�

rc@s2eZdZdd�Zejedd�dd��Zdd�Zd	S)
�WhichDBTestCasec	Cs�|�ttdtj�t�D]]}|j}t�|t_|�td��Wd�n1s(wY|�	||j�
t��|�td��}d|d<|�d|�|�	|dd�Wd�n1sZwY|�	||j�
t��qdS)NrKr�w�1)rTrUrrKrrWrrrr+�whichdbrL)r#r.r
rrrr
�test_whichdb�s
,��zWhichDBTestCase.test_whichdbzTest requires ndbm)�reasoncCsDttdd��Wd�n1swY|�|j�t��dS)Nz.db�wb)rrrErr]r1rrr
�test_whichdb_ndbm�s.z!WhichDBTestCase.test_whichdb_ndbmcCs |�t�t�t�d�|_dS)Nr)rTrrrZimport_fresh_modulerr1rrr
rV�s
zWhichDBTestCase.setUpN)	rWrXrYr^�unittestZ
skipUnlessrrarVrrrr
rZ�s

rZ�Z	TestCase_r.�__main__)rbrrZtest.supportrrrr	ZTESTFNr�path�joinrrrrrZTestCaserZrrW�suffixZtestname�type�globals�mainrrrr
�<module>s8�t
!
��