Your IP : 216.73.216.213


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.pyc

U

i�fS�@s�dZddlZddlZddlZddlZddlmZmZmZm	Z	ddl
Z
ddlZdZ
Gdd�d�Zdd�ZGd	d
�d
eej�ZGdd�deej�Zd
d�Zedkr�e��dS)z9Test largefile support on system where this makes sense.
�N)�TESTFN�requires�unlink�
bigmemtestly*c@sbeZdZdZdd�Zedd��Zeeddd�d	d
��Z	dd�Z
d
d�Zdd�Zdd�Z
dd�ZdS)�
LargeFileTestzWTest that each file function works as expected for large
    (i.e. > 2 GiB) files.
    c	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__�__doc__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)rCrrrr�setUpModule�s$
�

rNc@seZdZeej�ZdS)�CLargeFileTestN)r9r:r;�staticmethod�iorrrrrrO�srOc@seZdZeej�ZdS)�PyLargeFileTestN)r9r:r;rP�pyiorrrrrrR�srRcCstt�dS)N)rrrrrr�tearDownModule�srT�__main__)r<rrrHr2Ztest.supportrrrrrQZ_pyiorSrrrNZTestCaserOrRrTr9�mainrrrr�<module>s $