Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/test/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/test/__pycache__/test_largefile.cpython-35.opt-2.pyc



���]��@s�ddlZddlZddlZddlZddlmZmZmZddlZddl	Z
dZGdd�d�Zdd�Z
Gdd	�d	eej�ZGd
d�deej�Zdd
�Zedkr�ej�dS)�N)�TESTFN�requires�unlinkly*c@sjeZdZdd�Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dS)�
LargeFileTestcCs�tjjt�rd}nd}|jt|���}tj|j��tj}|t	dkrfdS|dkr|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/python35/lib64/python3.5/test_largefile.py�setUps	




zLargeFileTest.setUpc	CsI|jtd��WdQRXtjt�tjdksE|jd��dS)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_osstatcCsJ|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�WdQRXdS)N�rbrrr�*�T��
ri����)rrr�tell�readrr)rrrrr�test_seek_read3s8


zLargeFileTest.test_seek_readcCsv|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$ri����)rrrr	�lseekrrr&)rrrrr�
test_lseekRs%%%%--*%zLargeFileTest.test_lseekcCs~|jtd��e}t|d�s3tjd��|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*�lenr&)rrZnewsizerrr�
test_truncate_s,








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

zLargeFileTest.test_seekableN)�__name__�
__module__�__qualname__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)r@rrrr�setUpModule�s"(


rKc@seZdZeej�ZdS)�CLargeFileTestN)r7r8r9�staticmethod�iorrrrrrL�srLc@seZdZeej�ZdS)�PyLargeFileTestN)r7r8r9rM�pyiorrrrrrO�srOcCstt�dS)N)rrrrrr�tearDownModule�srQ�__main__)r	rrEr,Ztest.supportrrrrNZ_pyiorPrrrKZTestCaserLrOrQr7�mainrrrr�<module>sw$