Your IP : 216.73.216.196


Current Path : /opt/alt/python310/lib64/python3.10/test/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/test/__pycache__/test_zipfile64.cpython-310.pyc

o

0�io�@s�ddlmZe�dd�ddlZddlZddlZddlZddlZddlm	Z	ddl
mZddl
mZej
Z
e
dZd	ZGd
d�dej�ZGdd
�d
ej�ZedkrWe��dSdS)�)�supportZextralargefilez>test requires loads of disk-space bytes and a long time to runN)�
TemporaryFile)�	os_helper)�
requires_zlib�2�<c@s:eZdZdd�Zdd�Zdd�Ze�dd��Zd	d
�ZdS)�TestsWithSourceFilecCs`dd�td�D�}d�|��d�|_ttd��}|�|j�Wd�dS1s)wYdS)Ncss�|]}d|VqdS)zTest of zipfile line %d.N�)�.0�ir	r	�:/opt/alt/python310/lib64/python3.10/test/test_zipfile64.py�	<genexpr> s�z,TestsWithSourceFile.setUp.<locals>.<genexpr>i@B�
�ascii�wb)�range�join�encode�data�open�TESTFN�write)�selfZline_gen�fpr	r	r�setUps
"�zTestsWithSourceFile.setUpcCs2t�|d|��A}dt|j�}t��t}t|�D]'}|�d||j�|t��kr@t��t}t	d||ft
jd�t
j��qWd�n1sKwYt�|d|��8}t|�D]*}|�
|�d|�|j�|t��kr�t��t}t	d||ft
jd�t
j��q\Wd�dS1s�wYdS)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�fZcompressionZzipfpZ	filecountZ	next_timeZnumr	r	r�zipTest's@��
�����
��"�zTestsWithSourceFile.zipTestcC�Rt��}|�|tj�|�|j�Wd�n1swY|�ttj�dS�N)rr,rZ
ZIP_STORED�assertFalse�closed�TESTFN2�rr+r	r	r�
testStoredFs
�zTestsWithSourceFile.testStoredcCr-r.)rr,rZZIP_DEFLATEDr/r0r1r2r	r	r�testDeflatedNs
�z TestsWithSourceFile.testDeflatedcCs(ttfD]
}tj�|�rt�|�qdSr.)rr1�os�path�exists�remove)rZfnamer	r	r�tearDownWs

��zTestsWithSourceFile.tearDownN)	�__name__�
__module__�__qualname__rr,r3rr4r9r	r	r	rrs	
rc@s$eZdZdd�Zdd�Zdd�ZdS)�
OtherTestscCs�tjtddd��,}d|_d}t|�D]}|�d|d|dd	�q|�t|���|�Wd�n1s7wYtjtd
d��0}|�t|���|�t|�D]}|�	d|��
d�}|�|d|dd	�qRWd�dS1svwYdS)
NrT��modeZ
allowZip64�d���foo%08d�%d��9r�r?r)rrr�debugrr$r)r �namelistr*�decode)r�zipf�numfilesr�zipf2�contentr	r	r�testMoreThan64kFiles^s��"�zOtherTests.testMoreThan64kFilesc	Csvtjtddd��T}d|_d}t|�D]}|�d|d|dd	�q|�t|���|�|�	tj
��|�d|d
�Wd�n1sFwY|�t|���|�Wd�n1s_wYtjtddd��=}d|_|�t|���|�|�	tj
��|�d|d
�Wd�n1s�wY|�t|���|�Wd�n1s�wYtjtddd��7}d|_|�t|���|�d
}t||�D]}|�d|d|dd	�q�|�t|���|�Wd�n1s�wYtjtdd��1}|�t|���|�t|�D]}|�d|��d�}|�|d|dd	��qWd�dS1�s4wYdS)NrFr>r@i��rBrCrDrE��aTrArrFr)
rrrrGrr$r)r rHZassertRaisesZLargeZipFiler*rI)rrJrKrZ	numfiles2rLrMr	r	r�testMoreThan64kFilesAppendnsD��
����$�z%OtherTests.testMoreThan64kFilesAppendcCst�t�t�t�dSr.)r�unlinkrr1)rr	r	rr9�s
zOtherTests.tearDownN)r:r;r<rNrQr9r	r	r	rr=]s r=�__main__)�testrZrequiresrr5Zunittestr!r&ZtempfilerZtest.supportrrrr1r#ZTestCaserr=r:�mainr	r	r	r�<module>s&�@5�