HEX
Server: Apache
System: Linux opal14.opalstack.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
User: curbgloabal_opal (1234)
PHP: 8.1.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib64/python3.6/test/__pycache__/test_linecache.cpython-36.pyc
3


 \,�@s dZddlZddlZddlZddlZddlZddlmZej	Z
e
dZdZdZ
ejje	�Zdj�Zejje
�ZdZd	Zd
ZGdd�d�ZGd
d�de�ZGdd�de�ZGdd�deej�ZGdd�deej�ZGdd�deej�ZGdd�deej�ZGdd�dej�Ze dk�rej!�dS)z  Tests for the linecache module �N)�supportz.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)�TempFilec
sJt�j�tjdd��}|j|_|j|j�WdQRX|jt	j
|j�dS)NF)�delete)�super�setUp�tempfileZNamedTemporaryFile�name�	file_name�write�file_byte_string�
addCleanupr�unlink)�self�fp)�	__class__��&/usr/lib64/python3.6/test_linecache.pyr*s

zTempFile.setUp)�__name__�
__module__�__qualname__r�
__classcell__rr)rrr(srcs,eZdZ�fdd�Zdd�Zdd�Z�ZS)�GetLineTestsGoodDatacs"dj|j�jd�|_t�j�dS)Nrzutf-8)�join�	file_list�encoderrr)r)rrrr5szGetLineTestsGoodData.setUpcCsbtj|j��L}xDt|�D]8\}}|jd�s2|d7}tj|j|d�}|j||�qWWdQRXdS)N�
�)�tokenize�openr
�	enumerate�endswith�	linecache�getline�assertEqual)rr�index�lineZcached_linerrr�test_getline9s
z!GetLineTestsGoodData.test_getlinecCstj|j�}|j||j�dS)N)r"�getlinesr
r$r)r�linesrrr�
test_getlinesBsz"GetLineTestsGoodData.test_getlines)rrrrr'r*rrr)rrr2s	rc@seZdZdd�Zdd�ZdS)�GetLineTestsBadDatacCs|jttftj|jd�dS)Nr)�assertRaises�SyntaxError�UnicodeDecodeErrorr"r#r
)rrrrr'Js
z GetLineTestsBadData.test_getlinecCs|jttftj|j�dS)N)r,r-r.r"r(r
)rrrrr*Ns
z!GetLineTestsBadData.test_getlinesN)rrrr'r*rrrrr+Gsr+c@seZdZgZdS)�	EmptyFileN)rrrrrrrrr/Ssr/c@seZdZdgZdS)�SingleEmptyLinerN)rrrrrrrrr0Wsr0c@seZdZddddgZdS)�GoodUnicodeuá
zb
zabcdef
uááááá
N)rrrrrrrrr1[sr1c@seZdZdZdS)�
BadUnicodes�abcN)rrrrrrrrr2_sr2c@sdeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�LineCacheTestscCs�tj}|j|td�t�|j|td�t�|jt|td�|j|td�t�|j|td�t�x^tD]V}t	j
jt|�d}t
|��2}x*t|�D]\}}|j||||d��q�WWdQRXqdWtjd�}|j|g�dS)	N��rg�������?z.pyza/b/c/__init__.pyi����)r"r#r$�FILENAME�EMPTYr,�	TypeError�INVALID_NAME�MODULES�os�pathr�MODULE_PATHrr r()rr#�entry�filename�filer%r&�emptyrrrr'es

(
zLineCacheTests.test_getlinecCsT|jtjtj�ttjd��}|jt�WdQRXtjtj�}|j	|dddg�dS)N�wrz	def f():
z
    return 3
)
r
rr�TESTFNrr�SOURCE_3r"r(r$)rrr)rrr�test_no_ending_newline~s
z%LineCacheTests.test_no_ending_newlinecCs�g}x4tD],}tjjt|�d}|j|�tj|d�q
W|j|g�dd�|D�}|j	|g�tj
�dd�|D�}|j	|g�dS)Nz.pyrcSsg|]}|tjkr|�qSr)r"�cache)�.0�fnrrr�
<listcomp>�sz2LineCacheTests.test_clearcache.<locals>.<listcomp>cSsg|]}|tjkr|�qSr)r"rG)rHrIrrrrJ�s)r;r<r=rr>�appendr"r#ZassertNotEqualr$�
clearcache)r�cachedr?r@Zcached_emptyrrr�test_clearcache�s

zLineCacheTests.test_clearcachec#CsFtj}tjd}|jtj|�t|d��}|jt�WdQRX||d�g}t|��<}x4t	|�D](\}}|j
||||d��|j|�q`WWdQRXt|d��}|jt�WdQRXtj
d�x*t	|�D]\}}|j
||||d��q�Wtj
|�t|��>}x6t	|�D]*\}}|j
||||d��|j|��q
WWdQRXdS)Nz.pyrCrZdummy)r"r#rrDr
rrr�SOURCE_1r r$rK�SOURCE_2�
checkcache)rr#Zsource_name�sourceZsource_listr%r&rrr�test_checkcache�s*





zLineCacheTests.test_checkcachecCs<tjt�}tj�|jdtjtd��|j|tjt��dS)NF)r"r(r7rLr$�	lazycache)rr)rrr�test_lazycache_no_globals�s
z(LineCacheTests.test_lazycache_no_globalscCsXtjtt��}tj�|jdtjtt���|jdttjt��|j|tjt��dS)NTr)	r"r(�NONEXISTENT_FILENAME�globalsrLr$rT�lenrG)rr)rrr�test_lazycache_smoke�sz#LineCacheTests.test_lazycache_smokecCsLtj�tjtt��}tj�tjt�tjtt��|j|tjt��dS)N)r"rLr(rVrWrTr$�updatecache)rr)rrr�*test_lazycache_provide_after_failed_lookup�s
z9LineCacheTests.test_lazycache_provide_after_failed_lookupcCs"tj�tjtt��tj�dS)N)r"rLrTrVrWrQ)rrrr�test_lazycache_check�sz#LineCacheTests.test_lazycache_checkcCs8tj�|jdtjdt���|jdtjdt���dS)NFrz<foo>)r"rLr$rTrW)rrrr�test_lazycache_bad_filename�sz*LineCacheTests.test_lazycache_bad_filenamecCsFtj�tjtt��}|jdtjtt���|jdttjt��dS)NF�)	r"rLr(rVrWr$rTrXrG)rr)rrr�test_lazycache_already_cached�sz,LineCacheTests.test_lazycache_already_cachedcCs�tjt�}|j|�dd�}tjtd|��tjt�}WdQRX|j||�tj�tjtd|��tjt�}WdQRX|j|g�|jtjt�|�dS)Nc_st�dS)N)�MemoryError)�args�kwargsrrr�raise_memoryerror�sz:LineCacheTests.test_memoryerror.<locals>.raise_memoryerrorrZ)r"r(r7Z
assertTruerZ	swap_attrr$rL)rr)rcZlines2Zlines3rrr�test_memoryerror�s

zLineCacheTests.test_memoryerrorN)rrrr'rFrNrSrUrYr[r\r]r_rdrrrrr3cs!
r3�__main__)"�__doc__r"ZunittestZos.pathr<rrZtestr�__file__r7rVr:r8r=�dirnameZ	TEST_PATH�splitr;r>rOrPrErrr+ZTestCaser/r0r1r2r3r�mainrrrr�<module>s6