Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.9/test/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.9/test/__pycache__/test_largefile.cpython-39.opt-2.pyc

a

��g�'�@s4ddlZddlZddlZddlZddlZddlZddlZddlmZm	Z	m
Z
mZddlmZddlm
Z
ddlZddlZdZedZGdd�d�ZGd	d
�d
e�Zdd�ZGd
d�deej�Ze�eed�d�Gdd�deej��Zdd�ZGdd�deej�ZGdd�deej�Zdd�Zedk�r0e� �dS)�N)�TESTFN�requires�unlink�
bigmemtest)�
SHORT_TIMEOUT)�
socket_helperly*�2c@s eZdZdd�Zedd��ZdS)�
LargeFileTestcCs�tj�t�rd}nd}|�t|���}t�|���tj}|t	dkrTWd�dS|dkrf|�
d�|�d�|�t	�|�
d�|��|�
t�|���tjt	d�Wd�n1s�0YdS)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�//usr/local/lib/python3.9/test/test_largefile.py�setUps



zLargeFileTest.setUpcCsV|�td��Wd�n1s"0Yt�t�tjdksJ|�d��tt�dS)N�wbrz0File was not truncated by opening with mode "wb")rrrrrZfailureExceptionr�TESTFN2)�clsrrr�
tearDownClass,s

zLargeFileTest.tearDownClassN)�__name__�
__module__�__qualname__r �classmethodr$rrrrr	sr	c@sJeZdZeeddd�dd��Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)�TestFileMethods�F)rZmemuse�dry_runcCs\|�td��<}|�t|���td�|�|��td�Wd�n1sN0YdS)N�rbr)rrr�len�readr�tell)r�_sizerrrr�test_large_read=szTestFileMethods.test_large_readcCs |�t�t�tjtd�dS)Nr)rrrrrr�rrrr�test_osstatDszTestFileMethods.test_osstatcCs�|�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�Wd�n1�s�0YdS)Nr,rrr�*�Tr*����
r
)rrrr/r.rr�rrrrr�test_seek_readGs8


zTestFileMethods.test_seek_readcCs,|�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	�Wd�n1�s0YdS)
Nr,rr4rr5r*r6r7r
)rrrr�lseekrrr.r8rrr�
test_lseekfs"" zTestFileMethods.test_lseekcCs8|�td���}t|d�s$t�d��|�dd�|�|��td�td}|�|�|�	�|�|��|�|�dd�|�|��|�|d8}|�d�|�	|�|�|��d�|�dd�|�|��|�|�d�|�	d�|�|��d�|�d�|�t
|���d�Wd�n1�s*0YdS)	Nr
�truncatez.open().truncate() not available on this systemrr*rr7r4)rr�hasattr�unittest�SkipTestrrr/rr<r-r.)rrZnewsizerrr�
test_truncatess,







zTestFileMethods.test_truncatec	CsRdD]H}|�td��(}|�|�|�|���Wd�q1sB0YqdS)N)i���l�r,)rrrZ
assertTrue�seekable)r�posrrrr�
test_seekable�s
zTestFileMethods.test_seekableN)r%r&r'rrr1r3r9r;r@rDrrrrr)6s

r)cs��fdd�}|S)Ncs���fdd�}|S)NcsHt�tj����j�kr:t�dd�}t�d|�d����|i|��S)Niz	required z MiB of free disk space)	�shutil�
disk_usagerr�realpath�free�intr>r?)�args�kwargsZhsize)�funr�requiredrr�wrapper�s
�z6skip_no_disk_space.<locals>.decorator.<locals>.wrapperr)rLrN�rrM)rLr�	decorator�sz%skip_no_disk_space.<locals>.decoratorr)rrMrPrrOr�skip_no_disk_space�srQc@s,eZdZeej�Zeeed�dd��Z	dS)�TestCopyfile�@cCs�tj�t�}t�tt�|�tj�t�|�ttd��@}|�|�	d�d�|�
|d�|�|�	�d�Wd�n1s|0YdS)Nr,��z�a)rr�getsizerrE�copyfiler"rrr.r)rrrrrr�test_it�szTestCopyfile.test_itN)
r%r&r'�staticmethod�iorrQrrrYrrrrrR�s
rR�sendfilezsendfile not supportedcsTeZdZeej�ZeZ�fdd�Z�fdd�Z	dd�Z
eee
d�dd	��Z�ZS)
�TestSocketSendfilecst���d|_dS�N)�superr �threadr2��	__class__rrr �s
zTestSocketSendfile.setUpcs,t���|jdur(|j�|j�d|_dSr^)r_�tearDownr`�join�timeoutr2rarrrc�s

zTestSocketSendfile.tearDowncsJ��fdd�}t���|��j�tj||fd��_�j�����dS)Nc
s�|��|��\}}|��j�|��ttd��^}���j�|�d�}|srWd�Wd�Wd�dS|�|�q<Wd�n1s�0YWd�n1s�0YWd�n1s�0YdS)Nr!i)�accept�
settimeoutrerr"�wait�recvr)�sock�conn�_r�chunk��eventrrr�run�s
(z*TestSocketSendfile.tcp_server.<locals>.run)�targetrJ)�	threading�Eventrgre�Threadr`�start�set)rrjrprrnr�
tcp_server�s
zTestSocketSendfile.tcp_serverrSc
Cs*t��}t�d|f��|}|�|�t�d|f��D}ttd��}|�|�Wd�n1s\0YWd�n1sz0YWd�n1s�0Y|�	�t
j�t�}|�
t
j�t�|�ttd��@}|�
|�d�d�|�|d�|�
|��d�Wd�n1�s0YdS)N�z	127.0.0.1r,rTrUrV)rZfind_unused_port�socket�
create_serverrw�create_connectionrrr\rcrrrWrr"r.r)r�portrj�clientrrrrrrY�s
dzTestSocketSendfile.test_it)r%r&r'rZr[rrrer rcrwrQrrrY�
__classcell__rrrarr]�s
r]c	Cs�zddl}|�|j|j�Wnttfy2Yn0tjdd�dksPtjdkrdtddtt	��nxt
tddd�}zVz |�d	�|�
d
�|��Wn ttfy�t�d��Yn0W|��tt�n|��tt�0dS)Nr��win�darwinZ	largefilez-test requires %s bytes and a long time to runr!)�	bufferingrA�xz*filesystem does not have largefile support)�signal�SIGXFSZ�SIG_IGN�ImportError�AttributeError�sys�platformr�strrrrrrr�OSError�
OverflowErrorr>r?�closer)r�rrrr�setUpModule�s(
�


�r�c@seZdZeej�ZdS)�CLargeFileTestN)r%r&r'rZr[rrrrrr�sr�c@seZdZeej�ZdS)�PyLargeFileTestN)r%r&r'rZ�pyiorrrrrr�sr�cCstt�tt�dSr^)rrr"rrrr�tearDownModulesr��__main__)!rrr�r>ryrErrZtest.supportrrrrrrr[Z_pyior�rr"r	r)rQZTestCaserRZskipIfr=r]r�r�r�r�r%�mainrrrr�<module>s2 e5$


Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists