Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/test/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/test/__pycache__/test_zipfile64.cpython-35.opt-2.pyc



���]��@s�ddlmZejdd�ddlZddlZddlZddlZddlZddlm	Z	ddl
mZddlm
Z
mZe
dZdZGdd�dej�ZGd
d�dej�Zedkr�ej�dS)�)�supportZextralargefilez>test requires loads of disk-space bytes and a long time to runN)�StringIO)�
TemporaryFile)�TESTFN�
requires_zlib�2��<c@sReZdZdd�Zdd�Zdd�Zedd��Zd	d
�ZdS)�TestsWithSourceFilecCsadd�td�D�}dj|�jd�|_ttd�}|j|j�|j�dS)Ncss|]}d|VqdS)zTest of zipfile line %d.N�)�.0�irr�3/opt/alt/python35/lib64/python3.5/test_zipfile64.py�	<genexpr>sz,TestsWithSourceFile.setUp.<locals>.<genexpr>i@B�
�ascii�wb)�range�join�encode�data�openr�write�close)�selfZline_gen�fprrr�setUps
zTestsWithSourceFile.setUpcCsbtj|d|�}dt|j�}tj�t}xwt|�D]i}|jd||j�|tj�krEtj�t}td||fdt	j
�t	j
j�qEW|j�tj|d|�}x�t|�D]r}|j
|jd|�|j�|tj�kr�tj�t}td	||fdt	j
�t	j
j�q�W|j�dS)N�w�i�ztestfn%dz/  zipTest still writing %d of %d, be patient...�file�rz/  zipTest still reading %d of %d, be patient...i@l)�zipfile�ZipFile�lenr�time�_PRINT_WORKING_MSG_INTERVALr�writestr�print�sys�
__stdout__�flushr�assertEqual�read)r�f�compressionZzipfpZ	filecountZ	next_time�numrrr�zipTest's,
 zTestsWithSourceFile.zipTestc
CsMt��*}|j|tj�|j|j�WdQRX|jttj�dS)N)rr1r"Z
ZIP_STORED�assertFalse�closed�TESTFN2)rr.rrr�
testStoredHszTestsWithSourceFile.testStoredc
CsMt��*}|j|tj�|j|j�WdQRX|jttj�dS)N)rr1r"�ZIP_DEFLATEDr2r3r4)rr.rrr�testDeflatedPsz TestsWithSourceFile.testDeflatedcCs:x3ttfD]%}tjj|�r
tj|�q
WdS)N)rr4�os�path�exists�remove)rZfnamerrr�tearDownYszTestsWithSourceFile.tearDownN)	�__name__�
__module__�__qualname__rr1r5rr7r<rrrrr
s

!	r
c@s4eZdZdd�Zdd�Zdd�ZdS)�
OtherTestscCstjtdddd�}d|_d}x4t|�D]&}|jd
|d|dd�q7W|jt|j��|�|j	�tjtdd
�}|jt|j��|�xLt|�D]>}|j
d
|�jd�}|j|d|dd�q�W|j	�dS)N�moder�
allowZip64T�d��r�zfoo%08dz%d�9r!riii�)r"r#r�debugrr'r,r$�namelistrr-�decode)r�zipf�numfilesr
�zipf2�contentrrr�testMoreThan64kFiles`s	$
 zOtherTests.testMoreThan64kFilescCs�tjtdddd�}d|_d}x4t|�D]&}|jd|d	|d
d�q7W|jt|j��|�|j	tj
��|jd|d�WdQRX|jt|j��|�|j�tjtdd
dd�}d|_|jt|j��|�|j	tj
��|jd|d�WdQRX|jt|j��|�|j�tjtdd
dd�}d|_|jt|j��|�d}x7t||�D]&}|jd|d	|d
d�q�W|jt|j��|�|j�tjtdd�}|jt|j��|�xLt|�D]>}|jd|�j
d�}|j|d	|d
d�qIW|j�dS)NrArrBFrCrDrEzfoo%08dz%drrG��aTrFr!rii��iii�)r"r#rrHrr'r,r$rIZassertRaisesZLargeZipFilerr-rJ)rrKrLr
Z	numfiles2rMrNrrr�testMoreThan64kFilesAppendrs>	$
	
	$
 z%OtherTests.testMoreThan64kFilesAppendcCstjt�tjt�dS)N)r�unlinkrr4)rrrrr<�s
zOtherTests.tearDownN)r=r>r?rOrRr<rrrrr@_s$r@�__main__i,)ZtestrZrequiresr"r8Zunittestr%r)�ior�tempfilerZtest.supportrrr4r&ZTestCaser
r@r=�mainrrrr�<module>s$
C;