Your IP : 216.73.216.60


Current Path : /opt/alt/python38/lib64/python3.8/test/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/test/__pycache__/test_largefile.cpython-38.opt-2.pyc

U

i�fS�@s�ddlZddlZddlZddlZddlmZmZmZmZddl	Z	ddl
ZdZGdd�d�Z
dd�ZGdd	�d	e
ej�ZGd
d�de
ej�Zdd
�Zedkr�e��dS)�N)�TESTFN�requires�unlink�
bigmemtestly*c@s^eZdZdd�Zedd��Zeeddd�dd	��Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dS)�
LargeFileTestc	Cs�tj�t�rd}nd}|�t|���}t�|���tj}|t	dkrRW5QR�dS|dkrd|�
d�|�d�|�t	�|�
d�|��|�
t�|���tjt	d�W5QRXdS)N�r+bzw+b�r�z�a)�os�path�existsr�open�fstat�fileno�stat�ST_SIZE�size�write�seek�flush�assertEqual)�self�mode�fZcurrent_size�r�8/opt/alt/python38/lib64/python3.8/test/test_largefile.py�setUps



zLargeFileTest.setUpc	Cs:|�td��W5QRXt�t�tjdks6|�d��dS)N�wbrz0File was not truncated by opening with mode "wb")rrrrrZfailureException)�clsrrr�
tearDownClass(s
zLargeFileTest.tearDownClass�F)rZmemuseZdry_runc	CsH|�td��2}|�t|���td�|�|��td�W5QRXdS)N�rbr)rrr�len�readr�tell)rZ_sizerrrr�test_large_read2szLargeFileTest.test_large_readcCs |�t�t�tjtd�dS)Nr)rrrrrr)rrrr�test_osstat9szLargeFileTest.test_osstatc	Cs�|�td����}|�|��d�|�|�d�d�|�|��d�|�d�|�|��d�|�dd�|�|��d�|�d�|�|��d�|�dd�|�|��d�|�dd�|�|��d�|�dd�|�|��d�|�dd�|�|��tdd�|�dd�|�|��tdd	�|�tdd�|�|��d�|�t�|�|��t�|�|�d�d
�|�tdd�|�|�d�d�|�|��d�W5QRXdS)Nr"rrr	�*�Tr!����
r
)rrrr%r$rr�rrrrr�test_seek_read<s8


zLargeFileTest.test_seek_readc	Cs|�td���}|�t�|��dd�d�|�t�|��dd�d�|�t�|��dd�d�|�t�|��dd�d�|�t�|��dd�tdd�|�t�|��dd�tdd�|�t�|��tdd�d�|�t�|��td�t�|�|�d�d	�W5QRXdS)
Nr"rr(rr)r!r*r+r
)rrrr�lseekrrr$r,rrr�
test_lseek[s"" zLargeFileTest.test_lseekc	Cs"|�td���
}t|d�s$t�d��|�dd�|�|��td�td}|�|�|�	�|�|��|�|�dd�|�|��|�|d8}|�d�|�	|�|�|��d�|�dd�|�|��|�|�d�|�	d�|�|��d�|�d�|�t
|���d�W5QRXdS)	Nr�truncatez.open().truncate() not available on this systemrr!rr+r()rr�hasattr�unittest�SkipTestrrr%rr0r#r$)rrZnewsizerrr�
test_truncatehs,







zLargeFileTest.test_truncatec
Cs>dD]4}|�td��}|�|�|�|���W5QRXqdS)N)i���l�r")rrrZ
assertTrue�seekable)r�posrrrr�
test_seekable�s
zLargeFileTest.test_seekableN)�__name__�
__module__�__qualname__r�classmethodr rrr&r'r-r/r4r8rrrrrs
	

rc	Cs�zddl}|�|j|j�Wnttfk
r4YnXtjdd�dksRtjdkrftddtt	��njt
tddd�}zHz |�d	�|�d
�|��Wn"ttfk
r�t�d��YnXW5|��t
t�XdS)Nr��win�darwinZ	largefilez-test requires %s bytes and a long time to runr)�	bufferingr5�xz*filesystem does not have largefile support)�signal�SIGXFSZ�SIG_IGN�ImportError�AttributeError�sys�platformr�strrrr�closerrrr�OSError�
OverflowErrorr2r3)rBrrrr�setUpModule�s$
�

rMc@seZdZeej�ZdS)�CLargeFileTestN)r9r:r;�staticmethod�iorrrrrrN�srNc@seZdZeej�ZdS)�PyLargeFileTestN)r9r:r;rO�pyiorrrrrrQ�srQcCstt�dS)N)rrrrrr�tearDownModule�srS�__main__)rrrGr2Ztest.supportrrrrrPZ_pyiorRrrrMZTestCaserNrQrSr9�mainrrrr�<module>s$