HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/test/__pycache__/test_largefile.cpython-310.opt-2.pyc
o

�i�'�@s@	ddlZddlZddlZddlZddlZddlZddlZddlmZm	Z	ddlm
Z
ddlmZddlm
Z
mZddlZddlZdZe
dZGdd	�d	�ZGd
d�de�Zdd
�ZGdd�deej�Ze�eed�d�Gdd�deej��Zdd�ZGdd�deej�ZGdd�deej�Zdd�Ze dkr�e�!�dSdS)�N)�requires�
bigmemtest)�
SHORT_TIMEOUT)�
socket_helper)�TESTFN�unlinkly*�2c@s eZdZdd�Zedd��ZdS)�
LargeFileTestcCs�tj�t�r	d}nd}|�t|��N}t�|���tj}|t	dkr+	Wd�dS|dkr4|�
d�|�d�|�t	�|�
d�|��|�
t�|���tjt	d�Wd�dS1sbwYdS)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�0/usr/local/lib/python3.10/test/test_largefile.py�setUps �



""�zLargeFileTest.setUpcCsV|�td��Wd�n1swYt�t�tjdks%|�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@sLeZdZ	eeddd�dd��Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)�TestFileMethods�F)rZmemuse�dry_runcCs^|�td��}|�t|���td�|�|��td�Wd�dS1s(wYdS)N�rbr)rrr�len�readr�tell)r�_sizerrrr�test_large_read>s"�zTestFileMethods.test_large_readcCs |�t�t�tjtd�dS)Nr)rrrrrr�rrrr�test_osstatEs zTestFileMethods.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�dS1s�wYdS)Nr,rrr�*�Tr*����
r
)rrrr/r.rr�rrrrr�test_seek_readHs:


"�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�dS1s�wYdS)
Nr,rr4rr5r*r6r7r
)rrrr�lseekrrr.r8rrr�
test_lseekgs"" "�zTestFileMethods.test_lseekcCs6|�td���}t|d�st�d��|�dd�|�|��td�td}|�|�|�	�|�|��|�|�dd�|�|��|�|d8}|�d�|�	|�|�|��d�|�dd�|�|��|�|�d�|�	d�|�|��d�|�d�|�t
|���d�Wd�dS1s�wYdS)	Nr
�truncatez.open().truncate() not available on this systemrr*rr7r4)rr�hasattr�unittest�SkipTestrrr/rr<r-r.)rrZnewsizerrr�
test_truncatets.







"�zTestFileMethods.test_truncatec	CsRdD]$}|�td��}|�|�|�|���Wd�n1s!wYqdS)N)i���l�r,)rrrZ
assertTrue�seekable)r�posrrrr�
test_seekable�s
���zTestFileMethods.test_seekableN)r%r&r'rrr1r3r9r;r@rDrrrrr)7s

r)cs��fdd�}|S)Ncs���fdd�}|S)NcsHt�tj����j�krt�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�dS1s?wYdS)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.setUpcs0t���|jdur|j�|j�d|_dSdSr^)r_�tearDownr`�join�timeoutr2rarrrc�s



�zTestSocketSendfile.tearDowncsJ��fdd�}t���|��j�tj||fd��_�j�����dS)Nc
s�|�f|��\}}|��j�|�?ttd��*}���j�	|�d�}|s;	Wd�Wd�Wd�dS|�|�q1sDwYWd�n1sSwYWd�dSWd�dS1skwYdS)Nr!Ti)�accept�
settimeoutrerr"�wait�recvr)�sock�conn�_r�chunk��eventrrr�run�s"
��
	�0��"�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��"}ttd��
}|�|�Wd�n1s.wYWd�n1s=wYWd�n1sLwY|�	�t
j�t�}|�
t
j�t�|�ttd��!}|�
|�d�d�|�|d�|�
|��d�Wd�dS1s�wYdS)N�z	127.0.0.1r,rTrUrV)rZfind_unused_port�socket�
create_serverrw�create_connectionrrr\rcrrrWrr"r.r)r�portrj�clientrrrrrrY�s&
�����"�zTestSocketSendfile.test_it)r%r&r'rZr[rrrer rcrwrQrrrY�
__classcell__rrrarr]�s
r]c	Cs�zddl}|�|j|j�WnttfyYnwtjdd�dks(tjdkr3tddtt	��dSt
tddd�}z*z|�d	�|�
d
�|��WnttfyYt�d��wW|��tt�dS|��tt�w)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@�eZdZeej�ZdS)�CLargeFileTestN)r%r&r'rZr[rrrrrr��r�c@r�)�PyLargeFileTestN)r%r&r'rZ�pyiorrrrrr�r�r�cCstt�tt�dSr^)rrr"rrrr�tearDownModulesr��__main__)"rrr�r>ryrErrZtest.supportrrrrZtest.support.os_helperrrr[Z_pyior�rr"r	r)rQZTestCaserRZskipIfr=r]r�r�r�r�r%�mainrrrr�<module>s: e5$�