Your IP : 216.73.216.213


Current Path : /proc/242857/root/opt/alt/python34/lib64/python3.4/test/__pycache__/
Upload File :
Current File : //proc/242857/root/opt/alt/python34/lib64/python3.4/test/__pycache__/test_largefile.cpython-34.pyo

�
g f��@s�dZddlZddlZddlZddlZddlmZmZmZddl	Z	ddl
ZdZGdd�d�Z
dd�ZGd	d
�d
e
ej�ZGdd�de
ej�Zd
d�Zedkr�ej�ndS)z9Test largefile support on system where this makes sense.
�N)�TESTFN�requires�unlinkly*c@speZdZdZdd�Zedd��Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�ZdS)�
LargeFileTestzUTest that each file function works as expected for large
    (i.e. > 2GB) files.
    cCs�tjjt�rd}nd}|jt|���}tj|j��tj}|t	dkrfdS|dkr�|j
d�n|jd�|jt	�|j
d�|j�|j
tj|j��tjt	d�WdQXdS)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�8/opt/alt/python34/lib64/python3.4/test/test_largefile.py�setUps	



zLargeFileTest.setUpcCsK|jtd��WdQXtjt�tjdksG|jd��ndS)N�wbrz0File was not truncated by opening with mode "wb")rrr	rrZfailureException)�clsrrr�
tearDownClass(szLargeFileTest.tearDownClasscCs(|jtjt�tjtd�dS)Nr)rr	rrrr)rrrr�test_osstat0szLargeFileTest.test_osstatcCsI|jtd��1}|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�WdQXdS)N�rbrrr�*�T��
ri����)rrr�tell�readrr)rrrrr�test_seek_read3s8


zLargeFileTest.test_seek_readcCsu|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�WdQXdS)
Nr rr!rr"r#r$ri����)rrrr	�lseekrrr&)rrrrr�
test_lseekRs%%%%--*%zLargeFileTest.test_lseekcCs�|jtd��h}t|d�s6tjd��n|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�WdQXdS)	Nzr+b�truncatez.open().truncate() not available on this systemrr#rr$r!)rr�hasattr�unittest�SkipTestrrr%rr*�lenr&)rrZnewsizerrr�
test_truncate_s,








zLargeFileTest.test_truncatec
CsPxId
D]A}|jtd��'}|j|�|j|j��WdQXqWdS)Nr#�rr l���l�)r1r2r3)rrrZ
assertTrue�seekable)r�posrrrr�
test_seekable~s

zLargeFileTest.test_seekableN)�__name__�
__module__�__qualname__�__doc__r�classmethodrrr'r)r/r6rrrrrs
rcCs
y&ddl}|j|j|j�Wnttfk
r@YnXtjdd�dksitjdkr�tddtt	��n�t
tddd�}zVy(|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,r-�closer)rArrrr�setUpModule�s"(


rLc@seZdZeej�ZdS)�CLargeFileTestN)r7r8r9�staticmethod�iorrrrrrM�srMc@seZdZeej�ZdS)�PyLargeFileTestN)r7r8r9rN�pyiorrrrrrP�srPcCstt�dS)N)rrrrrr�tearDownModule�srR�__main__)r:r	rrFr,Ztest.supportrrrrOZ_pyiorQrrrLZTestCaserMrPrRr7�mainrrrr�<module>sw$