Sindbad~EG File Manager

Current Path : /proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/
Upload File :
Current File : //proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/test_dbm.cpython-312.pyc

�

'ΜgP���dZddlZddlZddlZddlmZddlmZ	ddlmZejZ
ejje
ej�Z
d�Zd�Zd�ZGd	�d
�ZGd�dej$�Ze�D]SZej*j-d
�sJ�ej*ddZde��Zeeeej$fdei�e�e<�Uedk(rej6�yy#e$rdZY��wxYw)z=Test script for the dbm.open function based on testdumbdbm.py�N)�
import_helper)�	os_helper)�ndbmc#�K�tjD](}	t|dg��}|tj|<|���*y#t$rY�7wxYw�w)N�open)�fromlist)�dbm�_names�
__import__�ImportError�_modules)�name�mods  �*/usr/local/lib/python3.12/test/test_dbm.py�dbm_iteratorrsO�����
�
��	��T�V�H�5�C�!����T���	�
���	��	�s%�A�?�A�	A�A�
A�Ac�6�tjt�y�N)r�rmtree�dirname��r�cleaunup_test_dirr s��
���W�rc�J�t�tjt�yr)r�os�mkdirrrrr�setup_test_dirr#s�����H�H�W�rc��eZdZddddddd�Zd�Zd	�Zd
�Zd�Zd�Zd
�Z	d�Z
d�Zd�Zd�Z
d�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�AnyDBMTestCase�Python:sProgrammingstheswaysGuidosintended)�a�b�c�d�f�gc��tjtd�}|jD]#}|j|||j	d�<�%|j�y)N�n�ascii)r	r�_fname�_dict�encode�close)�selfr$�ks   r�init_dbzAnyDBMTestCase.init_db1sD���H�H�V�S�!�����A�#'�:�:�a�=�A�a�h�h�w�� ��	���	rc��td�|j�D��}t|jj��}|j||�|S)Nc3�>K�|]}|jd����y�w)r(N)�decode)�.0r.s  r�	<genexpr>z-AnyDBMTestCase.keys_helper.<locals>.<genexpr>8s����:��A�a�h�h�w�'��s�)�sorted�keysr*�assertEqual)r-r$r6�dkeyss    r�keys_helperzAnyDBMTestCase.keys_helper7sB���:�����:�:���t�z�z���(�)������u�%��rc�j�|jt|jjt��yr)�
assertTrue�
issubclass�module�error�OSError�r-s r�
test_errorzAnyDBMTestCase.test_error=s�����
�4�;�;�#4�#4�g�>�?rc�j�|jtjtjt�yr)�assertRaisesr	r>rr)r@s r�test_anydbm_not_existingz'AnyDBMTestCase.test_anydbm_not_existing@s�����#�)�)�S�X�X�v�6rc�0�tjtd�}|jt	|j��g�|jD]#}|j|||jd�<�%|j|�|j�y)Nr"r()
r	rr)r7�listr6r*r+�read_helperr,�r-r$�keys   r�test_anydbm_creationz#AnyDBMTestCase.test_anydbm_creationCsl���H�H�V�S�!������a�f�f�h���,��:�:�C�%)�Z�Z��_�A�c�j�j��!�"�������	���	rc���tjt�tjtd�5}|jt
|�d�ddd�y#1swYyxYw)Nr'r)r�create_empty_filer)r	rr7�len�r-r$s  r�8test_anydbm_creation_n_file_exists_with_invalid_contentszGAnyDBMTestCase.test_anydbm_creation_n_file_exists_with_invalid_contentsKs@���#�#�F�+�
�X�X�f�c�
"�a����S��V�Q�'�#�
"�
"�s�A�A"c�0�|j�tjtd�}dx|jd<|d<|j|�|j
|jdd�d�|j
|dd�|j�y)Nr"sindentedr%�g�xxx�foo)	r/r	rr)r*rGr7�
setdefaultr,rNs  r�test_anydbm_modificationz'AnyDBMTestCase.test_anydbm_modificationQsw�������H�H�V�S�!��$/�/��
�
�3��!�D�'������������f�f�5�v�>�����6��F�+�	���	rc���|j�tjtd�}|j	|�|j|j
d�|jd�|j|j
dd�d�|j|j
d��|jt�5|dddd�|j�y#1swY�xYw)N�r�ar rRrS)r/r	rr)rGr7�getr*�assertIsNonerC�KeyErrorr,rNs  r�test_anydbm_readzAnyDBMTestCase.test_anydbm_read[s��������H�H�V�S�!�������������t��d�j�j��o�6�������v�v�.��7����!�%�%��-�(�
�
�
�x�
(�
�f�I�)�	���	�)�
(�s�C � C)c��|j�tjtd�}|j	|�}|j�y)NrW)r/r	rr)r9r,)r-r$r6s   r�test_anydbm_keyszAnyDBMTestCase.test_anydbm_keysgs4�������H�H�V�S�!������"��	���	rc��ttjdd�dk(r|jd�tjt
d�}|j
|j�g�d|d<|j
|j�dg�|jd|�|j
|dd�|j
|jd�d�|j
|jd�d�|j�y)N�libraryzBerkeley DBzCBerkeley DB doesn't distinguish the empty value from the absent oner"rsempty)�getattrr	�_defaultmod�skipTestrr)r7r6�assertInrYrTr,rNs  r�test_empty_valuezAnyDBMTestCase.test_empty_valuems����3�?�?�I�t�4�
�E��M�M�0�
1��H�H�V�S�!���������2�&���(���������H�:�.��
�
�h��"�����8��c�*�������x��#�.�������h�/��5�	���	rc���|j�tjtd�}dj	d�}|j||�||dk(sJ�|j
�y)NrWr r(r)r/r	rr)r+rdr,rHs   r�test_anydbm_accessz!AnyDBMTestCase.test_anydbm_access{sR�������H�H�V�S�!���j�j��!���
�
�c�1����v��#�$�#�	���	rc�z�tjtjt�d�j�y�Nr")r	rr�fsencoder)r,r@s r�test_open_with_bytesz#AnyDBMTestCase.test_open_with_bytes�s"��������V�$�c�*�0�0�2rc�z�tjtjt�d�j�yri)r	rr�FakePathr)r,r@s r�test_open_with_pathlib_pathz*AnyDBMTestCase.test_open_with_pathlib_path�s$������#�#�F�+�S�1�7�7�9rc��tjtjt	j
t��d�j�yri)r	rrrmrrjr)r,r@s r�!test_open_with_pathlib_path_bytesz0AnyDBMTestCase.test_open_with_pathlib_path_bytes�s-������#�#�B�K�K��$7�8�#�>�D�D�Frc��|j|�}|jD]3}|j|j|||jd���5y)Nr()r9r*r7r+)r-r$r6rIs    rrGzAnyDBMTestCase.read_helper�sF������"���:�:�C����T�Z�Z��_�a��
�
�7�0C�.D�E�rc����tjtd�5�|j�j	�g�ddg}|D]
\}}|�|<�|jt�j	��td�|D���|D],\}}|j
|��|j�||��.|jd��|jt�fd��ddd�y#1swYyxYw)Nr")rX�b)s12345678910s019237410982340912840198242c3�&K�|]	\}}|���y�wrr)r3r.�vs   rr4z+AnyDBMTestCase.test_keys.<locals>.<genexpr>�s����5H�a�F�Q��a�a�s�rRc����dS)NrRr)r#s�r�<lambda>z*AnyDBMTestCase.test_keys.<locals>.<lambda>�s	����&�	r)
r	rr)r7r6r5rd�assertNotInrCr[)r-r r.rur#s    @r�	test_keyszAnyDBMTestCase.test_keys�s����
�X�X�f�c�
"�a����Q�V�V�X�r�*��O�P�A����1���!������V�A�F�F�H�-�v�5H�a�5H�/H�I����1��
�
�a��#�� � ��1��q�)��
���V�Q�'����h�(9�:�#�
"�
"�s�C	C.�.C7c��|jttdtj�|jt_|jt
�t
�y)Nrb)�
addCleanup�setattrr	rbr=rrr@s r�setUpzAnyDBMTestCase.setUp�s6�������m�S�_�_�E��+�+������)�*��rN)�__name__�
__module__�__qualname__r*r/r9rArDrJrOrUr\r^rergrkrnrprGryr}rrrrr(ss��� �����
�E���@�7��(��
����3�:�G�F�
;�rrc�L�eZdZd�Zej
ed��d��Zd�Zy)�WhichDBTestCasec��|jttdtj�t	j
t�}ttjt�|tj|�g}t�D]�}|j}t�|t_|jtd�5ddd�|D]-}|j||jj|���/|jtd�5}d|d<|jd|�|j|dd�ddd�|D]-}|j||jj|���/��y#1swY��xYw#1swY�JxYw)Nrbr"�w�1)r{r|r	rbrrjr)rrmrr~rrr7�whichdbrd)r-�_bytes_fname�fnamesr=r�pathr$s       r�test_whichdbzWhichDBTestCase.test_whichdb�s+�������m�S�_�_�E��{�{�6�*���)�,�,�V�4��	� 2� 2�<� @�B��"�n�F��?�?�D���$�C�O����V�S�)�)���� � ��t�x�x�'7�'7��'=�>�����V�S�)�Q���$���
�
�d�A�&�� � ��4��$�/�*���� � ��t�x�x�'7�'7��'=�>��#%�*�)��*�)�s�<E7�
-F�7F	�F	zTest requires ndbm)�reasonc�P�ttdzd�5ddd�tjt�}tt	j
t�|t	j
|�g}|D],}|j
|jj|���.y#1swY��xYw)Nz.db�wb)	rr)rrjrrmrZr	r�)r-r�r�r�s    r�test_whichdb_ndbmz!WhichDBTestCase.test_whichdb_ndbm�s{���&�5�.�$�
'�
'��{�{�6�*���)�,�,�V�4��	� 2� 2�<� @�B���D����d�h�h�.�.�t�4�5��	(�
'�s�B�B%c�v�|jt�t�tjd�|_y)Nr	)r{rrr�import_fresh_moduler	r@s rr}zWhichDBTestCase.setUp�s'�����)�*��� �4�4�U�;��rN)	r~rr�r��unittest�
skipUnlessrr�r}rrrr�r��s0��?�2�X����&:�;�6�<�6�<rr�zdbm.��	TestCase_r=�__main__)�__doc__r�r	r�test.supportrrrr�TESTFNrr��joinr)rrrr�TestCaser�rr~�
startswith�suffix�testname�type�globals�mainrrr�<module>r�s��C��
�	�&�"����
�
��	�����g�y�/�/�	0��
���
z�z�z'<�h�'�'�'<�T�>�C��<�<�"�"�6�*�*�*�
�\�\�!�"�
�F��6�(�#�H��x� .��0A�0A�B� (�#��0�G�I�h��	��z���H�M�M�O���[���D��s�C1�1C;�:C;

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists