Your IP : 216.73.217.129


Current Path : /opt/alt/python36/lib64/python3.6/test/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/test/__pycache__/test_largefile.cpython-36.opt-2.pyc

3

��2aQ�@s�ddlZddlZddlZddlZddlmZmZmZmZddl	Z	ddl
ZdZGdd�d�Z
dd�ZGdd	�d	e
ej�ZGd
d�de
ej�Zdd
�Zedkr�ej�dS)�N)�TESTFN�requires�unlink�
bigmemtestly*c@s^eZdZdd�Zedd��Zeeddd�dd	��Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dS)�
LargeFileTestcCs�tjjt�rd}nd}|jt|���}tj|j��tj}|t	dkrHdS|dkrZ|j
d�|jd�|jt	�|j
d�|j�|j
tj|j��tjt	d�WdQRXdS)Nzr+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�3/opt/alt/python36/lib64/python3.6/test_largefile.py�setUps



zLargeFileTest.setUpc	Cs:|jtd��WdQRXtjt�tjdks6|jd��dS)N�wbrz0File was not truncated by opening with mode "wb")r
rr
rrZfailureException)�clsrrr�
tearDownClass(s
zLargeFileTest.tearDownClass�F)rZmemuseZdry_runcCsH|jtd��2}|jt|j��td�|j|j�td�WdQRXdS)N�rbr)r
rr�len�readr�tell)rZ_sizerrrr�test_large_read2szLargeFileTest.test_large_readcCs |jtjt�tjtd�dS)Nr)rr
rrrr)rrrr�test_osstat9szLargeFileTest.test_osstatcCs�|jtd����}|j|j�d�|j|jd�d�|j|j�d�|jd�|j|j�d�|jdd�|j|j�d�|jd�|j|j�d�|jdd�|j|j�d�|jdd�|j|j�d�|jdd�|j|j�d�|jdd�|j|j�tdd�|jd
d�|j|j�tdd�|jtdd�|j|j�d�|jt�|j|j�t�|j|jd�d	�|jtdd�|j|jd�d�|j|j�d�WdQRXdS)Nr!rrr�*�Tr �
r	i����)r
rrr$r#rr)rrrrr�test_seek_read<s8


zLargeFileTest.test_seek_readcCs|jtd����}|jtj|j�dd�d�|jtj|j�dd�d�|jtj|j�dd�d�|jtj|j�dd�d�|jtj|j�dd�tdd�|jtj|j�d	d�tdd�|jtj|j�tdd�d�|jtj|j�td�t�|j|jd�d�WdQRXdS)
Nr!rr'rr(r r)r	i����)r
rrr
�lseekrrr#)rrrrr�
test_lseek[s"" zLargeFileTest.test_lseekcCs"|jtd���
}t|d�s$tjd��|jdd�|j|j�td�td}|j|�|j	�|j|j�|�|jdd�|j|j�|�|d8}|jd�|j	|�|j|j�d�|jdd�|j|j�|�|jd�|j	d�|j|j�d�|jd�|jt
|j��d�WdQRXdS)	Nzr+b�truncatez.open().truncate() not available on this systemrr rr)r')r
r�hasattr�unittest�SkipTestrrr$rr-r"r#)rrZnewsizerrr�
test_truncatehs,







zLargeFileTest.test_truncatec
CsBx<d
D]4}|jtd��}|j|�|j|j��WdQRXqWdS)Nr �rr!l���l�)r3r4r5)r
rrZ
assertTrue�seekable)r�posrrrr�
test_seekable�s

zLargeFileTest.test_seekableN)�__name__�
__module__�__qualname__r�classmethodrrrr%r&r*r,r1r8rrrrrs

rcCs�yddl}|j|j|j�Wnttfk
r4YnXtjdd�dksRtjdkrftddtt	��njt
tddd�}zHy |jd	�|j
d
�|j�Wn"ttfk
r�tjd��YnXWd|j�tt�XdS)Nr��win�darwinZ	largefilez-test requires %s bytes and a long time to runr)�	bufferingl�xz*filesystem does not have largefile support)�signal�SIGXFSZ�SIG_IGN�ImportError�AttributeError�sys�platformr�strrr
rrrr�OSError�
OverflowErrorr/r0�closer)rBrrrr�setUpModule�s"

rMc@seZdZeej�ZdS)�CLargeFileTestN)r9r:r;�staticmethod�ior
rrrrrN�srNc@seZdZeej�ZdS)�PyLargeFileTestN)r9r:r;rO�pyior
rrrrrQ�srQcCstt�dS)N)rrrrrr�tearDownModule�srS�__main__)r
rrGr/Ztest.supportrrrrrPZ_pyiorRrrrMZTestCaserNrQrSr9�mainrrrr�<module>s$