Current File : //usr/local/apps/python3/lib/python3.11/test/__pycache__/test_zipfile64.cpython-311.opt-2.pyc
�

�Keo���ddlmZejdd��ddlZddlZddlZddlZddlZddlm	Z	ddl
mZddl
mZej
Z
e
dzZd	ZGd
�dej��ZGd�d
ej��Zedkrej��dSdS)�)�support�extralargefilez>test requires loads of disk-space bytes and a long time to runN)�
TemporaryFile)�	os_helper)�
requires_zlib�2�<c�L�eZdZd�Zd�Zd�Ze��d���Zd�ZdS)�TestsWithSourceFilec�"�d�td��D��}d�|���d��|_t	t
d��5}|�|j��ddd��dS#1swxYwYdS)Nc3� K�|]	}d|zV��
dS)zTest of zipfile line %d.N�)�.0�is  �=/usr/local/apps/python3/lib/python3.11/test/test_zipfile64.py�	<genexpr>z,TestsWithSourceFile.setUp.<locals>.<genexpr> s(����K�K�q�.��2�K�K�K�K�K�K�i@B�
�ascii�wb)�range�join�encode�data�open�TESTFN�write)�self�line_gen�fps   r�setUpzTestsWithSourceFile.setUps���K�K�E�'�N�N�K�K�K���I�I�h�'�'�.�.�w�7�7��	��&�$�
�
�	 �2��H�H�T�Y����	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 ����	 �	 �	 �	 �	 �	 s�B�B�Bc���tj|d|��5}dt|j��z}t	j��tz}t|��D]�}|�d|z|j��|t	j��krYt	j��tz}td||fztj���tj�����	ddd��n#1swxYwYtj|d|��5}t|��D]�}|�
|�d|z��|j��|t	j��krYt	j��tz}td||fztj���tj�����	ddd��dS#1swxYwYdS)N�wlztestfn%dz/  zipTest still writing %d of %d, be patient...)�file�rz/  zipTest still reading %d of %d, be patient...)�zipfile�ZipFile�lenr�time�	monotonic�_PRINT_WORKING_MSG_INTERVALr�writestr�print�sys�
__stdout__�flush�assertEqual�read)r�f�compression�zipfp�	filecount�	next_time�nums       r�zipTestzTestsWithSourceFile.zipTest'sT��
�_�Q��[�
1�
1�	+�U�"�S���^�^�3�I���(�(�+F�F�I��Y�'�'�
+�
+�����z�C�/���;�;�;���� 0� 0�0�0� $�� 0� 0�3N� N�I��E��)�$�%�,/�N�<�<�<�<��N�(�(�*�*�*��
+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+����	+�	+�	+�	+�$�_�Q��[�
1�
1�		+�U��Y�'�'�
+�
+��� � ����J��,<�!=�!=�t�y�I�I�I���� 0� 0�0�0� $�� 0� 0�3N� N�I��E��)�$�%�,/�N�<�<�<�<��N�(�(�*�*�*��
+�		+�		+�		+�		+�		+�		+�		+�		+�		+�		+�		+�		+����		+�		+�		+�		+�		+�		+s%�CC7�7C;�>C;�B4G�G�!Gc��t��5}|�|tj��|�|j��ddd��n#1swxYwY|�ttj��dS�N)rr9r&�
ZIP_STORED�assertFalse�closed�TESTFN2�rr3s  r�
testStoredzTestsWithSourceFile.testStoredFs����_�_�	'���L�L��G�.�/�/�/����Q�X�&�&�&�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'����	'�	'�	'�	'�	
���W�g�0�1�1�1�1�1��;A�A�Ac��t��5}|�|tj��|�|j��ddd��n#1swxYwY|�ttj��dSr;)rr9r&�ZIP_DEFLATEDr=r>r?r@s  r�testDeflatedz TestsWithSourceFile.testDeflatedNs����_�_�	'���L�L��G�0�1�1�1����Q�X�&�&�&�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'����	'�	'�	'�	'�	
���W�g�2�3�3�3�3�3rBc��ttfD]5}tj�|��rtj|���6dSr;)rr?�os�path�exists�remove)r�fnames  r�tearDownzTestsWithSourceFile.tearDownWsF���W�_�	!�	!�E��w�~�~�e�$�$�
!��	�%� � � ��	!�	!rN)	�__name__�
__module__�__qualname__r!r9rArrErLrrrrrsq������ � � �+�+�+�>2�2�2��]�_�_�4�4��_�4�!�!�!�!�!rrc� �eZdZd�Zd�Zd�ZdS)�
OtherTestsc���tjtdd���5}d|_d}t	|��D]$}|�d|zd|dzd	zz���%|�t|�����|��ddd��n#1swxYwYtjtd
���5}|�t|�����|��t	|��D]L}|�	d|z���
d��}|�|d|dzd	zz���M	ddd��dS#1swxYwYdS)
Nr#T��mode�
allowZip64�d���foo%08d�%d��9r%�rTr)r&r'r�debugrr,r1r(�namelistr2�decode)r�zipf�numfilesr�zipf2�contents      r�testMoreThan64kFileszOtherTests.testMoreThan64kFiles^s����_�V�#�$�
?�
?�
?�	=�4��D�J�'�H��8�_�_�
A�
A���
�
�i�!�m�T�Q��T�B�Y�-?�@�@�@�@����S������1�1�8�<�<�<�	=�	=�	=�	=�	=�	=�	=�	=�	=�	=�	=����	=�	=�	=�	=��_�V�#�
.�
.�
.�	>�%����S����!1�!1�2�2�H�=�=�=��8�_�_�
>�
>���*�*�Y��]�3�3�:�:�7�C�C��� � ��$�!�Q�$��)�*<�=�=�=�=�
>�	>�	>�	>�	>�	>�	>�	>�	>�	>�	>�	>�	>����	>�	>�	>�	>�	>�	>s%�A3B�B �#B �BE"�"E&�)E&c��tjtdd���5}d|_d}t	|��D]$}|�d|zd|dzd	zz���%|�t|�����|��|�	tj
��5|�d|zd
��ddd��n#1swxYwY|�t|�����|��ddd��n#1swxYwYtjtdd���5}d|_|�t|�����|��|�	tj
��5|�d|zd
��ddd��n#1swxYwY|�t|�����|��ddd��n#1swxYwYtjtdd���5}d|_|�t|�����|��d
}t	||��D]$}|�d|zd|dzd	zz���%|�t|�����|��ddd��n#1swxYwYtjtd���5}|�t|�����|��t	|��D]L}|�d|z���d��}|�|d|dzd	zz���M	ddd��dS#1swxYwYdS)Nr#FrSrVi��rXrYrZr[r�aTrWr%r\r)
r&r'rr]rr,r1r(r^�assertRaises�LargeZipFiler2r_)rr`rar�	numfiles2rbrcs       r�testMoreThan64kFilesAppendz%OtherTests.testMoreThan64kFilesAppendns���
�_�V�#�%�
@�
@�
@�	=�D��D�J�$�H��8�_�_�
A�
A���
�
�i�!�m�T�Q��T�B�Y�-?�@�@�@�@����S������1�1�8�<�<�<��"�"�7�#7�8�8�
9�
9��
�
�i�(�2�C�8�8�8�
9�
9�
9�
9�
9�
9�
9�
9�
9�
9�
9����
9�
9�
9�
9����S������1�1�8�<�<�<�	=�	=�	=�	=�	=�	=�	=�	=�	=�	=�	=����	=�	=�	=�	=��_�V�#�%�
@�
@�
@�	=�D��D�J����S������1�1�8�<�<�<��"�"�7�#7�8�8�
9�
9��
�
�i�(�2�C�8�8�8�
9�
9�
9�
9�
9�
9�
9�
9�
9�
9�
9����
9�
9�
9�
9����S������1�1�8�<�<�<�	=�	=�	=�	=�	=�	=�	=�	=�	=�	=�	=����	=�	=�	=�	=��_�V�#�$�
?�
?�
?�	>�4��D�J����S������1�1�8�<�<�<�(�I��8�Y�/�/�
A�
A���
�
�i�!�m�T�Q��T�B�Y�-?�@�@�@�@����S������1�1�9�=�=�=�
	>�	>�	>�	>�	>�	>�	>�	>�	>�	>�	>����	>�	>�	>�	>��_�V�#�
.�
.�
.�	>�%����S����!1�!1�2�2�I�>�>�>��9�%�%�
>�
>���*�*�Y��]�3�3�:�:�7�C�C��� � ��$�!�Q�$��)�*<�=�=�=�=�
>�	>�	>�	>�	>�	>�	>�	>�	>�	>�	>�	>�	>����	>�	>�	>�	>�	>�	>s��BD!�/C�	D!�C	�D!�C	�8D!�!D%�(D%�AH�$G
�>H�
G	�H�G	�8H�H�H�=B)K2�2K6�9K6�BN8�8N<�?N<c�j�tjt��tjt��dSr;)r�unlinkrr?)rs rrLzOtherTests.tearDown�s*����� � � ����!�!�!�!�!rN)rMrNrOrdrjrLrrrrQrQ]sB������>�>�>� >�>�>�@"�"�"�"�"rrQ�__main__)�testr�requiresr&rG�unittestr)r.�tempfiler�test.supportrrrr?r+�TestCaserrQrM�mainrrr�<module>rusA��������
����H����
����������������
�
�
�
�"�"�"�"�"�"�"�"�"�"�"�"�&�&�&�&�&�&�	�	��
�3�,��!��=!�=!�=!�=!�=!�(�+�=!�=!�=!�@3"�3"�3"�3"�3"��"�3"�3"�3"�j�z����H�M�O�O�O�O�O��r