Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.11/test/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.11/test/__pycache__/test_gzip.cpython-311.opt-1.pyc

�

SԚg�����dZddlZddlZddlZddlZddlZddlZddlZddlm	Z	m
Z
ddlmZddlm
Z
ddlmZmZmZddlmZmZejd��Zd	Zd
Zej�e
j��dzZGd�d
ej��ZGd�dej��ZGd�de��Z Gd�de��Z!d�Z"Gd�dej��Z#e$dkrej%��dSdS)z!Test script for the gzip module.
�N)�PIPE�Popen)�
import_helper)�	os_helper)�_4G�
bigmemtest�requires_subprocess)�assert_python_ok�assert_python_failure�gzipsy  int length=DEFAULTALLOC, err = Z_OK;
  PyObject *RetVal;
  int flushmode = Z_FINISH;
  unsigned long start_total_out;

s�/* zlibmodule.c -- gzip-compatible data compression */
/* See http://www.gzip.org/zlib/
/* See http://www.winimage.com/zLibDll for Windows */
z-gzdirc� �eZdZd�Zd�Zd�ZdS)�UnseekableIOc��dS)NF���selfs �+/usr/local/lib/python3.11/test/test_gzip.py�seekablezUnseekableIO.seekable$s���u�c��tj��N��io�UnsupportedOperationrs r�tellzUnseekableIO.tell'����%�%rc��tj�rr)r�argss  r�seekzUnseekableIO.seek*rrN)�__name__�
__module__�__qualname__rrrrrrrr#sA���������&�&�&�&�&�&�&�&rrc�(�eZdZejZd�Zd�ZdS)�BaseTestc�8�tj|j��dSr�r�unlink�filenamers r�setUpzBaseTest.setUp1�������'�'�'�'�'rc�8�tj|j��dSrr&rs r�tearDownzBaseTest.tearDown4r*rN)r r!r"r�TESTFNr(r)r,rrrr$r$.s:��������H�(�(�(�(�(�(�(�(rr$c�h�eZdZd8d�Zd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zee
d���d
���Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d �Z!d!�Z"d"�Z#d#�Z$d$�Z%d%�Z&d&�Z'd'�Z(d(�Z)d)�Z*d*�Z+d+�Z,d,�Z-d-�Z.d.�Z/d/�Z0d0�Z1d1�Z2d2�Z3d3�Z4d4�Z5d5�Z6d6�Z7d7S)9�TestGzip�bc���t|��}t�|jd|z��5}|�|��}ddd��n#1swxYwY|�|t
|����t�|jd|z��5}|�|���|��ddd��dS#1swxYwYdS)N�w�r)�bytesr�GzipFiler(�write�assertEqual�len�read)r�data�mode�b_data�f�ls      r�write_and_read_backzTestGzip.write_and_read_back9s=���t����
�]�]�4�=�#�d�(�
3�
3�	�q�����
�
�A�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�����C��K�K�(�(�(�
�]�]�4�=�#�d�(�
3�
3�	/�q����Q�V�V�X�X�v�.�.�.�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/����	/�	/�	/�	/�	/�	/s#�A�A�A�&)C�C �#C c���t�|jd��5}|�tdz��|���|���ttd��r&tj	|�����|�
��ddd��n#1swxYwY|�
��dS)N�wb�2�fsync)rr5r(r6�data1�flush�fileno�hasattr�osrC�close�rr=s  r�
test_writezTestGzip.test_writeAs���
�]�]�4�=�$�
/�
/�	�1�
�G�G�E�B�J����
�G�G�I�I�I�
�H�H�J�J�J��r�7�#�#�
%��������$�$�$�
�G�G�I�I�I�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	
���	�	�	�	�	s�BC�C�	Cc�:�tj|j��}t�|d��5}|�tdz��ddd��n#1swxYwY|�|jt��|�
|j|j��t�|d��5}|�t��ddd��n#1swxYwYt�|��5}|���}ddd��n#1swxYwY|�
|tdz��|�|jt��|�
|j|j��dS)Nr2rB�a�3)r�FakePathr(rr5r6rD�assertIsInstance�name�strr7r9)rr(r=�ds    r�"test_write_read_with_pathlike_filez+TestGzip.test_write_read_with_pathlike_fileOs����%�d�m�4�4��
�]�]�8�S�
)�
)�	 �Q�
�G�G�E�B�J����	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 ����	 �	 �	 �	 ����a�f�c�*�*�*��������/�/�/�
�]�]�8�S�
)�
)�	�Q�
�G�G�E�N�N�N�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�]�]�8�
$�
$�	�������A�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�����E�B�J�'�'�'����a�f�c�*�*�*��������/�/�/�/�/s5�A�A#�&A#�C,�,C0�3C0�D2�2D6�9D6c��|�ttdz����ttt	d������}|�dgd����}|�|��dS)NrB��B)�rX�)�shape)r?�
memoryviewrDr4�range�cast)r�mr:s   r�test_write_memoryviewzTestGzip.test_write_memoryview`sp��� � ��E�B�J�!7�!7�8�8�8��u�U�3�Z�Z�(�(�)�)���v�v�c����v�)�)��� � ��&�&�&�&�&rc�Z�|�ttdz����dS)NrB)r?�	bytearrayrDrs r�test_write_bytearrayzTestGzip.test_write_bytearrayfs(��� � ��5�2�:�!6�!6�7�7�7�7�7rc�f�|�tjdtdz����dS)N�I�()r?�arrayrDrs r�test_write_arrayzTestGzip.test_write_arrayis,��� � ���S�%�"�*�!=�!=�>�>�>�>�>rc��t�|jd��5}|�t��5|�d��ddd��n#1swxYwY|�t��5|�g��ddd��n#1swxYwY|�t��ddd��n#1swxYwYt�|jd��5}|�|���t��ddd��dS#1swxYwYdS)NrA��rb)	rr5r(�assertRaises�	TypeErrorr6rDr7r9rJs  r�test_write_incompatible_typez%TestGzip.test_write_incompatible_typels���]�]�4�=�$�
/�
/�	�1��"�"�9�-�-�
�
��������
�
�
�
�
�
�
�
�
�
�
����
�
�
�
��"�"�9�-�-�
�
��������
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�
�G�G�E�N�N�N�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��]�]�4�=�$�
/�
/�	.�1����Q�V�V�X�X�u�-�-�-�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.�	.�	.sj�C�A�C�A"	�"C�%A"	�&C�B%�C�%B)	�)C�,B)	�-C�C�C�.D<�<E�Ec��|���t�|jd��5}|���}ddd��n#1swxYwY|�|tdz��dS)Nr3rB)rKrr5r(r9r7rD�rr=rSs   r�	test_readzTestGzip.test_readys���������
�]�]�4�=�#�
.�
.�	�!������A�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�����E�"�H�%�%�%�%�%s�A�A�Ac���|���g}d}t�|jd��5}	|���}|snP|�|��|t
|��z
}|�|���|���g	ddd��n#1swxYwY|�d�	|��tdz��dS)Nrr3TrrB)rKrr5r(�read1�appendr8r7r�joinrD)r�blocks�nreadr=rSs     r�
test_read1zTestGzip.test_read1�s������������
�]�]�4�=�#�
.�
.�	2�!�
2��G�G�I�I������
�
�a� � � ���Q������ � ������5�1�1�1�
2��		2�	2�	2�	2�	2�	2�	2�	2�	2�	2�	2����	2�	2�	2�	2�	
������&�)�)�5�2�:�6�6�6�6�6s�A)B/�/B3�6B3�)�size�memusec��t�td���}t�t	j|��d���}|�|�|��t��dS)Nrx��
compresslevelrj��fileobjr;)r�compressrDr5r�BytesIOr7r9)rry�
compressedr=s    r�test_read_largezTestGzip.test_read_large�s^���]�]�5��]�:�:�
��M�M�"�*�Z�"8�"8�t�M�D�D�����������u�-�-�-�-�-rc��|���t�|jd��}|j}|�|j��|���|�|j��|�	t��5|�d��ddd��n#1swxYwY|�	t��5|�d��ddd��n#1swxYwY|�	t��5|�
��ddd��n#1swxYwYt�|jd��}|j}|�|j��|���|�|j��|�	t��5|�d��ddd��n#1swxYwY|�	t��5|���ddd��dS#1swxYwYdS)Nr3rxrr2r)rKrr5r(r�assertFalse�closedrI�
assertTruerk�
ValueErrorr9rrr6rE)rr=rs   r�test_io_on_closed_objectz!TestGzip.test_io_on_closed_object�s��
	
�������M�M�$�-��-�-���)�������(�(�(�	���	�	�	������'�'�'�
�
�
�z�
*�
*�	�	�
�F�F�1�I�I�I�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�
�
�z�
*�
*�	�	�
�F�F�1�I�I�I�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�
�
�z�
*�
*�	�	�
�F�F�H�H�H�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�M�M�$�-��-�-���)�������(�(�(�	���	�	�	������'�'�'�
�
�
�z�
*�
*�	�	�
�G�G�C�L�L�L�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�
�
�z�
*�
*�	�	�
�G�G�I�I�I�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	sZ�C�C�C�%D�D�D�,E
�
E�E�!H�H�
H�(I
�
I�Ic���|���t�|jd��5}|�t
dz��ddd��n#1swxYwYt�|jd��5}|���}ddd��n#1swxYwY|�|tdzt
dzz��dS)N�ab�rjrB)	rKrr5r(r6�data2r9r7rDros   r�test_appendzTestGzip.test_append�s0��������
�]�]�4�=�$�
/�
/�	 �1�
�G�G�E�B�J����	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 ����	 �	 �	 �	 ��]�]�4�=�$�
/�
/�	�1������A�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�����U�2�X�%��(�3�4�4�4�4�4s#�A�A#�&A#�
B+�+B/�2B/c�D�t�|jdd��5}|�d��ddd��n#1swxYwYt	dd��D]P}t�|jdd��5}|�d��ddd��n#1swxYwY�Qt�|jd��5}d}	|�d
��}||z
}|sn�	ddd��n#1swxYwY|�|d��dS)NrA�	�ar��r�rjrrxi s�aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)rr5r(r6r\r9r7)rr=�i�zgfile�contents�ztxts      r�test_many_appendzTestGzip.test_many_append�s����]�]�4�=�$��
2�
2�	�a�
�G�G�D�M�M�M�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��q�#���	�	�A����t�}�d�A�6�6�
�!�����
�
�
�
�
�
�
�
�
�
�
�
�
�
����
�
�
�
���]�]�4�=�$�
/�
/�	#�6��H�
#��{�{�4�(�(���D� ���"�U�
#�#�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#����	#�	#�	#�	#�	
����8�,�,�,�,�,s5�A�A�A�B$�$B(	�+B(	�"C?�?D�Dc�&�t�|jd��5}|�tdz��ddd��n#1swxYwYt�|jd��5}|�|���tdz��ddd��n#1swxYwY|�t��5t�|jd��ddd��dS#1swxYwYdS)N�xbrBrj)	rr5r(r6rDr7r9rk�FileExistsErrorrJs  r�test_exclusive_writezTestGzip.test_exclusive_write�s���
�]�]�4�=�$�
/�
/�	 �1�
�G�G�E�B�J����	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 ����	 �	 �	 �	 �
�]�]�4�=�$�
/�
/�	3�1����Q�V�V�X�X�u�r�z�2�2�2�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3����	3�	3�	3�	3�
�
�
��
/�
/�	/�	/��M�M�$�-��.�.�.�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/����	/�	/�	/�	/�	/�	/s5�A�A�A�61B3�3B7�:B7�!D�D
�
D
c�r�|���t�|jd��5}t	j|��5}d�|D��}ddd��n#1swxYwYddd��n#1swxYwY|�|dt�d���z��dS)Nrjc��g|]}|��Srr)�.0�lines  r�
<listcomp>z1TestGzip.test_buffered_reader.<locals>.<listcomp>�s��,�,�,�$��,�,�,rrBT��keepends)	rKrr5r(r�BufferedReaderr7rD�
splitlines)rr=r3�liness    r�test_buffered_readerzTestGzip.test_buffered_reader�s&��	
������
�]�]�4�=�$�
/�
/�	-�1��"�1�%�%�
-��,�,�!�,�,�,��
-�
-�
-�
-�
-�
-�
-�
-�
-�
-�
-����
-�
-�
-�
-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-����	-�	-�	-�	-�	
�����U�%5�%5�t�%5�%D�%D� D�E�E�E�E�Es5�A:�

A#�A:�#A'	�'A:�*A'	�+A:�:A>�A>c�B�|���t�|jd��5}d}	|�|��}|s|dkrn/|�t
|��|k��|dzdz}�M	ddd��dS#1swxYwYdS)NrjrrxrB)rKrr5r(�readliner�r8)rr=�line_length�Ls    r�
test_readlinezTestGzip.test_readline�s����������]�]�4�=�$�
/�
/�	5�1��K�
5��J�J�{�+�+���4�[�A�-�-�u�����A���+� 5�6�6�6�*�Q��"�4��	
5�/4�		5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5����	5�	5�	5�	5�	5�	5s�AB�B�Bc�v�|���t�|jd��5}|���}ddd��n#1swxYwYt�|jd��5}	|�d��}|gkrn�	ddd��dS#1swxYwYdS)Nrjrx�)rKrr5r(�	readlines)rr=r�s   r�test_readlineszTestGzip.test_readlines�s+���������]�]�4�=�$�
/�
/�	�1����
�
�A�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��]�]�4�=�$�
/�
/�	"�1�
"��K�K��$�$����7�7�E�
"�!�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"����	"�	"�	"�	"�	"�	"s#�A�A�A�B.�.B2�5B2c�&�|���t�|j��5}	|���}|���}|sn�|���}|�|��t|��dkrd}nt|��}|�|��}|�	|d|�|��|�|����	ddd��dS#1swxYwYdS)Nrx�
)
rKrr5r(rr�rr8r9r7)rr=�oldpos�line1�newpos�amount�line2s       r�test_seek_readzTestGzip.test_seek_read�s3���������]�]�4�=�
)�
)�
	�Q�
��������
�
�����#�e����������v�����u�:�:�b�=�=��F�F� ��Z�Z�F����v����� � ��w��w���7�7�7����v����
�$�	
	�
	�
	�
	�
	�
	�
	�
	�
	�
	�
	�
	����
	�
	�
	�
	�
	�
	s�CD�D
�
D
c�d�|���t�|j��5}|�d��|�dd���|�d��}ddd��n#1swxYwY|�|tdd���dS)Nr�rx)�whence��)rKrr5r(r9rr7rD)rr=�ys   r�test_seek_whencezTestGzip.test_seek_whences����������]�]�4�=�
)�
)�	�Q�
�F�F�2�J�J�J�
�F�F�2�a�F� � � ����r�
�
�A�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	
����E�"�R�%�L�)�)�)�)�)s�AB�B�	Bc��t�|jd��5}tddd��D],}|�|��|�d���-	ddd��dS#1swxYwYdS)Nr2rrV�sGZ
)rr5r(r\rr6)rr=�poss   r�test_seek_writezTestGzip.test_seek_writes���
�]�]�4�=�#�
.�
.�	!�!��Q��R�(�(�
!�
!�����s�������� � � � �
!�	!�	!�	!�	!�	!�	!�	!�	!�	!�	!�	!�	!����	!�	!�	!�	!�	!�	!s�?A.�.A2�5A2c���|���t�|jd��5}|�|jjd��ddd��n#1swxYwYtj|j��t�|jd��5}|�|jjd��ddd��dS#1swxYwYdS)Nr3rj�xr�)	rKrr5r(r7�	myfileobjr;rr'rJs  r�	test_modezTestGzip.test_modes:��������
�]�]�4�=�#�
.�
.�	5�!����Q�[�-�t�4�4�4�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5����	5�	5�	5�	5�����'�'�'�
�]�]�4�=�#�
.�
.�	5�!����Q�[�-�t�4�4�4�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5����	5�	5�	5�	5�	5�	5s#�!A"�"A&�)A&�&!C�C�Cc��dD]}}t�|j|��5}|�t	|d����|�|j|j��ddd��n#1swxYwY�~dS)N)rArjrQ)rr5r(r�rGr7rQ)rr;r=s   r�test_1647484zTestGzip.test_1647484's��� �	8�	8�D����t�}�d�3�3�
8�q������6� 2� 2�3�3�3�� � �����7�7�7�
8�
8�
8�
8�
8�
8�
8�
8�
8�
8�
8����
8�
8�
8�
8��	8�	8s�AA5�5A9	�<A9	c�:�|���t�|jd��5}|�t|jd����|�|jj|j��ddd��dS#1swxYwYdS)NrjrQ)	rKrr5r(r�rGrr7rQrJs  r�test_paddedfile_getattrz TestGzip.test_paddedfile_getattr-s���������
�]�]�4�=�$�
/�
/�	<�1��O�O�G�A�I�v�6�6�7�7�7����Q�Y�^�T�]�;�;�;�	<�	<�	<�	<�	<�	<�	<�	<�	<�	<�	<�	<����	<�	<�	<�	<�	<�	<s�AB�B�Bc�0�d}t�|jd|���5}|�t��ddd��n#1swxYwYt�|j��5}|�t
|d����|�|j��|�	��}|�
|t��|�
|j|��ddd��dS#1swxYwYdS)N��[r2��mtimer�)rr5r(r6rDr�rG�assertIsNoner�r9r7)rr��fWrite�fRead�dataReads     r�
test_mtimezTestGzip.test_mtime3sg����
�]�]�4�=�#�u�]�
=�
=�	 ���L�L�����	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 ����	 �	 �	 �	 �
�]�]�4�=�
)�
)�	1�U��O�O�G�E�7�3�3�4�4�4����e�k�*�*�*��z�z�|�|�H����X�u�-�-�-����U�[�%�0�0�0�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1����	1�	1�	1�	1�	1�	1s$�A�A�A�6BD�D�Dc
�p�d}t�|jd|���5}|�t��ddd��n#1swxYwYt|jd��5}|�d��}|�|d��|�d��}|�|d��	|j�d	��d
z}d}n#t$rd}d
}YnwxYw|�d��}|�||��|�d��}	|�|	tjd
|����|�d��}
|�|
d��|�d��}|�|d��|�t|����}|�||��|�
tj|j��jdz
��|�d��}
|�|
d��|�d��}|�|tjd
tt������ddd��dS#1swxYwYdS)Nr�r2r�rj���rx�zLatin-1�rrYz<i���rXs��d�)rr5r(r6rD�openr9r7�encode�UnicodeEncodeError�struct�packr8rrH�stat�st_size)rr�r�r��idBytes�cmByte�expectedname�
expectedflags�	flagsByte�
mtimeBytes�xflByte�osByte�	nameBytes�
crc32Bytes�
isizeBytess               r�
test_metadatazTestGzip.test_metadata>s����
�]�]�4�=�#�u�]�
=�
=�	 ���L�L�����	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 ����	 �	 �	 �	 ��$�-��
&�
&�+	H�%��j�j��m�m�G����W�k�2�2�2��Z�Z��]�]�F����V�W�-�-�-�
(�#�}�3�3�I�>�>��H�� '�
�
��%�
(�
(�
(�"�� '�
�
�
�
(�����
�
�1�
�
�I����Y�
�6�6�6����A���J����Z���T�5�)A�)A�B�B�B��j�j��m�m�G����W�g�.�.�.��Z�Z��]�]�F����V�W�-�-�-��
�
�3�|�#4�#4�5�5�I����Y��5�5�5�
�J�J�r�w�t�}�-�-�5��9�:�:�:����A���J����Z�)9�:�:�:����A���J����Z���T�3�u�:�:�)F�)F�G�G�G�W+	H�+	H�+	H�+	H�+	H�+	H�+	H�+	H�+	H�+	H�+	H�+	H����+	H�+	H�+	H�+	H�+	H�+	HsI�A�A�A�,AJ+�C$�#J+�$C5�2J+�4C5�5F)J+�+J/�2J/c�P�tj|_|���dSr)r�TESTFN_ASCIIr(r�rs r�test_metadata_ascii_namez!TestGzip.test_metadata_ascii_nameqs$��!�.��
��������rc��gd�}d}|D]�\}}}|�|��5t�|jd|���}|5|�t
��ddd��n#1swxYwYt
|jd��5}|�|��|�d��}|�	||��ddd��n#1swxYwYddd��n#1swxYwY��dS)N))�fastrx�)�bestr�r�)�tradeoff�r�rXr2r|rjrx)
�subTestrr5r(r6rDr�rr9r7)	r�cases�	xflOffsetrQ�level�expectedXflByter�r�r�s	         r�test_compresslevel_metadataz$TestGzip.test_compresslevel_metadataus���
�
�
��
�	�.3�	?�	?�*�T�5�/����d�#�#�
?�
?����t�}�c���O�O���(�(��L�L��'�'�'�(�(�(�(�(�(�(�(�(�(�(����(�(�(�(��$�-��.�.�?�%��J�J�y�)�)�)�#�j�j��m�m�G��$�$�W�o�>�>�>�?�?�?�?�?�?�?�?�?�?�?����?�?�?�?�	
?�
?�
?�
?�
?�
?�
?�
?�
?�
?�
?����
?�
?�
?�
?��	?�	?sZ�%C4�	A0�$C4�0A4�4C4�7A4�8C4�AC�C4�C!�!C4�$C!�%C4�4C8	�;C8	c�T�t�|jd��5}|�d��ddd��n#1swxYwYt�|jd��}|���	|5	ddd��n#1swxYwY|�d��n#t$rYnwxYw	t�|jd��5}ddzddd��n#1swxYwY|�d��dS#t$rYdSwxYw)NrAsxxxrjz4__enter__ on a closed file didn't raise an exceptionrxrz1/0 didn't raise an exception)rr5r(r6rI�failr��ZeroDivisionErrorrJs  r�test_with_openzTestGzip.test_with_open�s���
�]�]�4�=�$�
/�
/�	�1�
�G�G�F�O�O�O�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��M�M�$�-��.�.��	���	�	�	�	N��
�
��
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�

�I�I�L�M�M�M�M���	�	�	��D�	����	7����t�}�d�3�3�
�q��!���
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�

�I�I�5�6�6�6�6�6��!�	�	�	��D�D�	���s}�A�A�
A�B4�B�B4�B�B4�B�B4�4
C�C� D�%C7�+D�7C;�;D�>C;�?D�
D'�&D'c��t�|jd��5}|�tdz��ddd��n#1swxYwYt|jd��5}|�d��ddd��n#1swxYwYt�|jd��5}|���}|�|tdzd��ddd��dS#1swxYwYdS)NrArBr�s2rjzIncorrect data in file)rr5r(r6rDr�r9r7ros   r�test_zero_padded_filezTestGzip.test_zero_padded_file�s���
�]�]�4�=�$�
/�
/�	 �1�
�G�G�E�B�J����	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 ����	 �	 �	 �	 ��$�-��
&�
&�	"�!�
�G�G�L�!�!�!�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"����	"�	"�	"�	"��]�]�4�=�$�
/�
/�	F�1������A����Q���
�,D�E�E�E�	F�	F�	F�	F�	F�	F�	F�	F�	F�	F�	F�	F����	F�	F�	F�	F�	F�	Fs5�A�A�A�+B
�
B�B�84C9�9C=�C=c�j�|�ttjt����dSr)r��
issubclassr�BadGzipFile�OSErrorrs r�test_gzip_BadGzipFile_exceptionz(TestGzip.test_gzip_BadGzipFile_exception�s'�����
�4�#3�W�=�=�>�>�>�>�>rc�V�t|jd��5}|�tdz��ddd��n#1swxYwYt�|jd��5}|�tj|j��ddd��dS#1swxYwYdS)NrArBr3)	r�r(r6rDrr5rkrr�)r�files  r�test_bad_gzip_filezTestGzip.test_bad_gzip_file�s!��
�$�-��
&�
&�	#�$��J�J�u�r�z�"�"�"�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#����	#�	#�	#�	#�
�]�]�4�=�#�
.�
.�	@�$����d�.���?�?�?�	@�	@�	@�	@�	@�	@�	@�	@�	@�	@�	@�	@����	@�	@�	@�	@�	@�	@s#�A�A�A�+&B�B"�%B"c���tdz}t��}t�|d���5}|�|��ddd��n#1swxYwY|���}t|��}t�|d���5}|�|���|��ddd��dS#1swxYwYdS)NrBrAr~rj)rDrrr5r6�getvaluer7r9)r�uncompressed�bufr=r�s     r�test_non_seekable_filezTestGzip.test_non_seekable_file�s=���r�z���n�n��
�]�]�3�T�]�
2�
2�	"�a�
�G�G�L�!�!�!�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"����	"�	"�	"�	"��\�\�^�^�
��:�&�&��
�]�]�3�T�]�
2�
2�	5�a����Q�V�V�X�X�|�4�4�4�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5����	5�	5�	5�	5�	5�	5s#�A�A�A�!)C�C�Cc	��tdz}t�|jd��5}|�|��ddd��n#1swxYwYd�}t�|jd��5}d|_d}|��D]g}|�|��}|dkrnI|�|�t|����|��|t|��z
}�h|�|�d��d��|�|t|����ddd��dS#1swxYwYdS)	Nr�rAc3�:K�	tddd��D]}|V���)NT�rBr�)r\)�ns r�sizesz!TestGzip.test_peek.<locals>.sizes�s6����
��q�"�b�)�)���A��G�G�G�G�
rrj�!rr�d)
rDrr5r(r6�max_read_chunk�peekr7r9r8)rrr=rrvr�ss       r�	test_peekzTestGzip.test_peek�s����s�{��
�]�]�4�=�$�
/�
/�	"�1�
�G�G�L�!�!�!�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"����	"�	"�	"�	"�	�	�	�
�]�]�4�=�$�
/�
/�
	7�1�!�A���E��U�W�W�
 �
 ���F�F�1�I�I����8�8��E�� � �����A������3�3�3���Q���������Q�V�V�C�[�[�#�.�.�.����U�C��$5�$5�6�6�6�
	7�
	7�
	7�
	7�
	7�
	7�
	7�
	7�
	7�
	7�
	7�
	7����
	7�
	7�
	7�
	7�
	7�
	7s$�A
�
A�A�;CE�E�Ec��tdz�d���d���}|���t�|jd��5}tj|d���5}|�	|�
��|��ddd��n#1swxYwYddd��dS#1swxYwYdS)NrB�asciiTr�r3��encoding)rD�decoder�rKrr5r(r�
TextIOWrapperr7r�)rr�r=�ts    r�test_textio_readlineszTestGzip.test_textio_readlines�s7�����#�#�G�,�,�7�7��7�F�F��������
�]�]�4�=�#�
.�
.�	7�!��!�!�g�6�6�6�
7�!�� � �������6�6�6�
7�
7�
7�
7�
7�
7�
7�
7�
7�
7�
7����
7�
7�
7�
7�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7����	7�	7�	7�	7�	7�	7s6�&C
�=)B2�&C
�2B6	�6C
�9B6	�:C
�
C�Cc�.�t|jd��5}t�|d���5}|�d��|�|j|j��|�|���|�����|�|jtj	��|�
|���d��|�
|���d��|�
|�
��d��|�
|jd��ddd��n#1swxYwY|�
|jd��|�|j|j��|�t |j��|�|jtj	��|�
|���d��|�
|���d��|�
|�
��d��ddd��n#1swxYwYt|jd��5}t�|d���5}|�d	��|�|j|j��|�|���|�����|�|jtj	��|�
|���d��|�
|���d��|�
|�
��d��|�
|jd��ddd��n#1swxYwY|�
|jd��|�|j|j��|�t |j��|�|jtj	��|�
|���d��|�
|���d��|�
|�
��d��ddd��n#1swxYwYt|jd
��5}t�|d���5}|�d��|�|j|j��|�|���|�����|�|jtj	��|�
|���d��|�
|���d��|�
|�
��d��|�
|jd��ddd��n#1swxYwY|�
|jd��|�|j|j��|�t |j��|�|jtj	��|�
|���d��|�
|���d��|�
|�
��d��ddd��n#1swxYwYt|jd
��5}t�|d���5}|�|���d��|�|j|j��|�|���|�����|�|jtj��|�
|���d��|�
|���d��|�
|�
��d��|�
|jd��ddd��n#1swxYwY|�
|jd��|�|j|j��|�t |j��|�|jtj��|�
|���d��|�
|���d��|�
|�
��d��ddd��dS#1swxYwYdS)Nr�r�r~�oneFTrAr2�twor�rM�threerjr3�twothree)r�r(rr5r6r7rQrFr;�WRITE�assertIs�readable�writablerr�rk�AttributeErrorr9�READ)r�rawr=s   r�test_fileobj_with_namezTestGzip.test_fileobj_with_name�s�	��
�$�-��
&�
&�	.�#����s���5�5�
/���������� � �����2�2�2�� � ������S�Z�Z�\�\�:�:�:�� � �����4�4�4��
�
�a�j�j�l�l�E�2�2�2��
�
�a�j�j�l�l�D�1�1�1��
�
�a�j�j�l�l�D�1�1�1��
�
�a�h��.�.�.�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/����
/�
/�
/�
/�
�M�M�!�(�D�)�)�)����Q�V�S�X�.�.�.����n�a�h�7�7�7����Q�V�T�Z�0�0�0��M�M�!�*�*�,�,��.�.�.��M�M�!�*�*�,�,��-�-�-��M�M�!�*�*�,�,��-�-�-�!	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.�$�$�-��
&�
&�	.�#����s���5�5�
/���������� � �����2�2�2�� � ������S�Z�Z�\�\�:�:�:�� � �����4�4�4��
�
�a�j�j�l�l�E�2�2�2��
�
�a�j�j�l�l�D�1�1�1��
�
�a�j�j�l�l�D�1�1�1��
�
�a�h��.�.�.�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/����
/�
/�
/�
/�
�M�M�!�(�D�)�)�)����Q�V�S�X�.�.�.����n�a�h�7�7�7����Q�V�T�Z�0�0�0��M�M�!�*�*�,�,��.�.�.��M�M�!�*�*�,�,��-�-�-��M�M�!�*�*�,�,��-�-�-�!	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.�$�$�-��
&�
&�	.�#����s���5�5�
/������!�!�!�� � �����2�2�2�� � ������S�Z�Z�\�\�:�:�:�� � �����4�4�4��
�
�a�j�j�l�l�E�2�2�2��
�
�a�j�j�l�l�D�1�1�1��
�
�a�j�j�l�l�D�1�1�1��
�
�a�h��.�.�.�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/����
/�
/�
/�
/�
�M�M�!�(�D�)�)�)����Q�V�S�X�.�.�.����n�a�h�7�7�7����Q�V�T�Z�0�0�0��M�M�!�*�*�,�,��.�.�.��M�M�!�*�*�,�,��-�-�-��M�M�!�*�*�,�,��-�-�-�!	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.�$�$�-��
&�
&�	.�#����s���5�5�
/��� � ������;�7�7�7�� � �����2�2�2�� � ������S�Z�Z�\�\�:�:�:�� � �����3�3�3��
�
�a�j�j�l�l�D�1�1�1��
�
�a�j�j�l�l�E�2�2�2��
�
�a�j�j�l�l�D�1�1�1��
�
�a�h��.�.�.�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/����
/�
/�
/�
/�
�M�M�!�(�D�)�)�)����Q�V�S�X�.�.�.����n�a�h�7�7�7����Q�V�T�Y�/�/�/��M�M�!�*�*�,�,��-�-�-��M�M�!�*�*�,�,��.�.�.��M�M�!�*�*�,�,��-�-�-�!	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.�	.�	.s��I6�D(E'�I6�'E+	�+I6�.E+	�/C;I6�6I:�=I:�S6�3D(O'�S6�'O+	�+S6�.O+	�/C;S6�6S:�=S:�]6�3D(Y'�]6�'Y+	�+]6�.Y+	�/C;]6�6]:�=]:�h
�3D;c:�.h
�:c>	�>h
�c>	�C;h
�
h�hc�P
�tj|jtjtjztjz��}tj|d��5}t�|d���5}|�	d��|�
|jd��|�
|���|�����ddd��n#1swxYwY|�
|jd��|�
|jd��|�t |j��ddd��n#1swxYwYtj|jtjtjztjz��}tj|d��5}t�|d���5}|�	d	��|�
|jd��|�
|���|�����ddd��n#1swxYwY|�
|jd��|�t |j��ddd��n#1swxYwYtj|jtjtjztjz��}tj|d
��5}t�|d���5}|�	d��|�
|jd��|�
|���|�����ddd��n#1swxYwY|�
|jd��|�t |j��ddd��n#1swxYwYtj|jtj��}tj|d
��5}t�|d���5}|�
|���d��|�
|jd��|�
|���|�����ddd��n#1swxYwY|�
|jd��|�t |j��ddd��dS#1swxYwYdS)Nr�r�r~r#riTrAr2r$r�rMr%rjr3r&)rHr�r(�O_WRONLY�O_CREAT�O_EXCL�fdopenrr5r6r7rQrFr(r�rkr+�O_TRUNC�O_APPEND�O_RDONLYr9)r�fdr-r=s    r�test_fileobj_from_fdopenz!TestGzip.test_fileobj_from_fdopen$s����W�T�]�B�K�"�*�$<�r�y�$H�
I�
I��
�Y�r�4�
 �
 �	8�C����s���5�5�
;���������� � ����,�,�,�� � ������S�Z�Z�\�\�:�:�:�
;�
;�
;�
;�
;�
;�
;�
;�
;�
;�
;����
;�
;�
;�
;�
�M�M�!�(�D�)�)�)����Q�V�R�(�(�(����n�a�h�7�7�7�	8�	8�	8�	8�	8�	8�	8�	8�	8�	8�	8����	8�	8�	8�	8��W�T�]�B�K�"�*�$<�r�z�$I�
J�
J��
�Y�r�4�
 �
 �	8�C����s���5�5�
;���������� � ����,�,�,�� � ������S�Z�Z�\�\�:�:�:�
;�
;�
;�
;�
;�
;�
;�
;�
;�
;�
;����
;�
;�
;�
;�
���Q�V�R�(�(�(����n�a�h�7�7�7�
	8�	8�	8�	8�	8�	8�	8�	8�	8�	8�	8����	8�	8�	8�	8��W�T�]�B�K�"�*�$<�r�{�$J�
K�
K��
�Y�r�4�
 �
 �	8�C����s���5�5�
;������!�!�!�� � ����,�,�,�� � ������S�Z�Z�\�\�:�:�:�
;�
;�
;�
;�
;�
;�
;�
;�
;�
;�
;����
;�
;�
;�
;�
���Q�V�R�(�(�(����n�a�h�7�7�7�
	8�	8�	8�	8�	8�	8�	8�	8�	8�	8�	8����	8�	8�	8�	8��W�T�]�B�K�
0�
0��
�Y�r�4�
 �
 �	8�C����s���5�5�
;��� � ������;�7�7�7�� � ����,�,�,�� � ������S�Z�Z�\�\�:�:�:�
;�
;�
;�
;�
;�
;�
;�
;�
;�
;�
;����
;�
;�
;�
;�
���Q�V�R�(�(�(����n�a�h�7�7�7�
	8�	8�	8�	8�	8�	8�	8�	8�	8�	8�	8�	8����	8�	8�	8�	8�	8�	8s��E�1A+C(�E�(C,	�,E�/C,	�0AE�E�E�3J�A+I�;J�I	�J�I	�>J�J� J�7O�A+N�?O�N	�O�N	�>O�O!�$O!�!T�>A>S�<T�S	�T�S	�>T�T�"Tc���t�|jd�����t	|jd��5}t�|d���5}|�|jtj��ddd��n#1swxYwYt�|d���5}|�|jtj��ddd��n#1swxYwYt�|d���5}|�|jtj��ddd��n#1swxYwYt�|d���5}|�|jtj��ddd��n#1swxYwY|�	t��5t�|d���ddd��n#1swxYwYddd��n#1swxYwYd	D]�}t	|j|��5}t�|�
��5}|�|jtj��ddd��n#1swxYwYddd��n#1swxYwY��dD]�}d|vrtj|j��t	|j|��5}|�
t��5t�|�
��}ddd��n#1swxYwY|5|�|jtj��ddd��n#1swxYwYddd��n#1swxYwY��dS)NrA�r+br3r~r2rMr��z)rjr:�r)rAr�r�)rr5r(rIr�r7r;r,r'rkr�rr'�assertWarns�
FutureWarning)rr=�gr;s    r�test_fileobj_modezTestGzip.test_fileobj_modeLs����
�
�d�m�T�*�*�0�0�2�2�2�
�$�-��
'�
'�
	3�1����q�s��3�3�
4�q�� � �����3�3�3�
4�
4�
4�
4�
4�
4�
4�
4�
4�
4�
4����
4�
4�
4�
4����q�s��3�3�
5�q�� � �����4�4�4�
5�
5�
5�
5�
5�
5�
5�
5�
5�
5�
5����
5�
5�
5�
5����q�s��3�3�
5�q�� � �����4�4�4�
5�
5�
5�
5�
5�
5�
5�
5�
5�
5�
5����
5�
5�
5�
5����q�s��3�3�
5�q�� � �����4�4�4�
5�
5�
5�
5�
5�
5�
5�
5�
5�
5�
5����
5�
5�
5�
5��"�"�:�.�.�
3�
3��
�
�a�c�
�2�2�2�
3�
3�
3�
3�
3�
3�
3�
3�
3�
3�
3����
3�
3�
3�
3�
	3�
	3�
	3�
	3�
	3�
	3�
	3�
	3�
	3�
	3�
	3����
	3�
	3�
	3�
	3� �	8�	8�D��d�m�T�*�*�
8�a��]�]�1�]�-�-�8���$�$�Q�V�T�Y�7�7�7�8�8�8�8�8�8�8�8�8�8�8����8�8�8�8�
8�
8�
8�
8�
8�
8�
8�
8�
8�
8�
8����
8�
8�
8�
8��%�	9�	9�D��d�{�{�� ���/�/�/��d�m�T�*�*�
9�a��%�%�m�4�4�1�1��
�
�a�
�0�0�A�1�1�1�1�1�1�1�1�1�1�1����1�1�1�1��9�9��$�$�Q�V�T�Z�8�8�8�9�9�9�9�9�9�9�9�9�9�9����9�9�9�9�
9�
9�
9�
9�
9�
9�
9�
9�
9�
9�
9����
9�
9�
9�
9��	9�	9sV�H�%&B�H�B	�H�B	�H�>&C0�$H�0C4	�4H�7C4	�8H�&E	�=H�	E
	�
H�E
	�H�0&F"�H�"F&	�&H�)F&	�*H�G0�$H�0G4	�4H�7G4	�8H�H�H�+J�&I9�-J�9I=�=J�I=�J�J	�J	�M+�-L�	M+�L�M+�L�M+�"&M�M+�M�M+�M�M+�+M/	�2M/	c�
�|j}tj|��}t�|d��5}|�tdz��ddd��n#1swxYwY|�|j|��t�|d��5}|�|�	��tdz��ddd��n#1swxYwY|�|j|��t�|d��5}|�|�	��tdz��ddd��n#1swxYwY|�|j|��dS)NrArBrj)
r(rH�fsencoderr5r6rDr7rQr9)r�str_filename�bytes_filenamer=s    r�test_bytes_filenamezTestGzip.test_bytes_filenamefs����}����\�2�2��
�]�]�>�4�
0�
0�	 �A�
�G�G�E�B�J����	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 ����	 �	 �	 �	 �������0�0�0�
�]�]�>�4�
0�
0�	3�A����Q�V�V�X�X�u�r�z�2�2�2�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3����	3�	3�	3�	3�������0�0�0�
�]�]�<��
.�
.�	3�!����Q�V�V�X�X�u�r�z�2�2�2�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3����	3�	3�	3�	3�������.�.�.�.�.s5�A!�!A%�(A%�"1C�C#�&C#� 1E�E!�$E!c�l	�tj��}t�|d���5}|�t
dz��|�|jd��|�tj	|j
��|�|jtj��|�
|���d��|�
|���d��|�
|���d��|�
|jd��ddd��n#1swxYwY|�
|jd��|�|jd��|�t$|j
��|�|jtj��|�
|���d��|�
|���d��|�
|���d��|�d��t�|d���5}|�|���t
dz��|�|jd��|�tj	|j
��|�|jtj��|�
|���d��|�
|���d��|�
|���d��|�
|jd��ddd��n#1swxYwY|�
|jd��|�|jd��|�t$|j
��|�|jtj��|�
|���d��|�
|���d��|�
|���d��dS)	NrAr~rBriFTrrj)rr�rr5r6rDr7rQrkrrFr;r'r(r)r*rr�r+rr9r,)r�bior=s   r�test_fileobj_without_namez"TestGzip.test_fileobj_without_namets���j�l�l��
�]�]�3�T�]�
2�
2�	+�a�
�G�G�E�B�J�������Q�V�R�(�(�(����b�5�q�x�@�@�@����Q�V�T�Z�0�0�0��M�M�!�*�*�,�,��.�.�.��M�M�!�*�*�,�,��-�-�-��M�M�!�*�*�,�,��-�-�-��M�M�!�(�E�*�*�*�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+����	+�	+�	+�	+�	
�
�
�a�h��%�%�%�������$�$�$����.�!�(�3�3�3��������,�,�,��
�
�a�j�j�l�l�E�*�*�*��
�
�a�j�j�l�l�D�)�)�)��
�
�a�j�j�l�l�D�)�)�)��������
�]�]�3�T�]�
2�
2�	+�a����Q�V�V�X�X�u�r�z�2�2�2����Q�V�R�(�(�(����b�5�q�x�@�@�@����Q�V�T�Y�/�/�/��M�M�!�*�*�,�,��-�-�-��M�M�!�*�*�,�,��.�.�.��M�M�!�*�*�,�,��-�-�-��M�M�!�(�E�*�*�*�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+����	+�	+�	+�	+�	
�
�
�a�h��%�%�%�������$�$�$����.�!�(�3�3�3��������+�+�+��
�
�a�j�j�l�l�D�)�)�)��
�
�a�j�j�l�l�E�*�*�*��
�
�a�j�j�l�l�D�)�)�)�)�)s%�DE�E�E�D)N6�6N:�=N:c��|jdz}t|jd��5}t�||d���5}|�t
dz��|�|j|��ddd��n#1swxYwYddd��n#1swxYwYt|jd��5}t�||d���5}|�|���t
dz��|�|j|��ddd��n#1swxYwYddd��n#1swxYwYt�|jd��5}|�|���t
dz��|�|j|j��ddd��dS#1swxYwYdS)N�newrA)rr(r;rBrj)	r(r�rr5r6rDr7rQr9)r�	filename2rr=s    r�test_fileobj_and_filenamez"TestGzip.test_fileobj_and_filename�s����M�E�)�	��4�=�$�'�'�	0�7��m�m�G�i�d�m�K�K�	0�OP�
�G�G�E�B�J�������Q�V�Y�/�/�/�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0����	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0����	0�	0�	0�	0��4�=�$�'�'�	0�7��m�m�G�i�d�m�K�K�	0�OP����Q�V�V�X�X�u�r�z�2�2�2����Q�V�Y�/�/�/�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0����	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0����	0�	0�	0�	0�
�]�]�4�=�$�
/�
/�	4�1����Q�V�V�X�X�u�r�z�2�2�2����Q�V�T�]�3�3�3�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4����	4�	4�	4�	4�	4�	4s~�B�9B�7B�B	�B�
B	�B�B�!B�:E�AD0�$E�0D4	�4E�7D4	�8E�E�E�2AG�G�Gc���t�dtd��zd���}|�t	|��t
j��tj|��}t�|���}|�	|�
d��d��dt
jz}|�|jj
���|d��dS)	z-Decompressed data buffering should be limitedr�g��>Ar�r|r<rxz)Excessive amount of data was decompressedN)rr��int�
assertLessr8r�DEFAULT_BUFFER_SIZEr�r5r7r9�assertLessEqual�_bufferr-r)r�bomb�decomp�
max_decomps    r�test_decompress_limitedz TestGzip.test_decompress_limited�s����}�}�U�S��X�X�-�Q�}�?�?������D�	�	�2�#9�:�:�:��z�$�������t��,�,��������Q����/�/�/���/�/�
����V�^�/�4�4�6�6�
�7�	9�	9�	9�	9�	9rc��ttfD]�}dD]�}tj|g|�R�}|�t|��t��t�tj	|��d���5}|�|�
��|��ddd��n#1swxYwY����dS)N�r)rx)r�)r�rjr~)rDr�rr�r7�typer4r5rr�r9)rr:r�datacr=s     r�
test_compresszTestGzip.test_compress�s����E�N�	5�	5�D�.�
5�
5���
�d�2�T�2�2�2��� � ��e���e�4�4�4��]�]�2�:�e�+<�+<�4�]�H�H�5�A��$�$�Q�V�V�X�X�t�4�4�4�5�5�5�5�5�5�5�5�5�5�5����5�5�5�5��
5�	5�	5s�=)B2�2B6�9B6c	��d}ttfD]�}dD]�}|�||���5tj|g|�Rd|i�}|�t
|��t��t�tj
|��d���5}|�d��|�|j|��ddd��n#1swxYwYddd��n#1swxYwY���dS)Nr�rX)r:rr�rjr~rx)
rDr�r�rr�r7rYr4r5rr�r9r�)rr�r:rrZr=s      r�test_compress_mtimezTestGzip.test_compress_mtime�sy�����E�N�	9�	9�D�.�
9�
9���\�\�t�$�\�7�7�9�9� �M�$�C��C�C�C�U�C�C�E��$�$�T�%�[�[�%�8�8�8����r�z�%�/@�/@�t��L�L�9�PQ����q�	�	�	��(�(���%�8�8�8�9�9�9�9�9�9�9�9�9�9�9����9�9�9�9�9�9�9�9�9�9�9�9�9�9�9����9�9�9�9��
9�	9�	9s6�A,C.�1C	�C.�C
�C.�C
�C.�.C2�5C2c�`�dD]�}|�|���5t�td|���}t�td|���}|�t|��|�t|��ddd��n#1swxYwY��dS)N)r�*r�r)r}r�rx)r�rr�rD�assertIn�assertNotIn)rr��
nocompress�yescompresss    r�test_compress_correct_levelz$TestGzip.test_compress_correct_level�s����	5�	5�E����E��*�*�
5�
5�!�]�]�5���]�O�O�
�"�m�m�E��%�m�P�P���
�
�e�Z�0�0�0�� � ���4�4�4�	
5�
5�
5�
5�
5�
5�
5�
5�
5�
5�
5����
5�
5�
5�
5��	5�	5s�A;B"�"B&	�)B&	c���ttfD]�}tj��}t�|d���5}|�|��ddd��n#1swxYwY|�t�|�	����|��t�
|��}|�t�|��|����dS)NrAr~)rDr�rr�rr5r6r7�
decompressrr�)rr:r
r=rZs     r�test_decompresszTestGzip.test_decompress�s���E�N�	;�	;�D��*�,�,�C����s���6�6�
�!�����
�
�
�
�
�
�
�
�
�
�
�
�
�
����
�
�
�
����T�_�_�S�\�\�^�^�<�<�d�C�C�C��M�M�$�'�'�E����T�_�_�U�3�3�T�:�:�:�:�	;�	;s�A"�"A&	�)A&	c��t�t��}|�ttj|dd���dS)N����rr�rDrk�EOFErrorrf�r�compressed_datas  r�!test_decompress_truncated_trailerz*TestGzip.test_decompress_truncated_trailer��<���-�-��.�.�����(�D�O�_�S�b�S�5I�J�J�J�J�Jrc��t�t��}|�ttj|dd���dS)N���rjrls  r�test_decompress_missing_trailerz(TestGzip.test_decompress_missing_trailer�rorc�b�tdz}t�|��dd�}t�t	j|�����5}|�t|j��ddd��n#1swxYwYt�t	j|�����5}|�	|�t|����|��|�t|jd��ddd��n#1swxYwYtdd��D]p}t�t	j|d|������5}|�t|jd��ddd��n#1swxYwY�qdS)NrBrqr<rxr�r�)rDrr�r5rr�rkrkr9r7r8r\)rr:�	truncatedr=r�s     r�test_read_truncatedzTestGzip.test_read_truncated�s���R�x���M�M�$�'�'����,�	�
�]�]�2�:�i�#8�#8�]�
9�
9�	0�Q����h���/�/�/�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0����	0�	0�	0�	0�
�]�]�2�:�i�#8�#8�]�
9�
9�	3�Q����Q�V�V�C��I�I�.�.��5�5�5����h����2�2�2�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3����	3�	3�	3�	3��q�"���	7�	7�A����r�z�)�B�Q�B�-�'@�'@��A�A�
7�Q��!�!�(�A�F�A�6�6�6�
7�
7�
7�
7�
7�
7�
7�
7�
7�
7�
7����
7�
7�
7�
7��	7�	7s7�!B�B�B�?AD#�#D'�*D'�5"F#�#F'	�*F'	c���d}t�tj|�����5}|�|���d��ddd��dS#1swxYwYdS)Ns��cQ�ExtraI-.2�Mxr<sTest)rr5rr�r7r9)r�gzdatar=s   r�test_read_with_extrazTestGzip.test_read_with_extra�s���<���]�]�2�:�f�#5�#5�]�
6�
6�	0�!����Q�V�V�X�X�w�/�/�/�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0����	0�	0�	0�	0�	0�	0s�)A&�&A*�-A*c�b�t�|jd��5}|�t��ddd��n#1swxYwYt�|jd��5}|jjj���ddd��dS#1swxYwYdS)NrArj)	rr�r(r6rDrRr-�_fp�prependrJs  r�test_prepend_errorzTestGzip.test_prepend_error�s	��
�Y�Y�t�}�d�
+�
+�	�q�
�G�G�E�N�N�N�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�Y�Y�t�}�d�
+�
+�	(�q�
�I�M��%�%�'�'�'�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(����	(�	(�	(�	(�	(�	(s#�A�A�A�3$B$�$B(�+B(c��tjdgd���}t|��|jz}t�tj��d���5}|�|�|��|��|�|�	��|��ddd��dS#1swxYwYdS)N�Q)rxr��rYrr2r~)
rfr8�itemsizerr5rr�r7r6r)r�q�LENGTHr=s    r�test_issue44439zTestGzip.test_issue44439s����K��_�_�_�-�-���Q���!�*�$��
�]�]�2�:�<�<�c�]�
:�
:�	/�a����Q�W�W�Q�Z�Z��0�0�0����Q�V�V�X�X�v�.�.�.�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/����	/�	/�	/�	/�	/�	/s�AB;�;B?�B?N)r0)8r r!r"r?rKrTr_rbrgrmrprwrrr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr	rrr!r.r8r@rErHrLrVr[r]rdrgrnrrrurxr|r�rrrr/r/8sK������/�/�/�/����0�0�0�"'�'�'�8�8�8�?�?�?�.�.�.�&�&�&�
7�
7�
7��Z�S��#�#�#�.�.�$�#�.����85�5�5�-�-�-�&/�/�/�	F�	F�	F�
5�
5�
5�
"�
"�
"����&*�*�*�!�!�!�5�5�5�8�8�8�<�<�<�	1�	1�	1�1H�1H�1H�f���?�?�?�(7�7�7�*
F�
F�
F�?�?�?�@�@�@�5�5�5�7�7�7�,7�7�7�G.�G.�G.�R&8�&8�&8�P9�9�9�4/�/�/�#*�#*�#*�J
4�
4�
4�
9�
9�
9�5�5�5�	9�	9�	9�5�5�5�;�;�;�K�K�K�K�K�K�7�7�7�0�0�0�(�(�(�/�/�/�/�/rr/c�D�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
S)�TestOpenc� �tdz}t�|jd��5}|�|��ddd��n#1swxYwYt|jd��5}t�|�����}|�||��ddd��n#1swxYwYt�|jd��5}|�|���|��ddd��n#1swxYwYt�|jd��5}|�|��ddd��n#1swxYwYt|jd��5}t�|�����}|�||dz��ddd��n#1swxYwY|�t��5t�|jd��ddd��n#1swxYwYtj|j��t�|jd��5}|�|��ddd��n#1swxYwYt|jd��5}t�|�����}|�||��ddd��dS#1swxYwYdS)NrBrArjr�r�r��rDrr�r(r6rfr9r7rkr�rr'�rrr=�	file_datas    r�test_binary_modeszTestOpen.test_binary_modessd���r�z��
�Y�Y�t�}�d�
+�
+�	"�q�
�G�G�L�!�!�!�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"����	"�	"�	"�	"�
�$�-��
&�
&�	6�!���������1�1�I����Y��5�5�5�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6����	6�	6�	6�	6��Y�Y�t�}�d�
+�
+�	5�q����Q�V�V�X�X�|�4�4�4�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5����	5�	5�	5�	5��Y�Y�t�}�d�
+�
+�	"�q�
�G�G�L�!�!�!�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"����	"�	"�	"�	"�
�$�-��
&�
&�	:�!���������1�1�I����Y��q�(8�9�9�9�	:�	:�	:�	:�	:�	:�	:�	:�	:�	:�	:����	:�	:�	:�	:��
�
��
/�
/�	+�	+��I�I�d�m�T�*�*�*�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+����	+�	+�	+�	+�����'�'�'�
�Y�Y�t�}�d�
+�
+�	"�q�
�G�G�L�!�!�!�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"����	"�	"�	"�	"�
�$�-��
&�
&�	6�!���������1�1�I����Y��5�5�5�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6����	6�	6�	6�	6�	6�	6��A
�
A�A�-AB<�<C�C�')D�D �#D �E)�)E-�0E-�	AG�G�"G�!H-�-H1�4H1�1J�J�J�3AL�L�
Lc��tj|j��}t�|d��5}|�tdz��ddd��n#1swxYwY|�|j|j��t�|d��5}|�t��ddd��n#1swxYwY|�|j|j��t�|��5}|�|�	��tdz��ddd��n#1swxYwY|�|j|j��dS)NrArBr�rN)
rrOr(rr�r6rDr7rQr9)rr(r=s   r�test_pathlike_filezTestOpen.test_pathlike_file&s����%�d�m�4�4��
�Y�Y�x��
&�
&�	 �!�
�G�G�E�B�J����	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 ����	 �	 �	 �	 ��������/�/�/�
�Y�Y�x��
&�
&�	�!�
�G�G�E�N�N�N�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��������/�/�/�
�Y�Y�x�
 �
 �	3�A����Q�V�V�X�X�u�r�z�2�2�2�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3����	3�	3�	3�	3��������/�/�/�/�/s5�A�A#�&A#�%C�C�C�1E�E�Ec� �tdz}t�|jd��5}|�|��ddd��n#1swxYwYt|jd��5}t�|�����}|�||��ddd��n#1swxYwYt�|jd��5}|�|���|��ddd��n#1swxYwYt�|jd��5}|�|��ddd��n#1swxYwYt|jd��5}t�|�����}|�||dz��ddd��n#1swxYwY|�t��5t�|jd��ddd��n#1swxYwYtj|j��t�|jd��5}|�|��ddd��n#1swxYwYt|jd��5}t�|�����}|�||��ddd��dS#1swxYwYdS)NrBr2rjr3rMr�r�r�r�s    r�test_implicit_binary_modesz#TestOpen.test_implicit_binary_modes2sd���r�z��
�Y�Y�t�}�c�
*�
*�	"�a�
�G�G�L�!�!�!�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"����	"�	"�	"�	"�
�$�-��
&�
&�	6�!���������1�1�I����Y��5�5�5�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6����	6�	6�	6�	6��Y�Y�t�}�c�
*�
*�	5�a����Q�V�V�X�X�|�4�4�4�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5����	5�	5�	5�	5��Y�Y�t�}�c�
*�
*�	"�a�
�G�G�L�!�!�!�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"����	"�	"�	"�	"�
�$�-��
&�
&�	:�!���������1�1�I����Y��q�(8�9�9�9�	:�	:�	:�	:�	:�	:�	:�	:�	:�	:�	:����	:�	:�	:�	:��
�
��
/�
/�	*�	*��I�I�d�m�S�)�)�)�	*�	*�	*�	*�	*�	*�	*�	*�	*�	*�	*����	*�	*�	*�	*�����'�'�'�
�Y�Y�t�}�c�
*�
*�	"�a�
�G�G�L�!�!�!�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"����	"�	"�	"�	"�
�$�-��
&�
&�	6�!���������1�1�I����Y��5�5�5�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6����	6�	6�	6�	6�	6�	6r�c��t�d��dz}|�dtj��}t
�|jdd���5}|�|��ddd��n#1swxYwYt
|jd��5}t
�	|�
�����d��}|�||��ddd��n#1swxYwYt
�|jdd���5}|�|�
��|��ddd��n#1swxYwYt
�|jdd���5}|�|��ddd��n#1swxYwYt
|jd��5}t
�	|�
�����d��}|�||d	z��ddd��dS#1swxYwYdS)
NrrB�
�wtrrj�rt�atr��rDr�replacerH�lineseprr�r(r6rfr9r7�rr�uncompressed_rawr=r�s     r�test_text_modeszTestOpen.test_text_modesNs���|�|�G�,�,�r�1��'�/�/��b�j�A�A��
�Y�Y�t�}�d�W�Y�
=�
=�	"��
�G�G�L�!�!�!�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"����	"�	"�	"�	"�
�$�-��
&�
&�	:�!���������1�1�8�8��A�A�I����Y�(8�9�9�9�	:�	:�	:�	:�	:�	:�	:�	:�	:�	:�	:����	:�	:�	:�	:��Y�Y�t�}�d�W�Y�
=�
=�	5�����Q�V�V�X�X�|�4�4�4�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5����	5�	5�	5�	5�
�Y�Y�t�}�d�W�Y�
=�
=�	"��
�G�G�L�!�!�!�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"����	"�	"�	"�	"�
�$�-��
&�
&�	>�!���������1�1�8�8��A�A�I����Y�(8�1�(<�=�=�=�	>�	>�	>�	>�	>�	>�	>�	>�	>�	>�	>�	>����	>�	>�	>�	>�	>�	>s\� B�B�	B�"AD�D�D�1)E&�&E*�-E*�F5�5F9�<F9�AH;�;H?�H?c��tdz}|�d��}t�|��}t�tj|��d��5}|�|���|��ddd��n#1swxYwYt�tj|��d��5}|�|���|��ddd��n#1swxYwYt�tj|��dd���5}|�|���|��ddd��dS#1swxYwYdS)NrBrr3rjr�r)	rDrrr�r�rr�r7r9)r�uncompressed_bytes�uncompressed_strr�r=s     r�test_fileobjzTestOpen.test_fileobj^s���"�R�Z��-�4�4�W�=�=���]�]�#5�6�6�
�
�Y�Y�r�z�*�-�-�s�
3�
3�	;�q����Q�V�V�X�X�'9�:�:�:�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;����	;�	;�	;�	;�
�Y�Y�r�z�*�-�-�t�
4�
4�	;�����Q�V�V�X�X�'9�:�:�:�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;����	;�	;�	;�	;�
�Y�Y�r�z�*�-�-�t�g�Y�
F�
F�	9�!����Q�V�V�X�X�'7�8�8�8�	9�	9�	9�	9�	9�	9�	9�	9�	9�	9�	9�	9����	9�	9�	9�	9�	9�	9s6�')B�B �#B �)D	�	D
�D
�)E9�9E=�E=c���|�t��5t�d��ddd��n#1swxYwY|�t��5t�|jd��ddd��n#1swxYwY|�t��5t�|jd��ddd��n#1swxYwY|�t��5t�|jdd���ddd��n#1swxYwY|�t��5t�|jdd���ddd��n#1swxYwY|�t��5t�|jdd	�
��ddd��dS#1swxYwYdS)Ngw��/�^@�wbt�xbtrjzutf-8r�ignore)�errorsr�)�newline)rkrlrr�r�r(rs r�test_bad_paramszTestOpen.test_bad_paramsis��
�
�
�y�
)�
)�	�	��I�I�g����	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�
�
�z�
*�
*�	,�	,��I�I�d�m�U�+�+�+�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,����	,�	,�	,�	,�
�
�
�z�
*�
*�	,�	,��I�I�d�m�U�+�+�+�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,����	,�	,�	,�	,�
�
�
�z�
*�
*�	=�	=��I�I�d�m�T�G�I�<�<�<�	=�	=�	=�	=�	=�	=�	=�	=�	=�	=�	=����	=�	=�	=�	=�
�
�
�z�
*�
*�	<�	<��I�I�d�m�T�(�I�;�;�;�	<�	<�	<�	<�	<�	<�	<�	<�	<�	<�	<����	<�	<�	<�	<�
�
�
�z�
*�
*�	9�	9��I�I�d�m�T�4�I�8�8�8�	9�	9�	9�	9�	9�	9�	9�	9�	9�	9�	9�	9����	9�	9�	9�	9�	9�	9sk�A�A�	A�'!B�B�B�9!C&�&C*�-C*�#D:�:D>�D>�#F�F�F�3#G#�#G'�*G'c���t�d��dz}|�dtj��}t
�|jdd���5}|�|��ddd��n#1swxYwYt
|jd��5}t
�	|�
�����d��}|�||��ddd��n#1swxYwYt
�|jdd���5}|�|�
��|��ddd��dS#1swxYwYdS)	NrrBr�r�zutf-16rrjr�r�r�s     r�
test_encodingzTestOpen.test_encodingxs����|�|�G�,�,�r�1��'�/�/��b�j�A�A��
�Y�Y�t�}�d�X�Y�
>�
>�	"�!�
�G�G�L�!�!�!�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"����	"�	"�	"�	"�
�$�-��
&�
&�	:�!���������1�1�8�8��B�B�I����Y�(8�9�9�9�	:�	:�	:�	:�	:�	:�	:�	:�	:�	:�	:����	:�	:�	:�	:��Y�Y�t�}�d�X�Y�
>�
>�	5�!����Q�V�V�X�X�|�4�4�4�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5����	5�	5�	5�	5�	5�	5s7� B�B�	B�"AD�D�D�1)E'�'E+�.E+c�h�t�|jd��5}|�d��ddd��n#1swxYwYt�|jddd���5}|�|���d��ddd��dS#1swxYwYdS)NrAsfoo�barr�rr�)rr��foobar)rr�r(r6r7r9rJs  r�test_encoding_error_handlerz$TestOpen.test_encoding_error_handler�s��
�Y�Y�t�}�d�
+�
+�	#�q�
�G�G�M�"�"�"�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#����	#�	#�	#�	#�
�Y�Y�t�}�d�W�X�Y�
N�
N�	1�����Q�V�V�X�X�x�0�0�0�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1����	1�	1�	1�	1�	1�	1s#�A�A�
A�1)B'�'B+�.B+c��t�d��dz}t�|jddd���5}|�|��ddd��n#1swxYwYt�|jddd���5}|�|���|g��ddd��dS#1swxYwYdS)NrrBr�r�)rr�r��
)rDrrr�r(r6r7r�)rrr=s   r�test_newlinezTestOpen.test_newline�s5���|�|�G�,�,�r�1��
�Y�Y�t�}�d�W�d�Y�
K�
K�	"�q�
�G�G�L�!�!�!�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"����	"�	"�	"�	"�
�Y�Y�t�}�d�W�d�Y�
K�
K�	<�q����Q�[�[�]�]�\�N�;�;�;�	<�	<�	<�	<�	<�	<�	<�	<�	<�	<�	<�	<����	<�	<�	<�	<�	<�	<s$�A#�#A'�*A'�*C�C�CN)r r!r"r�r�r�r�r�r�r�r�r�rrrr�r�
s�������6�6�6�6
0�
0�
0�6�6�6�8>�>�>� 	9�	9�	9�
9�
9�
9�
5�
5�
5�1�1�1�<�<�<�<�<rr�c����fd�}|S)Nc�J���tj�����fd���}|S)Nc���tj���	�|i|��tj���S#tj���wxYwr)rH�makedirsr�rmtree)r�kwargs�	directory�functions  ��r�wrapperz?create_and_remove_directory.<locals>.decorator.<locals>.wrapper�sU����K�	�"�"�"�
,��x��0��0�0�� ��+�+�+�+��	� ��+�+�+�+���s	�3�A	)�	functools�wraps)r�r�r�s` �r�	decoratorz.create_and_remove_directory.<locals>.decorator�s>����	���	"�	"�	,�	,�	,�	,�	,�
#�	"�	,��rr)r�r�s` r�create_and_remove_directoryr��s$���������rc�
�eZdZdZe��d���Zee��d���Zd�Z	e��ee��d�����Z
ee��d���Zee��d���Zd�Z
d	�Zd
S)�TestCommandLinesThis is a simple test with gzipc�B�tj��5}t�|d���5}|�|j��ddd��n#1swxYwYtjdddf}t|ttt���5}|�
|�����\}}ddd��n#1swxYwYddd��n#1swxYwY|�|d��|�||j��dS)NrAr~�-mr�-d��stdin�stdout�stderrr)
rr�rr5r6r:�sys�
executablerr�communicaterr7)r�bytes_io�	gzip_filer�proc�out�errs       r�test_decompress_stdin_stdoutz,TestCommandLine.test_decompress_stdin_stdout�s���
�Z�\�\�	A�X����x�d��;�;�
+�y�����	�*�*�*�
+�
+�
+�
+�
+�
+�
+�
+�
+�
+�
+����
+�
+�
+�
+��>�4���5�D��t�4��T�B�B�B�
A�d��+�+�H�,=�,=�,?�,?�@�@���S�
A�
A�
A�
A�
A�
A�
A�
A�
A�
A�
A����
A�
A�
A�
A�	A�	A�	A�	A�	A�	A�	A�	A�	A�	A�	A����	A�	A�	A�	A�	
����c�"�"�"�����d�i�(�(�(�(�(sX�C#�A�C#�A	�C#�A	� 5C#�+C�C#�C	�C#�C	�C#�#C'�*C'c�T�tj�td��}|�tj�|����t�|d���5}|�|j	��ddd��n#1swxYwYtddd|��\}}}ttj�td��d��5}|�|���|j	��ddd��n#1swxYwY|�
tj�|����|�|d	��|�|d
��|�|d
��dS)Nztestgzip.gzrA)r;r�rr��testgziprjrr)rH�pathrt�TEMPDIRr��existsrr�r6r:r
r7r9r�)r�gzipname�fp�rcr�r��gunzipeds       r�test_decompress_infile_outfilez.TestCommandLine.test_decompress_infile_outfile�s����7�<�<���7�7����������1�1�2�2�2�
�Y�Y�x�d�Y�
+�
+�	 �r��H�H�T�Y����	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 ����	 �	 �	 �	 �'��f�d�H�E�E���C��
�"�'�,�,�w�
�3�3�T�
:�
:�	9�h����X�]�]�_�_�d�i�8�8�8�	9�	9�	9�	9�	9�	9�	9�	9�	9�	9�	9����	9�	9�	9�	9�	
�������x�0�0�1�1�1�����Q��������c�"�"�"�����c�"�"�"�"�"s$�4B�B�"B�/.D)�)D-�0D-c���tdddd��\}}}|�d|�����|�|d��|�|d��dS)Nr�rr�zthisisatest.outs.filename doesn't end in .gz: 'thisisatest.out'rxr)rr7�strip�rr�r�r�s    r�$test_decompress_infile_outfile_errorz4TestCommandLine.test_decompress_infile_outfile_error�sm��,�T�6�4�AR�S�S���C�����J�C�I�I�K�K�X�X�X�����Q��������c�"�"�"�"�"rc�:�tjddf}t|ttt���5}|�|j��\}}ddd��n#1swxYwY|�|d��|�|dd�d��dS)Nr�rr�rr�r�)r�r�rrr�r:r7)rrr�r�r�s     r�test_compress_stdin_outfilez+TestCommandLine.test_compress_stdin_outfile�s����~�t�V�+��
�4�t�D��
>�
>�
>�	3�$��'�'��	�2�2�H�C��	3�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3����	3�	3�	3�	3�	
����c�"�"�"�����R�a�R��+�.�.�.�.�.s�A�A �#A c�(�tj�td��}|dz}|�tj�|����t
|d��5}|�|j��ddd��n#1swxYwYtdd|��\}}}|�
tj�|����|�|d��|�|d��dS)Nr��.gzrAr�rr)rHr�rtr�r�r�r�r6r:r
r�r7)r�local_testgzipr�r�r�r�r�s       r�$test_compress_infile_outfile_defaultz4TestCommandLine.test_compress_infile_outfile_default�s$������g�z�:�:��!�E�)����������1�1�2�2�2�
�.�$�
'�
'�	 �2��H�H�T�Y����	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 ����	 �	 �	 �	 �(��f�n�E�E���C���������x�0�0�1�1�1�����c�"�"�"�����c�"�"�"�"�"s�-B�B�Bc� �dD�]�}|�|���5tj�td��}|dz}|�tj�|����t|d��5}|�|j	��ddd��n#1swxYwYtdd||��\}}}|�tj�|����|�|d��|�|d��tj
|��|�tj�|����ddd��n#1swxYwY���dS)	N)�--fast�--best)�compress_levelr�r�rAr�rr)r�rHr�rtr�r�r�r�r6r:r
r�r7�remove)rr�r�r�r�r�r�r�s        r�test_compress_infile_outfilez,TestCommandLine.test_compress_infile_outfile�s���2�	;�	;�N����^��<�<�
;�
;�!#����g�z�!B�!B��)�E�1��� � ������!9�!9�:�:�:��.�$�/�/�(�2��H�H�T�Y�'�'�'�(�(�(�(�(�(�(�(�(�(�(����(�(�(�(� 0��f�n�n�]�]���C���������x� 8� 8�9�9�9�� � ��c�*�*�*�� � ��c�*�*�*��	�(�#�#�#�� � ������!9�!9�:�:�:�
;�
;�
;�
;�
;�
;�
;�
;�
;�
;�
;����
;�
;�
;�
;��	;�	;s7�A-F�	B0�$F�0B4�4F�7B4�8B=F�F	�F	c��tdddd��\}}}|�d|��|�|d��dS)Nr�rr�r�s8error: argument --best: not allowed with argument --fastr�rr`r7r�s    r�%test_compress_fast_best_are_exclusivez5TestCommandLine.test_compress_fast_best_are_exclusive�sM��,�T�6�8�X�N�N���C���
�
�Q�SV�W�W�W�����c�"�"�"�"�"rc��tdddd��\}}}|�d|��|�|d��dS)Nr�rr�r�sAerror: argument -d/--decompress: not allowed with argument --fastrr�r�s    r�-test_decompress_cannot_have_flags_compressionz=TestCommandLine.test_decompress_cannot_have_flags_compression�sM��,�T�6�8�T�J�J���C���
�
�Z�\_�`�`�`�����c�"�"�"�"�"rN)r r!r"r:r	r�r�r�r�r�r�r�r�r�r�rrrr�r��s������-�D�����
)�
)���
)�!� ��)�)�#�#�*�)�#� #�#�#����� � ��)�)�/�/�*�)���/�!� ��)�)�#�#�*�)�#�!� ��)�)�;�;�*�)�;�$#�#�#�
#�#�#�#�#rr��__main__)&�__doc__rfr�rrHr�r��unittest�
subprocessrr�test.supportrrrrr	�test.support.script_helperr
r�
import_modulerrDr�r��abspathr-r�r�r�TestCaser$r/r�r�r�r �mainrrr�<module>r�s,����
��������	�	�	�	�	�	�	�	�
�
�
�
�
�
�
�
�����"�"�"�"�"�"�"�"�&�&�&�&�&�&�"�"�"�"�"�"�=�=�=�=�=�=�=�=�=�=�N�N�N�N�N�N�N�N�"�}�"�6�*�*��	��	��
�'�/�/�)�*�
+�
+�h�
6��&�&�&�&�&�2�:�&�&�&�(�(�(�(�(�x� �(�(�(�O/�O/�O/�O/�O/�x�O/�O/�O/�dH<�H<�H<�H<�H<�x�H<�H<�H<�V
�
�
�[#�[#�[#�[#�[#�h�'�[#�[#�[#�|�z����H�M�O�O�O�O�O��r

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