HEX
Server: Apache
System: Linux bd12.noc223.com 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64
User: handcraf (1693)
PHP: 8.1.28
Disabled: NONE
Upload Files
File: //opt/alt/python312/lib64/python3.12/test/__pycache__/test_gzip.cpython-312.opt-2.pyc
�

}h�e�����	ddlZddlZddlZddlZddlZddlZddlZddlZddlm	Z	m
Z
ddlmZddlm
Z
ddlmZmZmZddlmZmZej(d�Zej(d�Zd	Zd
Zej2j5e
j6�dzZGd�d
ej:�ZGd�dej>�Z Gd�de �Z!Gd�de �Z"d�Z#Gd�dej>�Z$e%dk(rejL�yy)�N)�PIPE�Popen)�
import_helper)�	os_helper)�_4G�
bigmemtest�requires_subprocess)�assert_python_ok�assert_python_failure�gzip�zlibsy  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�Zy)�UnseekableIOc��y)NF���selfs �5/opt/alt/python312/lib64/python3.12/test/test_gzip.py�seekablezUnseekableIO.seekable&s���c�"�tj��N��io�UnsupportedOperationrs r�tellzUnseekableIO.tell)����%�%�%rc�"�tj�rr)r�argss  r�seekzUnseekableIO.seek,rrN)�__name__�
__module__�__qualname__rrr rrrrr%s���&�&rrc�0�eZdZejZd�Zd�Zy)�BaseTestc�B�tj|j�yr�r�unlink�filenamers r�setUpzBaseTest.setUp3���������'rc�B�tj|j�yrr'rs r�tearDownzBaseTest.tearDown6r+rN)r!r"r#r�TESTFNr)r*r-rrrr%r%0s�����H�(�(rr%c�Z�eZdZd7d�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.�Z0d/�Z1d0�Z2d1�Z3d2�Z4d3�Z5d4�Z6d5�Z7y6)8�TestGzipc��t|�}tj|jd|z�5}|j	|�}ddd�|jt
|��tj|jd|z�5}|j|j�|�ddd�y#1swY�qxYw#1swYyxYw)N�w�r)�bytesr�GzipFiler)�write�assertEqual�len�read)r�data�mode�b_data�f�ls      r�write_and_read_backzTestGzip.write_and_read_back;s����t���
�]�]�4�=�=�#�d�(�
3�	�q�����
�A�	�����C��K�(�
�]�]�4�=�=�#�d�(�
3�	/�q����Q�V�V�X�v�.�	/�	/�	�	��	/�	/�s�B1�!B=�1B:�=Cc��tj|jd�5}|jtdz�|j�|j
�ttd�r#tj|j
��|j�ddd�j�y#1swY�xYw)N�wb�2�fsync)rr5r)r6�data1�flush�fileno�hasattr�osrC�close�rr=s  r�
test_writezTestGzip.test_writeCs��
�]�]�4�=�=�$�
/�	�1�
�G�G�E�B�J��
�G�G�I�
�H�H�J��r�7�#��������$�
�G�G�I�	�	
���	�	�	�s�A<B6�6B?c�n�tj|j�}tj	|d�5}|jtdz�ddd�|jjt�tj	|d�5}|jt�ddd�tj	|�5}|j�}ddd�|jtdz�|j|jt�y#1swY��xYw#1swY�}xYw#1swY�[xYw)Nr2rB�a�3)�pathlib�Pathr)rr5r6rD�assertIsInstance�name�strr9r7)rr)r=�ds    r�"test_write_read_with_pathlike_filez+TestGzip.test_write_read_with_pathlike_fileQs����<�<��
�
�.��
�]�]�8�S�
)�	 �Q�
�G�G�E�B�J��	 ����a�f�f�c�*�
�]�]�8�S�
)�	�Q�
�G�G�E�N�	�
�]�]�8�
$�	������A�	�����E�B�J�'����a�f�f�c�*�	 �	 ��	�	��	�	�s#�D�
D�D+�D�D(�+D4c���|jttdz��ttt	d���}|jdgd���}|j|�y)NrB��B)�rY�)�shape)r?�
memoryviewrDr4�range�cast)r�mr:s   r�test_write_memoryviewzTestGzip.test_write_memoryview`sL��� � ��E�B�J�!7�8��u�U�3�Z�(�)���v�v�c��v�)��� � ��&rc�F�|jttdz��y)NrB)r?�	bytearrayrDrs r�test_write_bytearrayzTestGzip.test_write_bytearrayfs��� � ��5�2�:�!6�7rc�\�|jtjdtdz��y)N�I�()r?�arrayrDrs r�test_write_arrayzTestGzip.test_write_arrayis��� � ����S�%�"�*�!=�>rc�6�tj|jd�5}|jt�5|jd�ddd�|jt�5|jg�ddd�|jt�ddd�tj|jd�5}|j|j�t�ddd�y#1swY��xYw#1swY��xYw#1swY�oxYw#1swYyxYw)NrA��rb)	rr5r)�assertRaises�	TypeErrorr6rDr7r9rJs  r�test_write_incompatible_typez%TestGzip.test_write_incompatible_typels����]�]�4�=�=�$�
/�	�1��"�"�9�-�
������
��"�"�9�-�
������
�
�G�G�E�N�	��]�]�4�=�=�$�
/�	.�1����Q�V�V�X�u�-�	.�	.�
�
��
�
��	�	��	.�	.�sF�D�C+�	D�&C7�8D�=%D�+C4	�0D�7D	�<D�D�Dc���|j�tj|jd�5}|j	�}ddd�|jtdz�y#1swY�#xYw)Nr3rB)rKrr5r)r9r7rD�rr=rTs   r�	test_readzTestGzip.test_readysT������
�]�]�4�=�=�#�
.�	�!�����A�	�����E�"�H�%�	�	�s�A$�$A-c��|j�g}d}tj|jd�5}	|j	�}|sn@|j|�|t
|�z
}|j|j�|��S	ddd�|jdj|�tdz�y#1swY�2xYw)Nrr3rrB)rKrr5r)�read1�appendr8r7r�joinrD)r�blocks�nreadr=rTs     r�
test_read1zTestGzip.test_read1�s�����������
�]�]�4�=�=�#�
.�	2�!���G�G�I�����
�
�a� ���Q����� � �����5�1���		2�	
������&�)�5�2�:�6�	2�	2�s�AB<�<C�)�size�memusec���tjtd��}tjt	j
|�d��}|j
|j|�t�y)Nry��
compresslevelrk��fileobjr;)r�compressrDr5r�BytesIOr7r9)rrz�
compressedr=s    r�test_read_largezTestGzip.test_read_large�sI���]�]�5��]�:�
��M�M�"�*�*�Z�"8�t�M�D����������u�-rc�:�|j�tj|jd�}|j}|j|j�|j�|j|j�|jt�5|jd�ddd�|jt�5|jd�ddd�|jt�5|j�ddd�tj|jd�}|j}|j|j�|j�|j|j�|jt�5|jd�ddd�|jt�5|j�ddd�y#1swY��7xYw#1swY��xYw#1swY��xYw#1swY�^xYw#1swYyxYw)Nr3ryrr2r)rKrr5r)r��assertFalse�closedrI�
assertTruerl�
ValueErrorr9r rr6rE)rr=r�s   r�test_io_on_closed_objectz!TestGzip.test_io_on_closed_object�s���
	
�����M�M�$�-�-��-���)�)��������(�	���	�������'�
�
�
�z�
*�	�
�F�F�1�I�	�
�
�
�z�
*�	�
�F�F�1�I�	�
�
�
�z�
*�	�
�F�F�H�	�
�M�M�$�-�-��-���)�)��������(�	���	�������'�
�
�
�z�
*�	�
�G�G�C�L�	�
�
�
�z�
*�	�
�G�G�I�	�	�	�	��	�	��	�	��	�	��	�	�s<�G�G,�6G9�H�H�G)�,G6�9H�H�Hc��|j�tj|jd�5}|j	t
dz�ddd�tj|jd�5}|j
�}ddd�|jtdzt
dzz�y#1swY�fxYw#1swY�9xYw)N�ab�rkrB)	rKrr5r)r6�data2r9r7rDrps   r�test_appendzTestGzip.test_append�s�������
�]�]�4�=�=�$�
/�	 �1�
�G�G�E�B�J��	 ��]�]�4�=�=�$�
/�	�1�����A�	�����U�2�X�%��(�3�4�	 �	 ��	�	�s�B/�2B;�/B8�;Cc��tj|jdd�5}|jd�ddd�t	dd�D]=}tj|jdd�5}|jd�ddd��?tj|jd�5}d}	|jd	�}||z
}|sn�	ddd�|j
d
�y#1swY��xYw#1swY��xYw#1swY�4xYw)NrA�	�ar��r�rkri s�aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)rr5r)r6r]r9r7)rr=�i�zgfile�contents�ztxts      r�test_many_appendzTestGzip.test_many_append�s����]�]�4�=�=�$��
2�	�a�
�G�G�D�M�	��q�#��	�A����t�}�}�d�A�6�
�!�����
�
�
�	�
�]�]�4�=�=�$�
/�	#�6��H���{�{�4�(���D� ���U��#�	#�	
����8�,�	�	��
�
��	#�	#�s#�C"�,C.�(C:�"C+�.C7	�:Dc���tj|jd�5}|jtdz�ddd�tj|jd�5}|j|j
�tdz�ddd�|jt�5tj|jd�ddd�y#1swY��xYw#1swY�TxYw#1swYyxYw)N�xbrBrk)	rr5r)r6rDr7r9rl�FileExistsErrorrJs  r�test_exclusive_writezTestGzip.test_exclusive_write�s���
�]�]�4�=�=�$�
/�	 �1�
�G�G�E�B�J��	 �
�]�]�4�=�=�$�
/�	3�1����Q�V�V�X�u�r�z�2�	3�
�
�
��
/�	/��M�M�$�-�-��.�	/�	/�		 �	 ��	3�	3��	/�	/�s#�C�"(C�'!C)�C�C&�)C2c�\�|j�tj|jd�5}t	j
|�5}|D�cgc]}|��}}ddd�ddd�|j
dtjd��z�ycc}w#1swY�@xYw#1swY�DxYw)NrkrBT��keepends)	rKrr5r)r�BufferedReaderr7rD�
splitlines)rr=r3�line�liness     r�test_buffered_readerzTestGzip.test_buffered_reader�s���	
����
�]�]�4�=�=�$�
/�	-�1��"�"�1�%�
-��*+�,�$��,��,�
-�	-�	
�����U�%5�%5�t�%5�%D� D�E��-�
-�
-��	-�	-�s5�B"�B�	B�B�B"�B�B	�B"�"B+c��|j�tj|jd�5}d}	|j	|�}|s|dk7rn&|jt
|�|k�|dzdz}�?	ddd�y#1swYyxYw)NrkrryrB)rKrr5r)�readliner�r8)rr=�line_length�Ls    r�
test_readlinezTestGzip.test_readline�s��������]�]�4�=�=�$�
/�	5�1��K���J�J�{�+���[�A�-�u�����A��+� 5�6�*�Q��"�4��	�/4�		5�	5�	5�s�AA>�>Bc�L�|j�tj|jd�5}|j	�}ddd�tj|jd�5}	|j	d�}|gk(rn�	ddd�y#1swY�MxYw#1swYyxYw)Nrk�)rKrr5r)�	readlines)rr=r�s   r�test_readlineszTestGzip.test_readlines�s��������]�]�4�=�=�$�
/�	�1����
�A�	��]�]�4�=�=�$�
/�	"�1���K�K��$����7�E��!�	"�	"�	�	��	"�	"�s�B�*B�B�B#c��|j�tj|j�5}	|j	�}|j�}|snu|j	�}|j
|�t|�dkDrd}nt|�}|j|�}|j|d||�|j
|���	ddd�y#1swYyxYw)N�
)
rKrr5r)rr�r r8r9r7)rr=�oldpos�line1�newpos�amount�line2s       r�test_seek_readzTestGzip.test_seek_read�s��������]�]�4�=�=�
)�
	�Q��������
�
����e���������v���u�:�b�=��F� ��Z�F����v���� � ��w����7����v���$�	
	�
	�
	�s�BC�Cc�(�|j�tj|j�5}|j	d�|jdd��|j	d�}ddd�|j
tdd�y#1swY�#xYw)Nr�ry)�whence��)rKrr5r)r9r r7rD)rr=�ys   r�test_seek_whencezTestGzip.test_seek_whencesu�������]�]�4�=�=�
)�	�Q�
�F�F�2�J�
�F�F�2�a�F� ����r�
�A�	�	
����E�"�R�L�)�		�	�s�6B�Bc���tj|jd�5}tddd�D]$}|j	|�|jd��&	ddd�y#1swYyxYw)Nr2rrW�sGZ
)rr5r)r]r r6)rr=�poss   r�test_seek_writezTestGzip.test_seek_writesZ��
�]�]�4�=�=�#�
.�	!�!��Q��R�(�
!�����s������ �
!�	!�	!�	!�s�5A � A)c���|j�tj|jd�5}|j	|j
jd�ddd�tj|j�tj|jd�5}|j	|j
jd�ddd�y#1swY�xxYw#1swYyxYw)Nr3rk�xr�)	rKrr5r)r7�	myfileobjr;rr(rJs  r�	test_modezTestGzip.test_modes�������
�]�]�4�=�=�#�
.�	5�!����Q�[�[�-�-�t�4�	5�������'�
�]�]�4�=�=�#�
.�	5�!����Q�[�[�-�-�t�4�	5�	5�	5�	5��	5�	5�s�'C�'C�C�C$c��dD]l}tj|j|�5}|jt	|d��|j|j|j�ddd��ny#1swY�yxYw)N)rArkrR)rr5r)r�rGr7rR)rr;r=s   r�test_1647484zTestGzip.test_1647484'sj�� �	8�D����t�}�}�d�3�
8�q������6� 2�3�� � �������7�
8�
8�	8�
8�
8�s�AA3�3A<	c�8�|j�tj|jd�5}|j	t|jd��|j|jj|j�ddd�y#1swYyxYw)NrkrR)	rKrr5r)r�rGr�r7rRrJs  r�test_paddedfile_getattrz TestGzip.test_paddedfile_getattr-sh������
�]�]�4�=�=�$�
/�	<�1��O�O�G�A�I�I�v�6�7����Q�Y�Y�^�^�T�]�]�;�	<�	<�	<�s�AB�Bc��d}tj|jd|��5}|jt�ddd�tj|j�5}|jt
|d��|j|j�|j�}|j|t�|j|j|�ddd�y#1swY��xYw#1swYyxYw)N��[r2��mtimer�)rr5r)r6rDr�rG�assertIsNoner�r9r7)rr��fWrite�fRead�dataReads     r�
test_mtimezTestGzip.test_mtime3s�����
�]�]�4�=�=�#�u�]�
=�	 ���L�L���	 �
�]�]�4�=�=�
)�	1�U��O�O�G�E�7�3�4����e�k�k�*��z�z�|�H����X�u�-����U�[�[�%�0�	1�	1�	 �	 ��	1�	1�s�C$�"A9C0�$C-�0C9c
���d}tj|jd|��5}|jt�ddd�t|jd�5}|j
d�}|j|d�|j
d�}|j|d�	|jjd	�d
z}d}|j
d�}|j||�|j
d�}	|j|	tjd
|��|j
d�}
|j|
d�|j
d�}|j|d�|j
t|��}|j||�|jtj|j�j dz
�|j
d�}
|j|
d�|j
d�}|j|tjd
tt���ddd�y#1swY���xYw#t$rd}d
}Y���wxYw#1swYyxYw)Nr�r2r�rk���ry�zLatin-1�rrZz<i���rYs��d�)rr5r)r6rD�openr9r7�encode�UnicodeEncodeError�struct�packr8r rH�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�G����W�k�2��Z�Z��]�F����V�W�-�
(�#�}�}�3�3�I�>��H�� '�
�
�
�
�1�
�I����Y�
�6����A��J����Z����T�5�)A�B��j�j��m�G����W�g�.��Z�Z��]�F����V�W�-��
�
�3�|�#4�5�I����Y��5�
�J�J�r�w�w�t�}�}�-�5�5��9�:����A��J����Z�)9�:����A��J����Z����T�3�u�:�)F�G�W+	H�+	H�	 �	 ��&�
(�"�� '�
�
(��+	H�+	H�s=�H8�AI�! I�E.I�8I�
I�I�I�I�I"c�N�tj|_|j�yr)r�TESTFN_ASCIIr)r�rs r�test_metadata_ascii_namez!TestGzip.test_metadata_ascii_nameqs��!�.�.��
����rc���gd�}d}|D]�\}}}|j|�5tj|jd|��}|5|j	t
�ddd�t
|jd�5}|j|�|jd�}|j||�ddd�ddd���y#1swY�gxYw#1swY� xYw#1swY��xYw)N))�fastry�)�bestr�r�)�tradeoff�r�rYr2r}rkry)
�subTestrr5r)r6rDr�r r9r7)	r�cases�	xflOffsetrR�level�expectedXflByter�r�r�s	         r�test_compresslevel_metadataz$TestGzip.test_compresslevel_metadataus���
��
�	�.3�	?�*�T�5�/����d�#�
?����t�}�}�c���O���(��L�L��'�(��$�-�-��.�?�%��J�J�y�)�#�j�j��m�G��$�$�W�o�>�?�	
?�
?�	?�(�(��?�?��	
?�
?�s;�%C�C�C�:5C�/C�C�C�C�C�C#	c��tj|jd�5}|jd�ddd�tj|jd�}|j	�	|5	ddd�|jd�	tj|jd�5}ddzddd�|jd�y#1swY��xYw#1swY�gxYw#t$rY�dwxYw#1swY�BxYw#t$rYywxYw)NrAsxxxrkz4__enter__ on a closed file didn't raise an exceptionryrz1/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�	��M�M�$�-�-��.��	���	�	N��
��
�

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

�I�I�5�6�#	�	��

�
���	��	��

�
�� �	��	�s_�C
�,C"�.C�0C"�
 C=�*C1�0C=�
C�C�C"�"	C.�-C.�1C:�6C=�=	D	�D	c���tj|jd�5}|jtdz�ddd�t|jd�5}|jd�ddd�tj|jd�5}|j
�}|j|tdzd�ddd�y#1swY��xYw#1swY�ixYw#1swYyxYw)NrArBr�s2rkzIncorrect data in file)rr5r)r6rDr�r9r7rps   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�	F�	F�	 �	 ��	"�	"��	F�	F�s#�C�C�+C�C�C�C'c�^�|jttjt��yr)r��
issubclassr�BadGzipFile�OSErrorrs r�test_gzip_BadGzipFile_exceptionz(TestGzip.test_gzip_BadGzipFile_exception�s�����
�4�#3�#3�W�=�>rc�H�t|jd�5}|jtdz�ddd�tj|jd�5}|j
tj|j�ddd�y#1swY�]xYw#1swYyxYw)NrArBr3)	r�r)r6rDrr5rlrr�)r�files  r�test_bad_gzip_filezTestGzip.test_bad_gzip_file�s���
�$�-�-��
&�	#�$��J�J�u�r�z�"�	#�
�]�]�4�=�=�#�
.�	@�$����d�.�.����?�	@�	@�	#�	#��	@�	@�s�B�+B�B�B!c�r�tdz}t�}tj|d��5}|j	|�ddd�|j�}t|�}tj|d��5}|j
|j�|�ddd�y#1swY�exYw#1swYyxYw)NrBrArrk)rDrrr5r6�getvaluer7r9)r�uncompressed�bufr=r�s     r�test_non_seekable_filezTestGzip.test_non_seekable_file�s����r�z���n��
�]�]�3�T�]�
2�	"�a�
�G�G�L�!�	"��\�\�^�
��:�&��
�]�]�3�T�]�
2�	5�a����Q�V�V�X�|�4�	5�	5�		"�	"��	5�	5�s�B!�7!B-�!B*�-B6c	�T�tdz}tj|jd�5}|j	|�ddd�d�}tj|jd�5}d|_d}|�D]R}|j
|�}|dk(rn:|j|jt|��|�|t|�z
}�T|j|jd�d�|j|t|��ddd�y#1swY��xYw#1swYyxYw)	Nr�rAc3�:K�	tddd�D]}|�����w)N�rBr�)r])�ns r�sizesz!TestGzip.test_peek.<locals>.sizes�s+������q�"�b�)��A��G���s�rk�!rr�d)
rDrr5r)r6�max_read_chunk�peekr7r9r8)rr
r=rrwr�ss       r�	test_peekzTestGzip.test_peek�s���s�{��
�]�]�4�=�=�$�
/�	"�1�
�G�G�L�!�	"�	�
�]�]�4�=�=�$�
/�
	7�1�!�A���E��W�
 ���F�F�1�I����8��� � �����A����3���Q����
 �
���Q�V�V�C�[�#�.����U�C��$5�6�
	7�
	7�	"�	"��
	7�
	7�s�D�'B"D�D�D'c�v�tdzjd�jd��}|j�tj|jd�5}tj|d��5}|j|j�|�ddd�ddd�y#1swY�xYw#1swYyxYw)NrB�asciiTr�r3��encoding)rD�decoder�rKrr5r)r�
TextIOWrapperr7r�)rr�r=�ts    r�test_textio_readlineszTestGzip.test_textio_readlines�s������#�#�G�,�7�7��7�F������
�]�]�4�=�=�#�
.�	7�!��!�!�!�g�6�
7�!�� � ������6�
7�	7�	7�
7�
7��	7�	7�s$�B/�1!B#�B/�#B,	�(B/�/B8c�2�tj|jtjtjz�}tj
|d�5}tj|d��5}	ddd�ddd�y#1swY�xYw#1swYyxYw)NrAr2r)rHr�r)�O_WRONLY�O_CREAT�fdopenrr5)r�fdr=�gs    r�test_fileobj_from_fdopenz!TestGzip.test_fileobj_from_fdopen�sy���W�W�T�]�]�B�K�K�"�*�*�$<�
=��
�Y�Y�r�4�
 �	�A����q�s��3�
�q��
�	�	�
�
��	�	�s$�B
�.B�0B
�B
	�B
�
Bc��tj|jd�j�t	|jd�5}tj|d��5}|j|jtj�ddd�tj|d��5}|j|jtj�ddd�tj|d��5}|j|jtj�ddd�tj|d��5}|j|jtj�ddd�|jt�5tj|d��ddd�ddd�d	D]j}t	|j|�5}tj|�
�5}|j|jtj�ddd�ddd��ldD]�}d|vrtj|j�t	|j|�5}|jt�5tj|�
�}ddd�5|j|jtj�ddd�ddd���y#1swY��GxYw#1swY��
xYw#1swY���xYw#1swY���xYw#1swY��hxYw#1swY��mxYw#1swY��xYw#1swY���xYw#1swY��xYw#1swY��xYw#1swY��;xYw)NrA�r+br3rr2rMr��z)rkr(�r�)rAr�r�)rr5r)rIr�r7r;�READ�WRITErlr�rr(�assertWarns�
FutureWarning)rr=r%r;s    r�test_fileobj_modezTestGzip.test_fileobj_mode�s����
�
�d�m�m�T�*�0�0�2�
�$�-�-��
'�
	3�1����q�s��3�
4�q�� � �������3�
4����q�s��3�
5�q�� � �������4�
5����q�s��3�
5�q�� � �������4�
5����q�s��3�
5�q�� � �������4�
5��"�"�:�.�
3��
�
�a�c�
�2�
3�
	3� �	8�D��d�m�m�T�*�
8�a��]�]�1�]�-�8���$�$�Q�V�V�T�Y�Y�7�8�
8�
8�	8�%�	9�D��d�{�� � ����/��d�m�m�T�*�
9�a��%�%�m�4�1��
�
�a�
�0�A�1��9��$�$�Q�V�V�T�Z�Z�8�9�
9�
9�	9�
4�
4��
5�
5��
5�
5��
5�
5��
3�
3��
	3�
	3��8�8��
8�
8��1�1��9�9��
9�
9�s��L�+K
�L�'+K�L�1+K'�L�;+K4�&L�L�L�L(�+L�L(�M
�.L5�
M
�+M�:M
�
K	�L�K$	�L�'K1	�,L�4K>	�9L�L	�L�L�L%� L(�(L2	�5L>�:M
�M
�M
�
M	c�N�|j}	|jd�}tjd�5}|j
tdz�ddd�tj|d�5}|j|j�tdz�ddd�tj|d�5}|j|j�tdz�ddd�y#t$r|jd�Y��wxYw#1swY��xYw#1swY�|xYw#1swYyxYw)Nrz%Temporary file name needs to be ASCIIrArBrk)
r)r�r��skipTestrr5r6rDr7r9)r�str_filename�bytes_filenamer=s    r�test_bytes_filenamezTestGzip.test_bytes_filename�s����}�}��	C�)�0�0��9�N��]�]�>�4�
0�	 �A�
�G�G�E�B�J��	 �
�]�]�>�4�
0�	3�A����Q�V�V�X�u�r�z�2�	3��]�]�<��
.�	3�!����Q�V�V�X�u�r�z�2�	3�	3��"�	C��M�M�A�B�	C��	 �	 ��	3�	3��	3�	3�s4�C#�D�,(D�2(D�#D�?D�D�D�D$c���	tjdtd�zd��}|jt	|�t
j�tj|�}tj|��}|j|jd�d�dt
jz}|j|jjj�|d�y)Nr�g��>Ar�r}r*ryz)Excessive amount of data was decompressed)rr��int�
assertLessr8r�DEFAULT_BUFFER_SIZEr�r5r7r9�assertLessEqual�_buffer�rawr)r�bomb�decomp�
max_decomps    r�test_decompress_limitedz TestGzip.test_decompress_limiteds���;��}�}�U�S��X�-�Q�}�?������D�	�2�#9�#9�:��z�z�$������t��,��������Q���/���/�/�/�
����V�^�^�/�/�4�4�6�
�7�	9rc�\�ttfD]�}dD]�}tj|g|���}|j	t|�t�tjtj|�d��5}|j	|j�|�ddd�����y#1swY��xYw)N�r)ry)r�)r�rkr)rDr�rr�r7�typer4r5rr�r9)rr:r�datacr=s     r�
test_compresszTestGzip.test_compresss����E�N�	5�D�.�
5���
�
�d�2�T�2��� � ��e��e�4��]�]�2�:�:�e�+<�4�]�H�5�A��$�$�Q�V�V�X�t�4�5�5�
5�	5�5�5�s�4!B"�"B+c	���d}ttfD]�}dD]�}|j||��5tj|g|��d|i�}|jt
|�t�tjtj|�d��5}|jd�|j|j|�ddd�ddd�����y#1swY�xYw#1swY��xYw)Nr�rA)r:rr�rkrry)
rDr�r�rr�r7rBr4r5rr�r9r�)rr�r:rrCr=s      r�test_compress_mtimezTestGzip.test_compress_mtime!s������E�N�	9�D�.�
9���\�\�t�$�\�7�9� �M�M�$�C��C�U�C�E��$�$�T�%�[�%�8����r�z�z�%�/@�t��L�9�PQ����q�	��(�(����%�8�9�9�9�
9�	9�
9�9��9�9�s$�A#C�
.C	�;C�C
�C�C%c�(�dD]�}|j|��5tjtd|��}tjtd|��}|j	t|�|jt|�ddd���y#1swY��xYw)N)r�*r�r)r~r�ry)r�rr�rD�assertIn�assertNotIn)rr��
nocompress�yescompresss    r�test_compress_correct_levelz$TestGzip.test_compress_correct_level,s���	5�E����E��*�
5�!�]�]�5���]�O�
�"�m�m�E��%�m�P���
�
�e�Z�0�� � ���4�	
5�
5�	5�
5�
5�s�A%B�B	c��ttfD]�}tj�}tj|d��5}|j
|�ddd�|jtj|j��|�tj|�}|jtj|�|���y#1swY�yxYw)NrAr)rDr�rr�rr5r6r7�
decompressr	r�)rr:rr=rCs     r�test_decompresszTestGzip.test_decompress5s����E�N�	;�D��*�*�,�C����s���6�
�!�����
�
����T�_�_�S�\�\�^�<�d�C��M�M�$�'�E����T�_�_�U�3�T�:�	;�
�
�s�C�C	c��tjt�}|jttj
|dd�y)N����rr�rDrl�EOFErrorrO�r�compressed_datas  r�!test_decompress_truncated_trailerz*TestGzip.test_decompress_truncated_trailer?�-���-�-��.�����(�D�O�O�_�S�b�5I�Jrc��tjt�}|jttj
|dd�y)N���rSrUs  r�test_decompress_missing_trailerz(TestGzip.test_decompress_missing_trailerCrXrc��tdz}tj|�dd}tjt	j
|���5}|j
t|j�ddd�tjt	j
|���5}|j|jt|��|�|j
t|jd�ddd�tdd�D]X}tjt	j
|d|���5}|j
t|jd�ddd��Zy#1swY��xYw#1swY�}xYw#1swY�}xYw)NrBrZr*ryr�r�)rDrr�r5rr�rlrTr9r7r8r])rr:�	truncatedr=r�s     r�test_read_truncatedzTestGzip.test_read_truncatedGs)���R�x���M�M�$�'���,�	�
�]�]�2�:�:�i�#8�]�
9�	0�Q����h����/�	0�
�]�]�2�:�:�i�#8�]�
9�	3�Q����Q�V�V�C��I�.��5����h�����2�	3��q�"��	7�A����r�z�z�)�B�Q�-�'@��A�
7�Q��!�!�(�A�F�F�A�6�
7�
7�	7�
	0�	0��	3�	3��

7�
7�s%�!E�AE%�,"E1�E"�%E.�1E:	c���d}tjtj|���5}|j	|j�d�ddd�y#1swYyxYw)Ns��cQ�ExtraI-.2�Mxr*sTest)rr5rr�r7r9)r�gzdatar=s   r�test_read_with_extrazTestGzip.test_read_with_extraUsO��<���]�]�2�:�:�f�#5�]�
6�	0�!����Q�V�V�X�w�/�	0�	0�	0�s�!A�Ac�^�tj|jd�5}|jt�ddd�tj|jd�5}|j
jjj�ddd�y#1swY�axYw#1swYyxYw)NrArk)	rr�r)r6rDr:r;�_fp�prependrJs  r�test_prepend_errorzTestGzip.test_prepend_error]s~��
�Y�Y�t�}�}�d�
+�	�q�
�G�G�E�N�	�
�Y�Y�t�}�}�d�
+�	(�q�
�I�I�M�M���%�%�'�	(�	(�	�	��	(�	(�s�B�/B#�B �#B,c�b�tjdgd��}t|�|jz}tj	tj�d��5}|j|j|�|�|j|j�|�ddd�y#1swYyxYw)N�Q)ryr��rZrr2r)
rgr8�itemsizerr5rr�r7r6r)r�q�LENGTHr=s    r�test_issue44439zTestGzip.test_issue44439ds���K�K��_�-���Q��!�*�*�$��
�]�]�2�:�:�<�c�]�
:�	/�a����Q�W�W�Q�Z��0����Q�V�V�X�v�.�	/�	/�	/�s
�AB%�%B.c���tj�}d}tj|d��5}|j	|�|j�|j
�}ddd�|j
�}|jtj|�|�|jt�5tj�ddd�tjtj��}tj�}tj|�|j|j��}|j||�y#1swY��xYw#1swY��xYw)N�important message here.r2r)�wbits)rr�rr5r6rEr	r7rOrlrTr
�
decompressobj�	MAX_WBITS�_read_gzip_headerr9)r�b�messager=�partial_data�	full_datarT�read_messages        r�test_flush_flushes_compressorz&TestGzip.test_flush_flushes_compressorls	���J�J�L��,��
�]�]�1�3�]�
/�	(�1�
�G�G�G��
�G�G�I��:�:�<�L�	(��J�J�L�	��������3�W�=��
�
�x�
(�	*��O�O�L�)�	*����d�n�n�_��5���J�J�|�$�����q�!��|�|�A�F�F�H�-������w�/�	(�	(��	*�	*�s�2E�2E�E�E&c�z�Gd�d�}tj�}|�}tj|d��5}||_|j�|jd�|jd��ddd�tjdddg}|j|j|�y#1swY�:xYw)	Nc� �eZdZd�Zd�Zdd�Zy)�1TestGzip.test_flush_modes.<locals>.FakeCompressorc��g|_yr)�modesrs r�__init__z:TestGzip.test_flush_modes.<locals>.FakeCompressor.__init__�s	����
rc��y�Nrr)rr:s  rr�z:TestGzip.test_flush_modes.<locals>.FakeCompressor.compress�s��rc�:�|jj|�yr�)r}rt)rr;s  rrEz7TestGzip.test_flush_modes.<locals>.FakeCompressor.flush�s���
�
�!�!�$�'�rN)���)r!r"r#r~r�rErrr�FakeCompressorr{�s��
 �
�
rr�r2rrBr)�	zlib_moder�)
rr�rr5r�rEr
�Z_SYNC_FLUSHr7r})rr�rs�fcr=�expected_modess      r�test_flush_modeszTestGzip.test_flush_modes�s���	�	�
�J�J�L��
�
��
�]�]�1�3�]�
/�	#�1��A�J�
�G�G�I�
�G�G�B�K�
�G�G�c�G�"�		#�
������	
��	
������>�2�	#�	#�s�;B1�1B:c�p�tj�}d}tj|d��5}|j	|�|jt
|��|j	|�ddd�|j�}|jtj|�|dz�y#1swY�BxYw)Nrnr2rr�)
rr�rr5r6r r8r	r7rO)rrsrtr=r:s     r�test_write_seek_writezTestGzip.test_write_seek_write�s���
�J�J�L��,��
�]�]�1�3�]�
/�	�1�
�G�G�G��
�F�F�3�w�<� �
�G�G�G��	��z�z�|���������.��!��<�	�	�s�=B,�,B5N)rs)8r!r"r#r?rKrUr`rcrhrnrqrxrrr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrr&r/r4r?rDrFrMrPrWr[r^rarerlrxr�r�rrrr0r0:s��/��
+�'�8�?�.�&�
7��S��#�.�$�.��85�-�&/�	F�
5�
"��&*�!�5�8�<�	1�1H�f�?�(7�*
F�?�@�5�7�,7��9�43�
9�5�	9�5�;�K�K�7�0�(�/�0�*3�6
=rr0c�B�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zy
)�TestOpenc��tdz}tj|jd�5}|j	|�ddd�t|jd�5}tj|j
��}|j||�ddd�tj|jd�5}|j|j
�|�ddd�tj|jd�5}|j	|�ddd�t|jd�5}tj|j
��}|j||dz�ddd�|jt�5tj|jd�ddd�tj|j�tj|jd�5}|j	|�ddd�t|jd�5}tj|j
��}|j||�ddd�y#1swY��$xYw#1swY���xYw#1swY���xYw#1swY��txYw#1swY��*xYw#1swY��xYw#1swY��xYw#1swYyxYw)NrBrArkr�r�r��rDrr�r)r6rOr9r7rlr�rr(�rr
r=�	file_datas    r�test_binary_modeszTestOpen.test_binary_modes�s���r�z��
�Y�Y�t�}�}�d�
+�	"�q�
�G�G�L�!�	"�
�$�-�-��
&�	6�!��������1�I����Y��5�	6��Y�Y�t�}�}�d�
+�	5�q����Q�V�V�X�|�4�	5��Y�Y�t�}�}�d�
+�	"�q�
�G�G�L�!�	"�
�$�-�-��
&�	:�!��������1�I����Y��q�(8�9�	:��
�
��
/�	+��I�I�d�m�m�T�*�	+�������'�
�Y�Y�t�}�}�d�
+�	"�q�
�G�G�L�!�	"�
�$�-�-��
&�	6�!��������1�I����Y��5�	6�	6�)	"�	"��	6�	6��	5�	5��	"�	"��	:�	:��	+�	+��	"�	"��	6�	6��_�I�6I+�8!I8�J�19J�!J�/J+�6J7�I(�+I5�8J�J�J�J(�+J4�7Kc���tj|j�}tj	|d�5}|jtdz�ddd�tj	|d�5}|jt�ddd�tj	|�5}|j|j�tdz�ddd�y#1swY��xYw#1swY�[xYw#1swYyxYw)NrArBr�rN)	rOrPr)rr�r6rDr7r9)rr)r=s   r�test_pathlike_filezTestOpen.test_pathlike_file�s����<�<��
�
�.��
�Y�Y�x��
&�	 �!�
�G�G�E�B�J��	 �
�Y�Y�x��
&�	�!�
�G�G�E�N�	�
�Y�Y�x�
 �	3�A����Q�V�V�X�u�r�z�2�	3�	3�		 �	 ��	�	��	3�	3�s#�C�-C� (C)�C�C&�)C2c��tdz}tj|jd�5}|j	|�ddd�t|jd�5}tj|j
��}|j||�ddd�tj|jd�5}|j|j
�|�ddd�tj|jd�5}|j	|�ddd�t|jd�5}tj|j
��}|j||dz�ddd�|jt�5tj|jd�ddd�tj|j�tj|jd�5}|j	|�ddd�t|jd�5}tj|j
��}|j||�ddd�y#1swY��$xYw#1swY���xYw#1swY���xYw#1swY��txYw#1swY��*xYw#1swY��xYw#1swY��xYw#1swYyxYw)NrBr2rkr3rMr�r�r�r�s    r�test_implicit_binary_modesz#TestOpen.test_implicit_binary_modes�s���r�z��
�Y�Y�t�}�}�c�
*�	"�a�
�G�G�L�!�	"�
�$�-�-��
&�	6�!��������1�I����Y��5�	6��Y�Y�t�}�}�c�
*�	5�a����Q�V�V�X�|�4�	5��Y�Y�t�}�}�c�
*�	"�a�
�G�G�L�!�	"�
�$�-�-��
&�	:�!��������1�I����Y��q�(8�9�	:��
�
��
/�	*��I�I�d�m�m�S�)�	*�������'�
�Y�Y�t�}�}�c�
*�	"�a�
�G�G�L�!�	"�
�$�-�-��
&�	6�!��������1�I����Y��5�	6�	6�)	"�	"��	6�	6��	5�	5��	"�	"��	:�	:��	*�	*��	"�	"��	6�	6�r�c��tjd�dz}|jdtj�}t
j
|jdd��5}|j|�ddd�t
|jd�5}t
j|j��jd�}|j||�ddd�t
j
|jdd��5}|j|j�|�ddd�t
j
|jdd��5}|j|�ddd�t
|jd�5}t
j|j��jd�}|j||d	z�ddd�y#1swY��[xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swYyxYw)
NrrB�
�wtrrk�rt�atr��rDr�replacerH�lineseprr�r)r6rOr9r7�rr
�uncompressed_rawr=r�s     r�test_text_modeszTestOpen.test_text_modes�s����|�|�G�,�r�1��'�/�/��b�j�j�A��
�Y�Y�t�}�}�d�W�Y�
=�	"��
�G�G�L�!�	"�
�$�-�-��
&�	:�!��������1�8�8��A�I����Y�(8�9�	:��Y�Y�t�}�}�d�W�Y�
=�	5�����Q�V�V�X�|�4�	5�
�Y�Y�t�}�}�d�W�Y�
=�	"��
�G�G�L�!�	"�
�$�-�-��
&�	>�!��������1�8�8��A�I����Y�(8�1�(<�=�	>�	>�	"�	"��	:�	:��	5�	5��	"�	"��	>�	>�s>�G�AG�:!G �G,�5AG8�G�G� G)�,G5�8Hc��tdz}|jd�}tj|�}tj	tj|�d�5}|j|j�|�ddd�tj	tj|�d�5}|j|j�|�ddd�tj	tj|�dd��5}|j|j�|�ddd�y#1swY��xYw#1swY�jxYw#1swYyxYw)NrBrr3rkr�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�
�
�Y�Y�r�z�z�*�-�s�
3�	;�q����Q�V�V�X�'9�:�	;�
�Y�Y�r�z�z�*�-�t�
4�	;�����Q�V�V�X�'9�:�	;�
�Y�Y�r�z�z�*�-�t�g�Y�
F�	9�!����Q�V�V�X�'7�8�	9�	9�		;�	;��	;�	;��	9�	9�s$�!D)�+!D5�?!E�)D2�5D>�E
c�v�|jt�5tjd�ddd�|jt�5tj|j
d�ddd�|jt�5tj|j
d�ddd�|jt�5tj|j
dd��ddd�|jt�5tj|j
dd��ddd�|jt�5tj|j
dd	�
�ddd�y#1swY��GxYw#1swY��xYw#1swY��xYw#1swY��xYw#1swY�|xYw#1swYyxYw)Ngw��/�^@�wbt�xbtrkzutf-8r�ignore)�errorsr�)�newline)rlrmrr�r�r)rs r�test_bad_paramszTestOpen.test_bad_paramssK��
�
�
�y�
)�	��I�I�g��	�
�
�
�z�
*�	,��I�I�d�m�m�U�+�	,�
�
�
�z�
*�	,��I�I�d�m�m�U�+�	,�
�
�
�z�
*�	=��I�I�d�m�m�T�G�I�<�	=�
�
�
�z�
*�	<��I�I�d�m�m�T�(�I�;�	<�
�
�
�z�
*�	9��I�I�d�m�m�T�4�I�8�	9�	9�	�	��	,�	,��	,�	,��	=�	=��	<�	<��	9�	9�sG�E1�	!E>�!F�#F�#F#�#F/�1E;�>F�F�F �#F,�/F8c��tjd�dz}|jdtj�}t
j
|jdd��5}|j|�ddd�t
|jd�5}t
j|j��jd�}|j||�ddd�t
j
|jdd��5}|j|j�|�ddd�y#1swY��xYw#1swY�axYw#1swYyxYw)	NrrBr�r�zutf-16rrkr�r�r�s     r�
test_encodingzTestOpen.test_encodings���|�|�G�,�r�1��'�/�/��b�j�j�A��
�Y�Y�t�}�}�d�X�Y�
>�	"�!�
�G�G�L�!�	"�
�$�-�-��
&�	:�!��������1�8�8��B�I����Y�(8�9�	:��Y�Y�t�}�}�d�X�Y�
>�	5�!����Q�V�V�X�|�4�	5�	5�	"�	"��	:�	:��	5�	5�s%�D$�AD0�:!D<�$D-�0D9�<Ec�@�tj|jd�5}|jd�ddd�tj|jddd��5}|j	|j�d�ddd�y#1swY�VxYw#1swYyxYw)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�	1�����Q�V�V�X�x�0�	1�	1�	#�	#��	1�	1�s�B�!B�B�Bc�x�tjd�dz}tj|jddd��5}|j|�ddd�tj|jddd��5}|j
|j�|g�ddd�y#1swY�WxYw#1swYyxYw)NrrBr�r�)rr�r��
)rDrrr�r)r6r7r�)rr
r=s   r�test_newlinezTestOpen.test_newline(s����|�|�G�,�r�1��
�Y�Y�t�}�}�d�W�d�Y�
K�	"�q�
�G�G�L�!�	"�
�Y�Y�t�}�}�d�W�d�Y�
K�	<�q����Q�[�[�]�\�N�;�	<�	<�	"�	"��	<�	<�s�B$�9"B0�$B-�0B9N)r!r"r#r�r�r�r�r�r�r�r�r�rrrr�r��s/��6�63�6�8>� 	9�
9�
5�1�<rr�c����fd�}|S)Nc�F���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>.wrapper3s>����K�K�	�"�
,���0��0�� � ��+��	� � ��+�s	�5�A)�	functools�wraps)r�r�r�s` �r�	decoratorz.create_and_remove_directory.<locals>.decorator2s%���	����	"�	,�
#�	,��rr)r�r�s` r�create_and_remove_directoryr�1s�����rc��eZdZdZe�d��Zee�d��Zd�Z	e�ee�d���Z
ee�d��Zee�d��Zd�Z
d	�Zy
)�TestCommandLinesThis is a simple test with gzipc��tj�5}tj|d��5}|j	|j
�ddd�tjdddf}t|ttt��5}|j|j��\}}ddd�ddd�|jd�|j|j
�y#1swY��xYw#1swY�LxYw#1swY�PxYw)NrAr�-mr�-d��stdin�stdout�stderrr)
rr�rr5r6r:�sys�
executablerr�communicater	r7)r�bytes_io�	gzip_filer�proc�out�errs       r�test_decompress_stdin_stdoutz,TestCommandLine.test_decompress_stdin_stdoutAs���
�Z�Z�\�	A�X����x�d��;�
+�y�����	�	�*�
+��>�>�4���5�D��t�4��T�B�
A�d��+�+�H�,=�,=�,?�@���S�
A�	A�	
����c�"�����d�i�i�(�
+�
+��
A�
A��	A�	A�s:�C:�C"�	7C:�#C.�#C:�"C+	�'C:�.C7	�3C:�:Dc��tjjtd�}|j	tjj|��tj|d��5}|j|j�ddd�tddd|�\}}}ttjjtd�d�5}|j|j�|j�ddd�|jtjj|��|j|d	�|j|d
�|j|d
�y#1swY��xYw#1swY�zxYw)Nztestgzip.gzrA)r;r�rr��testgziprkrr)rH�pathru�TEMPDIRr��existsrr�r6r:r
r7r9r�)r�gzipname�fp�rcr�r��gunzipeds       r�test_decompress_infile_outfilez.TestCommandLine.test_decompress_infile_outfileNs���7�7�<�<���7�����������1�2�
�Y�Y�x�d�Y�
+�	 �r��H�H�T�Y�Y��	 �'��f�d�H�E���C��
�"�'�'�,�,�w�
�3�T�
:�	9�h����X�]�]�_�d�i�i�8�	9�	
��������x�0�1�����Q������c�"�����c�"�	 �	 ��	9�	9�s�*E&�+E2�&E/�2E;c��tdddd�\}}}|jd|j��|j|d�|j|d�y)Nr�rr�zthisisatest.outs.filename doesn't end in .gz: 'thisisatest.out'ryr)rr7�strip�rr�r�r�s    r�$test_decompress_infile_outfile_errorz4TestCommandLine.test_decompress_infile_outfile_error_sP��,�T�6�4�AR�S���C�����J�C�I�I�K�X�����Q������c�"rc��tjddf}t|ttt��5}|j	|j
�\}}ddd�|j
d�|j
ddd�y#1swY�1xYw)Nr�rr�rr�r�)r�r�rrr�r:r7)rrr�r�r�s     r�test_compress_stdin_outfilez+TestCommandLine.test_compress_stdin_outfileesy���~�~�t�V�+��
�4�t�D��
>�	3�$��'�'��	�	�2�H�C��	3�	
����c�"�����R�a��+�.�		3�	3�s�A>�>Bc���tjjtd�}|dz}|j	tjj|��t
|d�5}|j|j�ddd�tdd|�\}}}|jtjj|��|j|d�|j|d�y#1swY�mxYw)Nr��.gzrAr�rr)rHr�rur�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_defaultos��������g�z�:��!�E�)�����������1�2�
�.�$�
'�	 �2��H�H�T�Y�Y��	 �(��f�n�E���C����������x�0�1�����c�"�����c�"�	 �	 �s�$C,�,C5c���dD�]L}|j|��5tjjtd�}|dz}|jtjj
|��t|d�5}|j|j�ddd�tdd||�\}}}|jtjj
|��|j|d�|j|d�tj|�|jtjj
|��ddd���Oy#1swY��xYw#1swY��gxYw)	N)�--fast�--best)�compress_levelr�r�rAr�rr)r�rHr�rur�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��)�E�1��� � �������!9�:��.�$�/�(�2��H�H�T�Y�Y�'�(� 0��f�n�n�]���C����������x� 8�9�� � ��c�*�� � ��c�*��	�	�(�#�� � �������!9�:�
;�
;�	;�(�(��
;�
;�s%�A$E �=E�B/E �E�E � E*	c�p�tdddd�\}}}|jd|�|j|d�y)Nr�rr�r�s8error: argument --best: not allowed with argument --fastr�rrIr7r�s    r�%test_compress_fast_best_are_exclusivez5TestCommandLine.test_compress_fast_best_are_exclusive�s8��,�T�6�8�X�N���C���
�
�Q�SV�W�����c�"rc�p�tdddd�\}}}|jd|�|j|d�y)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�s8��,�T�6�8�T�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__)'rgr�rrHrOr�r��unittest�
subprocessrr�test.supportrrrrr	�test.support.script_helperr
r�
import_modulerr
rDr�r��abspathr.r�r�r�TestCaser%r0r�r�r�r!�mainrrr�<module>r�s����
��	�	��
�
��"�&�"�=�=�N�"�}�"�"�6�*��"�}�"�"�6�*��	��	��
�'�'�/�/�)�*�*�
+�h�
6��&�2�:�:�&�(�x� � �(�l	=�x�l	=�^E<�x�E<�P
�[#�h�'�'�[#�|�z���H�M�M�O�r