Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.11/test/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.11/test/__pycache__/test_linecache.cpython-311.opt-2.pyc

�

SԚg),����	ddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZejZ
e
dzZdZdZej�e��Zd���Zej�e
��Zd	Zd
ZdZGd�d
��ZGd�de��ZGd�de��ZGd�deej��ZGd�deej��ZGd�deej��Z Gd�deej��Z!Gd�deej��Z"Gd�d��Z#Gd�d��Z$Gd �d!ej��Z%Gd"�d#ej��Z&e'd$krej(��dSdS)%�N)�
ModuleSpec)�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 3c���eZdZ�fd�Z�xZS)�TempFilec�8��t�����tjd���5}|j|_|�|j��ddd��n#1swxYwY|�tj
|j��dS)NF)�delete)�super�setUp�tempfile�NamedTemporaryFile�name�	file_name�write�file_byte_string�
addCleanupr�unlink)�self�fp�	__class__s  ��0/usr/local/lib/python3.11/test/test_linecache.pyrzTempFile.setUp,s����
���
�
����
�
(��
6�
6�
6�	,�"��W�D�N��H�H�T�*�+�+�+�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,����	,�	,�	,�	,�	
���	�(�$�.�9�9�9�9�9s�'A*�*A.�1A.)�__name__�
__module__�__qualname__r�
__classcell__�rs@rrr*s8�������:�:�:�:�:�:�:�:�:�rc�*��eZdZ�fd�Zd�Zd�Z�xZS)�GetLineTestsGoodDatac���d�|j���d��|_t	�����dS)Nr�utf-8)�join�	file_list�encoderrr)rrs �rrzGetLineTestsGoodData.setUp7s<��� "����� 7� 7� >� >�w� G� G���
���
�
�����rc�0�tj|j��5}t|��D]R\}}|�d��s|dz
}tj|j|dz��}|�||���S	ddd��dS#1swxYwYdS)N�
�)�tokenize�openr�	enumerate�endswith�	linecache�getline�assertEqual)rr�index�line�cached_lines     r�test_getlinez!GetLineTestsGoodData.test_getline;s���
�]�4�>�
*�
*�	4�b�(��}�}�
4�
4���t��}�}�T�*�*�!��D�L�D�'�/�����	�J�J��� � ��{�3�3�3�3�
4�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4����	4�	4�	4�	4�	4�	4s�A#B�B�Bc�n�tj|j��}|�||j��dS�N)r-�getlinesrr/r$�r�liness  r�
test_getlinesz"GetLineTestsGoodData.test_getlinesDs2���"�4�>�2�2��������/�/�/�/�/r)rrrrr3r9rrs@rr r 4sV������������4�4�4�0�0�0�0�0�0�0rr c��eZdZd�Zd�ZdS)�GetLineTestsBadDatac�b�|�tj|jd��d��dS)Nr(r)r/r-r.r�rs rr3z GetLineTestsBadData.test_getlineLs-������*�4�>�1�=�=�r�B�B�B�B�Brc�`�|�tj|j��g��dSr5)r/r-r6rr=s rr9z!GetLineTestsBadData.test_getlinesOs+������+�D�N�;�;�R�@�@�@�@�@rN)rrrr3r9�rrr;r;Is:������C�C�C�A�A�A�A�Arr;c��eZdZgZdS)�	EmptyFileN�rrrr$r?rrrArASs�������I�I�IrrAc��eZdZdgZdS)�SingleEmptyLiner'NrBr?rrrDrDWs��������I�I�IrrDc��eZdZgd�ZdS)�GoodUnicode)uá
zb
zabcdef
uááááá
NrBr?rrrFrF[s������;�;�;�I�I�IrrFc��eZdZdZdS)�BadUnicode_NoDeclarations
�abcN�rrrrr?rrrHrH^s������#���rrHc��eZdZdZdS)�BadUnicode_WithDeclarations# coding=utf-8
�abcNrIr?rrrKrKas������1���rrKc��eZdZd�ZdS)�
FakeLoaderc��d|��S)Nzsource for r?�r�fullnames  r�
get_sourcezFakeLoader.get_sourcefs��'�X�'�'�'rN�rrrrQr?rrrMrMes#������(�(�(�(�(rrMc��eZdZd�ZdS)�NoSourceLoaderc��dSr5r?rOs  rrQzNoSourceLoader.get_sourceks���trNrRr?rrrTrTjs#����������rrTc�V�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
S)�LineCacheTestsc�.�tj}|�|td��t��|�|td��t��|�t|td��|�|td��t��|�|td��t��tD]�}tj
�t|��dz}t|d���5}t|��D](\}}|�||||dz�����)	ddd��n#1swxYwY��tjd��}|�|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+r6)rr.�entry�filename�filer0r1�emptys        rr3zLineCacheTests.test_getlineqs����#��	
������5�1�1�5�9�9�9�������2�.�.��6�6�6�	
���)�W�h��<�<�<�	
�������*�*�E�2�2�2�������q�1�1�5�9�9�9��	I�	I�E��w�|�|�K��7�7�%�?�H��h��1�1�1�
I�T�#,�T�?�?�I�I�K�E�4��$�$�T�7�7�8�U�Q�Y�+G�+G�H�H�H�H�I�
I�
I�
I�
I�
I�
I�
I�
I�
I�
I�
I����
I�
I�
I�
I��
�"�#6�7�7�������#�#�#�#�#s�9E�E#	�&E#	c�b�|�tjtj��t	tjdd���5}|�t��ddd��n#1swxYwYtjtj��}|�	|gd���dS)N�wr"r[)r'z	def f():
z
    return 3
)
rrr�TESTFNr*r�SOURCE_3r-r6r/)rrr8s   r�test_no_ending_newlinez%LineCacheTests.test_no_ending_newline�s������	�(�)�*:�;�;�;�
�)�"�C�'�
:�
:�
:�	�b��H�H�X����	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��"�9�#3�4�4������ F� F� F�G�G�G�G�Gs�A.�.A2�5A2c��g}tD]T}tj�t|��dz}|�|��t
j|d���U|�|g��d�|D��}|�	|g��t
j
��d�|D��}|�	|g��dS)NrZr(c�.�g|]}|tjv�|��Sr?�r-�cache��.0�fns  r�
<listcomp>z2LineCacheTests.test_clearcache.<locals>.<listcomp>�s$��I�I�I�r�r���/H�/H��/H�/H�/Hrc�.�g|]}|tjv�|��Sr?rqrss  rrvz2LineCacheTests.test_clearcache.<locals>.<listcomp>�s$��E�E�E�r�r�Y�_�/D�/D��/D�/D�/Dr)rbrcrdr#re�appendr-r.�assertNotEqualr/�
clearcache)r�cachedrfrg�cached_emptys     r�test_clearcachezLineCacheTests.test_clearcache�s������	+�	+�E��w�|�|�K��7�7�%�?�H��M�M�(�#�#�#���h��*�*�*�*�	
���F�B�'�'�'�I�I�V�I�I�I������r�*�*�*�	�����E�E�V�E�E�E������r�*�*�*�*�*rc
�F�tj}tjdz}|�tj|��t
|dd���5}|�t��ddd��n#1swxYwY||d��g}t
|d���5}t|��D]=\}}|�
||||dz����|�|���>	ddd��n#1swxYwYt
|dd���5}|�t��ddd��n#1swxYwYtj
d��t|��D](\}}|�
||||dz�����)tj
|��t
|d���5}t|��D]=\}}|�
||||dz����|�|���>	ddd��dS#1swxYwYdS)NrZrkr"r[r(�dummy)r-r.rrlrrr*r�SOURCE_1r+r/rx�SOURCE_2�
checkcache)rr.�source_name�source�source_listr0r1s       r�test_checkcachezLineCacheTests.test_checkcache�s<���#���&��.�����	�(�+�6�6�6�
�+�s�W�
5�
5�
5�	#���L�L��"�"�"�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#����	#�	#�	#�	#����Q������
�+��
0�
0�
0�	)�F�(��0�0�
)�
)���t�� � ��w�w�{�E�A�I�'F�'F�G�G�G��"�"�4�(�(�(�(�
)�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)����	)�	)�	)�	)�
�+�s�W�
5�
5�
5�	#���L�L��"�"�"�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#����	#�	#�	#�	#�	��W�%�%�%�%�[�1�1�	D�	D�K�E�4����T�7�7�;���	�#B�#B�C�C�C�C�	��[�)�)�)�
�+��
0�
0�
0�	)�F�(��0�0�
)�
)���t�� � ��w�w�{�E�A�I�'F�'F�G�G�G��"�"�4�(�(�(�(�
)�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)����	)�	)�	)�	)�	)�	)sJ�A5�5A9�<A9�AC:�:C>�C>�D>�>E�E�:AH�H�Hc��tjt��}tj��|�dtjtd����|�|tjt����dS)NF)r-r6r]rzr/�	lazycacher7s  r�test_lazycache_no_globalsz(LineCacheTests.test_lazycache_no_globals�sk���"�8�,�,�����������	� 3�H�d� C� C�D�D�D�����	� 2�8� <� <�=�=�=�=�=rc��tjtt����}tj��|�dtjtt������|�dttjt����|�|tjt����dS)NTr()	r-r6�NONEXISTENT_FILENAME�globalsrzr/r��lenrrr7s  r�test_lazycache_smokez#LineCacheTests.test_lazycache_smoke�s����"�#7����C�C�����������)�%�&:�G�I�I�F�F�	H�	H�	H�����C�	��0D� E�F�F�G�G�G�	
����	� 2�3G� H� H�I�I�I�I�Irc�v�tj��tjtt	����}tj��tjt��tjtt	����|�|tjt����dSr5)r-rzr6r�r�r�r/�updatecacher7s  r�*test_lazycache_provide_after_failed_lookupz9LineCacheTests.test_lazycache_provide_after_failed_lookup�s���������"�#7����C�C���������/�0�0�0���0�'�)�)�<�<�<�����	� 5�6J� K� K�L�L�L�L�Lrc��tj��tjtt	����tj��dSr5)r-rzr�r�r�r�r=s r�test_lazycache_checkz#LineCacheTests.test_lazycache_check�s>���������0�'�)�)�<�<�<�������rc��tj��|�dtjdt	������|�dtjdt	������dS)NFrz<foo>)r-rzr/r�r�r=s r�test_lazycache_bad_filenamez*LineCacheTests.test_lazycache_bad_filename�se�����������	� 3�B��	�	� B� B�C�C�C�����	� 3�G�W�Y�Y� G� G�H�H�H�H�Hrc�\�tj��tjtt	����}|�dtjtt	������|�dttjt����dS)NF�)	r-rzr6r�r�r/r�r�rrr7s  r�test_lazycache_already_cachedz,LineCacheTests.test_lazycache_already_cached�s���������"�#7����C�C�������� 4�g�i�i�@�@�	B�	B�	B�	
����C�	��0D� E�F�F�G�G�G�G�Grc�p�tjt��}|�|��d�}t	jtd|��5tjt��}ddd��n#1swxYwY|�||��tj��t	jtd|��5tjt��}ddd��n#1swxYwY|�|g��|�tjt��|��dS)Nc��t�r5)�MemoryError)�args�kwargss  r�raise_memoryerrorz:LineCacheTests.test_memoryerror.<locals>.raise_memoryerror�s���rr�)r-r6r]�
assertTruer�	swap_attrr/rz)rr8r��lines2�lines3s     r�test_memoryerrorzLineCacheTests.test_memoryerror�s����"�8�,�,���������	�	�	�
�
�y�-�9J�
K�
K�	2�	2��'��1�1�F�	2�	2�	2�	2�	2�	2�	2�	2�	2�	2�	2����	2�	2�	2�	2������'�'�'������
�
�y�-�9J�
K�
K�	2�	2��'��1�1�F�	2�	2�	2�	2�	2�	2�	2�	2�	2�	2�	2����	2�	2�	2�	2������$�$�$�����+�H�5�5�u�=�=�=�=�=s$�
A3�3A7�:A7�C(�(C,�/C,c�*�d}dt��t��fD]C}tj��d|d�}|�tj||��g���Dtj��dt
��d�}|�tj||��dg��dt��tdt
����fD]Q}tj��dt
��|d�}|�tj||��dg���Rtj��tdt
����}d|j|d�}|�tj||��dg��dS)	Nz
scheme://pathza.b.c)r�
__loader__zsource for a.b.c
r)rr��__spec__zx.y.zzsource for x.y.z
)	�objectrTr-rzr/r6rMr�loader)rrgr��module_globals�specs     r�test_loaderzLineCacheTests.test_loader�s���"���V�X�X�~�'7�'7�8�	O�	O�F�� �"�"�"�*1��H�H�N����Y�/��.�I�I�2�N�N�N�N������&-�Z�\�\�J�J������+�H�n�E�E�.�/�	1�	1�	1��6�8�8�Z��J�L�L�%A�%A�B�	5�	5�D�� �"�"�"�*1����*.�0�0�N����Y�/��.�I�I�2�3�
5�
5�
5�
5�	������'�:�<�<�0�0��&-�T�[�&*�,�,������+�H�n�E�E�.�/�	1�	1�	1�	1�	1rN)rrrr3rnr}r�r�r�r�r�r�r�r�r�r?rrrWrWos�������$�$�$�2H�H�H�+�+�+�")�)�)�B>�>�>�J�J�J�M�M�M����
I�I�I�
H�H�H�
>�
>�
>�1�1�1�1�1rrWc�0��eZdZ�fd�Zd�Zd�Zd�Z�xZS)�LineCacheInvalidationTestsc�>��t�����tj��tjdz|_tjdz|_tjdz|_|j|j|jfD]�}|�	tj
|��t|dd���5}|�d|�d���ddd��n#1swxYwY|�
|tj��tj|��|�|tj����t#j|j��t|jdd���5}|�d	��ddd��dS#1swxYwYdS)
Nz.1z.2z.3rkr"r[zprint("I am z")zprint("was modified"))rrr-rzrrl�deleted_file�
modified_file�unchanged_filerrr*r�assertNotInrrr6�assertInrc�remove)r�fnamer�rs   �rrz LineCacheInvalidationTests.setUps����
���
�
���������%�,�t�3���&�-��4���'�.��5����'��(��)�+�		2�		2�E�
�O�O�I�,�e�4�4�4��e�S�7�3�3�3�
7�v����5�E�5�5�5�6�6�6�
7�
7�
7�
7�
7�
7�
7�
7�
7�
7�
7����
7�
7�
7�
7�
���U�I�O�4�4�4���u�%�%�%��M�M�%���1�1�1�1�
�	�$�#�$�$�$�
�$�$�c�G�
<�
<�
<�	2���L�L�0�1�1�1�	2�	2�	2�	2�	2�	2�	2�	2�	2�	2�	2�	2����	2�	2�	2�	2�	2�	2s$�9C�C#	�&C#	�/F�F�Fc��tj|j��|�|jtj��|�|jtj��|�|jtj��dSr5)r-r�r�r�rrr�r�r�r=s r� test_checkcache_for_deleted_filez;LineCacheInvalidationTests.test_checkcache_for_deleted_file/si����T�.�/�/�/�����*�I�O�<�<�<��
�
�d�(�)�/�:�:�:��
�
�d�)�9�?�;�;�;�;�;rc��tj|j��|�|jtj��|�|jtj��|�|jtj��dSr5)r-r�r�r�r�rrr�r�r=s r�!test_checkcache_for_modified_filez<LineCacheInvalidationTests.test_checkcache_for_modified_file5si����T�/�0�0�0��
�
�d�'���9�9�9�����+�Y�_�=�=�=��
�
�d�)�9�?�;�;�;�;�;rc�
�tj��|�|jtj��|�|jtj��|�|jtj��dSr5)r-r�r�r�rrr�r�r�r=s r�!test_checkcache_with_no_parameterz<LineCacheInvalidationTests.test_checkcache_with_no_parameter;sf�����������*�I�O�<�<�<�����+�Y�_�=�=�=��
�
�d�)�9�?�;�;�;�;�;r)rrrrr�r�r�rrs@rr�r�se�������2�2�2�2�2�,<�<�<�<�<�<�<�<�<�<�<�<�<rr��__main__))r-�unittest�os.pathrcr
r)�importlib.machineryr�testr�test.supportr�__file__r]r�rar^rd�dirname�	TEST_PATH�splitrbrer�r�rmrr r;�TestCaserArDrFrHrKrMrTrWr�r�mainr?rr�<module>r�s'��&���������������������*�*�*�*�*�*�������"�"�"�"�"�"�����*�,����
���G�O�O�H�%�%�	�
�
�
�
!�
!���g�o�o�h�'�'��������
:�:�:�:�:�:�:�:�0�0�0�0�0�8�0�0�0�*A�A�A�A�A�(�A�A�A������$�h�&7���������*�H�,=����<�<�<�<�<�&��(9�<�<�<�$�$�$�$�$�2�H�4E�$�$�$�2�2�2�2�2�!4�h�6G�2�2�2�(�(�(�(�(�(�(�(�
��������
f1�f1�f1�f1�f1�X�&�f1�f1�f1�R'<�'<�'<�'<�'<��!2�'<�'<�'<�T�z����H�M�O�O�O�O�O��r

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