Uname:Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64

403WebShell
403Webshell
Server IP : 3.111.61.48  /  Your IP : 216.73.216.67
Web Server : Apache
System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.2.31
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3.10/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.10/test/__pycache__/test_linecache.cpython-310.pyc
o

�9j�&�@sTdZddlZddlZddlZddlZddlZddlmZddl	m
Z
ejZedZ
dZdZej�e�Zd��Zej�e�Zd	Zd
ZdZGdd
�d
�ZGdd�de�ZGdd�de�ZGdd�deej�ZGdd�deej�ZGdd�deej�ZGdd�deej�Z Gdd�deej�Z!Gdd�dej�Z"Gdd�dej�Z#e$d kr�e�%�dSdS)!z  Tests for the linecache module �N)�support)�	os_helperz.missingz
!@$)(!@#_1�z
linecache abcz3
" Docstring "

def function():
    return result

z%
def f():
    return 1 + 1

a = f()

z
def f():
    return 3cseZdZ�fdd�Z�ZS)�TempFilecs^t���tjdd��}|j|_|�|j�Wd�n1s wY|�t	j
|j�dS)NF)�delete)�super�setUp�tempfile�NamedTemporaryFile�name�	file_name�write�file_byte_string�
addCleanupr�unlink)�self�fp��	__class__��*/usr/lib/python3.10/test/test_linecache.pyr+s
�zTempFile.setUp)�__name__�
__module__�__qualname__r�
__classcell__rrrrr)srcs,eZdZ�fdd�Zdd�Zdd�Z�ZS)�GetLineTestsGoodDatacs"d�|j��d�|_t���dS)Nr�utf-8)�join�	file_list�encoderrr�rrrrr6szGetLineTestsGoodData.setUpcCstt�|j��*}t|�D]\}}|�d�s|d7}t�|j|d�}|�||�qWd�dS1s3wYdS)N�
�)�tokenize�openr�	enumerate�endswith�	linecache�getline�assertEqual)rr�index�line�cached_linerrr�test_getline:s
�"�z!GetLineTestsGoodData.test_getlinecCst�|j�}|�||j�dS�N)r'�getlinesrr)r�r�linesrrr�
test_getlinesCsz"GetLineTestsGoodData.test_getlines)rrrrr-r2rrrrrr3s	rc@seZdZdd�Zdd�ZdS)�GetLineTestsBadDatacCs|�t�|jd�d�dS)Nr"r)r)r'r(rr rrrr-Ksz GetLineTestsBadData.test_getlinecCs|�t�|j�g�dSr.)r)r'r/rr rrrr2Nsz!GetLineTestsBadData.test_getlinesN)rrrr-r2rrrrr3Hsr3c@seZdZgZdS)�	EmptyFileN�rrrrrrrrr4R�r4c@seZdZdgZdS)�SingleEmptyLiner!Nr5rrrrr7Vs
r7c@seZdZgd�ZdS)�GoodUnicode)uá
zb
zabcdef
uááááá
Nr5rrrrr8Zsr8c@�eZdZdZdS)�BadUnicode_NoDeclarations
�abcN�rrrrrrrrr:]r6r:c@r9)�BadUnicode_WithDeclarations# coding=utf-8
�abcNr;rrrrr<`r6r<c@sdeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�LineCacheTestsc
Cs�tj}|�|td�t�|�|td�t�|�t|td�|�|td�t�|�|td�t�tD]5}t	j
�t|�d}t
|dd��}t|�D]\}}|�||||d��qGWd�n1sawYq1t�d�}|�|g�dS)	Ni����g�������?r"�.pyr��encodingza/b/c/__init__.py)r'r(r)�FILENAME�EMPTY�assertRaises�	TypeError�INVALID_NAME�MODULES�os�pathr�MODULE_PATHr$r%r/)rr(�entry�filename�filer*r+�emptyrrrr-fs ���
zLineCacheTests.test_getlinecCsj|�tjtj�ttjddd��
}|�t�Wd�n1s wYt�tj�}|�	|gd��dS)N�wrr@)r!z	def f():
z
    return 3
)
rrr�TESTFNr$r
�SOURCE_3r'r/r))rrr1rrr�test_no_ending_newlines�z%LineCacheTests.test_no_ending_newlinecCs�g}tD]}tj�t|�d}|�|�t�|d�q|�|g�dd�|D�}|�	|g�t�
�dd�|D�}|�	|g�dS)Nr?r"cSsg|]	}|tjvr|�qSr�r'�cache��.0�fnrrr�
<listcomp>��z2LineCacheTests.test_clearcache.<locals>.<listcomp>cSsg|]	}|tjvr|�qSrrSrUrrrrX�rY)rGrHrIrrJ�appendr'r(�assertNotEqualr)�
clearcache)r�cachedrKrL�cached_emptyrrr�test_clearcache�s
zLineCacheTests.test_clearcachec	Cs�tj}tjd}|�tj|�t|ddd��
}|�t�Wd�n1s&wY||d�g}t|dd��!}t	|�D]\}}|�
||||d��|�|�q=Wd�n1s\wYt|ddd��
}|�t�Wd�n1sxwYt�
d�t	|�D]\}}|�
||||d��q�t�
|�t|dd��"}t	|�D]\}}|�
||||d��|�|�q�Wd�dS1s�wYdS)Nr?rOrr@r"�dummy)r'r(rrPrrr$r
�SOURCE_1r%r)rZ�SOURCE_2�
checkcache)rr(�source_name�source�source_listr*r+rrr�test_checkcache�s6
�
���

�"�zLineCacheTests.test_checkcachecCs<t�t�}t��|�dt�td��|�|t�t��dS)NF)r'r/rBr\r)�	lazycacher0rrr�test_lazycache_no_globals�s
z(LineCacheTests.test_lazycache_no_globalscCsXt�tt��}t��|�dt�tt���|�dttjt��|�|t�t��dS)NTr")	r'r/�NONEXISTENT_FILENAME�globalsr\r)rh�lenrTr0rrr�test_lazycache_smoke�s�z#LineCacheTests.test_lazycache_smokecCsLt��t�tt��}t��t�t�t�tt��|�|t�t��dSr.)r'r\r/rjrkrhr)�updatecacher0rrr�*test_lazycache_provide_after_failed_lookup�s
z9LineCacheTests.test_lazycache_provide_after_failed_lookupcCs"t��t�tt��t��dSr.)r'r\rhrjrkrcr rrr�test_lazycache_check�sz#LineCacheTests.test_lazycache_checkcCs8t��|�dt�dt���|�dt�dt���dS)NFrz<foo>)r'r\r)rhrkr rrr�test_lazycache_bad_filename�sz*LineCacheTests.test_lazycache_bad_filenamecCsFt��t�tt��}|�dt�tt���|�dttjt��dS)NF�)	r'r\r/rjrkr)rhrlrTr0rrr�test_lazycache_already_cached�s�z,LineCacheTests.test_lazycache_already_cachedcCs�t�t�}|�|�dd�}t�td|��
t�t�}Wd�n1s%wY|�||�t��t�td|��
t�t�}Wd�n1sKwY|�|g�|�t�t�|�dS)Nc_st�r.)�MemoryError)�args�kwargsrrr�raise_memoryerror�sz:LineCacheTests.test_memoryerror.<locals>.raise_memoryerrorrn)r'r/rB�
assertTruer�	swap_attrr)r\)rr1rw�lines2�lines3rrr�test_memoryerror�s

��zLineCacheTests.test_memoryerrorN)rrrr-rRr_rgrirmrorprqrsr|rrrrr=ds!
r=cs4eZdZ�fdd�Zdd�Zdd�Zdd�Z�ZS)	�LineCacheInvalidationTestsc	st���t��tjd|_tjd|_tjd|_|j|j|jfD]<}|�	tj
|�t|ddd��}|�d|�d��Wd�n1sGwY|�
|tj�t�|�|�|tj�q#t�|j�t|jddd��}|�d	�Wd�dS1swYdS)
Nz.1z.2z.3rOrr@zprint("I am z")zprint("was modified"))rrr'r\rrP�deleted_file�
modified_file�unchanged_filerrr$r
�assertNotInrTr/�assertInrH�remove)r�fnamererrrr�s(
��
"�z LineCacheInvalidationTests.setUpcCs@t�|j�|�|jtj�|�|jtj�|�|jtj�dSr.)r'rcr~r�rTr�rr�r rrr� test_checkcache_for_deleted_file	�z;LineCacheInvalidationTests.test_checkcache_for_deleted_filecCs@t�|j�|�|jtj�|�|jtj�|�|jtj�dSr.)r'rcrr�r~rTr�r�r rrr�!test_checkcache_for_modified_filer�z<LineCacheInvalidationTests.test_checkcache_for_modified_filecCs<t��|�|jtj�|�|jtj�|�|jtj�dSr.)r'rcr�r~rTrr�r�r rrr�!test_checkcache_with_no_parametersz<LineCacheInvalidationTests.test_checkcache_with_no_parameter)rrrrr�r�r�rrrrrr}�s
r}�__main__)&�__doc__r'�unittest�os.pathrHr	r#�testr�test.supportr�__file__rBrjrFrCrI�dirname�	TEST_PATH�splitrGrJrarbrQrrr3�TestCaser4r7r8r:r<r=r}r�mainrrrr�<module>s@

*�

Youez - 2016 - github.com/yon3zu
LinuXploit