Sindbad~EG File Manager

Current Path : /proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/
Upload File :
Current File : //proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/test_linecache.cpython-312.opt-1.pyc

�

'Μg=2����dZddlZddlZddlZddlZddlZddlmZddl	m
Z
ddlmZejZedzZdZdZej$j'e
�Zd	j+�Zej$j'e�Zd
ZdZdZGd
�d�ZGd�de�ZGd�de�ZGd�deej<�ZGd�deej<�Z Gd�deej<�Z!Gd�deej<�Z"Gd�deej<�Z#Gd�d�Z$Gd�d �Z%Gd!�d"ej<�Z&Gd#�d$ej<�Z'e(d%k(rejR�yy)&z  Tests for the linecache module �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�$��t�|��tjd��5}|j|_|j
|j�ddd�|jtj|j
�y#1swY�4xYw)NF)�delete)�super�setUp�tempfile�NamedTemporaryFile�name�	file_name�write�file_byte_string�
addCleanupr�unlink)�self�fp�	__class__s  ��0/usr/local/lib/python3.12/test/test_linecache.pyrzTempFile.setUp,sa���
��
��
�
(�
(��
6�"��W�W�D�N��H�H�T�*�*�+�7�	
���	�(�(�$�.�.�9�7�
6�s�-B�B)�__name__�
__module__�__qualname__r�
__classcell__�rs@rrr*s
���:�:�rc�*��eZdZ�fd�Zd�Zd�Z�xZS)�GetLineTestsGoodDatac���dj|j�jd�|_t�|��y)Nr�utf-8)�join�	file_list�encoderrr)rrs �rrzGetLineTestsGoodData.setUp7s,��� "������ 7� >� >�w� G���
��
�rc�*�tj|j�5}t|�D]P\}}|j	d�s|dz
}tj|j|dz�}|j||��R	ddd�y#1swYyxYw)N�
�)�tokenize�openr�	enumerate�endswith�	linecache�getline�assertEqual)rr�index�line�cached_lines     r�test_getlinez!GetLineTestsGoodData.test_getline;sq��
�]�]�4�>�>�
*�b�(��}���t��}�}�T�*��D�L�D�'�/�/������	�J��� � ��{�3� -�+�
*�
*�s�AB	�	Bc�z�tj|j�}|j||j�y�N)r-�getlinesrr/r$�r�liness  r�
test_getlinesz"GetLineTestsGoodData.test_getlinesDs*���"�"�4�>�>�2���������/r)rrrrr3r9rrs@rr r 4s����4�0rr c��eZdZd�Zd�Zy)�GetLineTestsBadDatac�d�|jtj|jd�d�y)Nr(r)r/r-r.r�rs rr3z GetLineTestsBadData.test_getlineLs#������*�*�4�>�>�1�=�r�Brc�b�|jtj|j�g�yr5)r/r-r6rr=s rr9z!GetLineTestsBadData.test_getlinesOs!������+�+�D�N�N�;�R�@rN)rrrr3r9�rrr;r;Is��C�Arr;c��eZdZgZy)�	EmptyFileN�rrrr$r?rrrArASs���IrrAc��eZdZdgZy)�SingleEmptyLiner'NrBr?rrrDrDWs	����IrrDc��eZdZgd�Zy)�GoodUnicode)uá
zb
zabcdef
uááááá
NrBr?rrrFrF[s��;�IrrFc��eZdZdZy)�BadUnicode_NoDeclarations
�abcN�rrrrr?rrrHrH^s��#�rrHc��eZdZdZy)�BadUnicode_WithDeclarations# coding=utf-8
�abcNrIr?rrrKrKas��1�rrKc��eZdZd�Zy)�
FakeLoaderc��d|��S)Nzsource for r?�r�fullnames  r�
get_sourcezFakeLoader.get_sourcefs���X�J�'�'rN�rrrrQr?rrrMrMes��(rrMc��eZdZd�Zy)�NoSourceLoaderc��yr5r?rOs  rrQzNoSourceLoader.get_sourceks��rNrRr?rrrTrTjs��rrTc�Z�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zy)�LineCacheTestsc��tj}|j|td�t�|j|td�t�|jt|td�|j|td�t�|j|td�t�tD]o}tjjt|�dz}t|d��5}t|�D]!\}}|j||||dz���#	ddd��qtjd�}|j|g�y#1swY��xYw)	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�5�9������2�.��6�	
���)�W�h��<�	
������*�E�2������q�1�5�9��E��w�w�|�|�K��7�%�?�H��h��1�T�#,�T�?�K�E�4��$�$�T�7�8�U�Q�Y�+G�H�$3�2�1���"�"�#6�7�������#�
2�1�s�.0E�E	c�Z�|jtjtj�t	tjdd��5}|jt�ddd�tjtj�}|j|gd��y#1swY�AxYw)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�sq�����	�(�(�)�*:�*:�;�
�)�"�"�C�'�
:�b��H�H�X��;��"�"�9�#3�#3�4������ F�G�;�
:�s�B!�!B*c���g}tD]P}tjjt|�dz}|j|�t
j|d��R|j|g�|D�cgc]}|tjvs�|��}}|j|g�t
j�|D�cgc]}|tjvs�|��}}|j|g�ycc}wcc}w)NrZr()rbrcrdr#re�appendr-r.�assertNotEqual�cacher/�
clearcache)r�cachedrfrg�fn�cached_emptys      r�test_clearcachezLineCacheTests.test_clearcache�s������E��w�w�|�|�K��7�%�?�H��M�M�(�#����h��*��	
���F�B�'�%+�I�V�r�r����/H��V��I�����r�*�	����%+�E�V�r�r�Y�_�_�/D��V��E�����r�*��
J��
Fs�2C+�
C+�:C0�C0c
��tj}tjdz}|j	tj
|�t
|dd��5}|jt�ddd�||d�g}t
|d��5}t|�D]2\}}|j||||dz��|j|��4	ddd�t
|dd��5}|jt�ddd�tjd�t|�D]!\}}|j||||dz���#tj|�t
|d��5}t|�D]2\}}|j||||dz��|j|��4	ddd�y#1swY��IxYw#1swY��xYw#1swY��xYw#1swYyxYw)NrZrkr"r[r(�dummy)r-r.rrlrrr*r�SOURCE_1r+r/rp�SOURCE_2�
checkcache)rr.�source_name�source�source_listr0r1s       r�test_checkcachezLineCacheTests.test_checkcache�s����#�#���&�&��.�����	�(�(�+�6�
�+�s�W�
5���L�L��"�6���Q����
�+��
0�F�(��0���t�� � ��w�{�E�A�I�'F�G��"�"�4�(� 1�1�
�+�s�W�
5���L�L��"�6�	���W�%�%�[�1�K�E�4����T�7�;���	�#B�C�2�	���[�)�
�+��
0�F�(��0���t�� � ��w�{�E�A�I�'F�G��"�"�4�(� 1�1�
0�/6�
5��1�
0��
6�
5��1�
0�s2�F/�AF<� G�$AG�/F9�<G�G�Gc��tjt�}tj�|j	dtj
td��|j	|tjt��y)NF)r-r6r]rsr/�	lazycacher7s  r�test_lazycache_no_globalsz(LineCacheTests.test_lazycache_no_globals�sV���"�"�8�,����������	� 3� 3�H�d� C�D�����	� 2� 2�8� <�=rc��tjtt��}tj�|jdtjtt���|jdttjt��|j|tjt��y)NTr()	r-r6�NONEXISTENT_FILENAME�globalsrsr/r��lenrrr7s  r�test_lazycache_smokez#LineCacheTests.test_lazycache_smoke�s����"�"�#7���C����������)�%�%�&:�G�I�F�	H�����C�	���0D� E�F�G�	
����	� 2� 2�3G� H�Irc�`�tj�tjtt	��}tj�tjt�tj
tt	��|j
|tjt��yr5)r-rsr6r�r�r�r/�updatecacher7s  r�*test_lazycache_provide_after_failed_lookupz9LineCacheTests.test_lazycache_provide_after_failed_lookup�sm�������"�"�#7���C���������/�0����0�'�)�<�����	� 5� 5�6J� K�Lrc��tj�tjtt	��tj
�yr5)r-rsr�r�r�r|r=s r�test_lazycache_checkz#LineCacheTests.test_lazycache_check�s-���������0�'�)�<����rc���tj�|jdtjdt	���|jdtjdt	���y)NFrz<foo>)r-rsr/r�r�r=s r�test_lazycache_bad_filenamez*LineCacheTests.test_lazycache_bad_filename�sL����������	� 3� 3�B��	� B�C�����	� 3� 3�G�W�Y� G�Hrc�4�tj�tjtt	��}|jdtjtt	���|jdttjt��y)NF�)	r-rsr6r�r�r/r�r�rrr7s  r�test_lazycache_already_cachedz,LineCacheTests.test_lazycache_already_cached�si�������"�"�#7���C��������� 4�g�i�@�	B�	
����C�	���0D� E�F�Grc�D�tjt�}|j|�d�}t	j
td|�5tjt�}ddd�|j
|�tj�t	j
td|�5tjt�}ddd�|j
g�|j
tjt�|�y#1swY��xYw#1swY�QxYw)Nc��t�r5)�MemoryError)�args�kwargss  r�raise_memoryerrorz:LineCacheTests.test_memoryerror.<locals>.raise_memoryerror�s���rr�)r-r6r]�
assertTruer�	swap_attrr/rs)rr8r��lines2�lines3s     r�test_memoryerrorzLineCacheTests.test_memoryerror�s����"�"�8�,�������	�
�
�
�y�-�9J�
K��'�'��1�F�L������'�����
�
�
�y�-�9J�
K��'�'��1�F�L������$�����+�+�H�5�u�=�L�
K��
L�
K�s�	D
�,D�
D�Dc���d}dt�t�fD]A}tj�d|d�}|j	tj
||�g��Ctj�dt
�d�}|j	tj
||�dg�dt�tdt
��fD]K}tj�dt
�|d�}|j	tj
||�dg��Mtj�tdt
��}d|j|d�}|j	tj
||�dg�y)	Nz
scheme://pathza.b.c)r�
__loader__zsource for a.b.c
r)rr��__spec__zx.y.zzsource for x.y.z
)	�objectrTr-rsr/r6rMr�loader)rrgr��module_globals�specs     r�test_loaderzLineCacheTests.test_loader�s>��"���V�X�~�'7�8�F�� � �"�*1��H�N����Y�/�/��.�I�2�N�9�
	����&-�Z�\�J������+�+�H�n�E�.�/�	1��6�8�Z��J�L�%A�B�D�� � �"�*1���*.�0�N����Y�/�/��.�I�2�3�
5�	C�	�����'�:�<�0��&-�T�[�[�&*�,������+�+�H�n�E�.�/�	1rc��dtdzdfdddzdffD�]\}}|jd|���5tj�tj|�}|j|g�|j
|tj�ddd�|d	fd
|f||ffD]�\}}|jd|��||��5tj�d
dg|ftj|<tj|�|j
|tj�ddd�����tj�y#1swY��xYw#1swY��xYw)N)�zNUL bytes filenamer�z filename with embedded NUL bytes)u	��.pyz'surrogate codes (MUSICAL SYMBOL G CLEF)�ai@Bzvery long filenamez
updatecache: �ok�keyzcheckcache: )r�rPri�)	�__file__�subTestr-rsr��assertListEqual�assertNotInrrr|)rr�descr8r�rPs      r�test_invalid_namesz!LineCacheTests.test_invalid_namessF��*�
��
� B�C�
K��9�_�2�3�

�J�D�$����
�d�V�4�5��$�$�&�!�-�-�d�3���$�$�U�B�/�� � ��y���7�	6�$(��,���
��d�|�!L�
��X��\�\�L���"7�&)�H�"�>��(�(�*�,-�t�R��+B�I�O�O�C�(��(�(��-��$�$�S�)�/�/�:�>�>�"M�'

�8	����#6�5��>�>�s�AD?�<A!E�?E	�EN)rrrr3rnrwr�r�r�r�r�r�r�r�r�r�r?rrrWrWosI��$�2H�+�")�B>�J�M��
I�
H�
>�1�6rrWc�0��eZdZ�fd�Zd�Zd�Zd�Z�xZS)�LineCacheInvalidationTestsc�>��t�|��tj�tj
dz|_tj
dz|_tj
dz|_|j|j|jfD]�}|jtj|�t|dd��5}|jd|�d��ddd�|j|tj�tj|�|j!|tj���t#j$|j�t|jdd��5}|jd	�ddd�y#1swY��xYw#1swYyxYw)
Nz.1z.2z.3rkr"r[zprint("I am z")zprint("was modified"))rrr-rsrrl�deleted_file�
modified_file�unchanged_filerrr*rr�rrr6�assertInrc�remove)r�fnamer~rs   �rrz LineCacheInvalidationTests.setUp8s;���
��
������%�,�,�t�3���&�-�-��4���'�.�.��5����'�'��(�(��)�)�+�E�
�O�O�I�,�,�e�4��e�S�7�3�v����|�E�7�"�5�6�4�
���U�I�O�O�4����u�%��M�M�%����1�+�	�	�	�$�#�#�$�
�$�$�$�c�G�
<���L�L�0�1�=�
<�4�3��=�
<�s�F�,F�F	�Fc�>�tj|j�|j|jtj�|j|jtj�|j|jtj�yr5)r-r|r�r�rrr�r�r�r=s r� test_checkcache_for_deleted_filez;LineCacheInvalidationTests.test_checkcache_for_deleted_fileNs`�����T�.�.�/�����*�*�I�O�O�<��
�
�d�(�(�)�/�/�:��
�
�d�)�)�9�?�?�;rc�>�tj|j�|j|jtj
�|j
|jtj
�|j|jtj
�yr5)r-r|r�r�r�rrr�r�r=s r�!test_checkcache_for_modified_filez<LineCacheInvalidationTests.test_checkcache_for_modified_fileTs`�����T�/�/�0��
�
�d�'�'����9�����+�+�Y�_�_�=��
�
�d�)�)�9�?�?�;rc�(�tj�|j|jtj�|j|j
tj�|j
|jtj�yr5)r-r|r�r�rrr�r�r�r=s r�!test_checkcache_with_no_parameterz<LineCacheInvalidationTests.test_checkcache_with_no_parameterZsZ����������*�*�I�O�O�<�����+�+�Y�_�_�=��
�
�d�)�)�9�?�?�;r)rrrrr�r�r�rrs@rr�r�7s���2�,<�<�<rr��__main__)*�__doc__r-�unittest�os.pathrcr
r)�importlib.machineryr�testr�test.supportrr�r]r�rar^rd�dirname�	TEST_PATH�splitrbrerzr{rmrr r;�TestCaserArDrFrHrKrMrTrWr�r�mainr?rr�<module>r�sl��&������*��"������*�,����
���G�G�O�O�H�%�	�
�
�
�
!���g�g�o�o�h�'��������
:�:�0�8�0�*A�(�A��$�h�&7�&7���*�H�,=�,=��<�&��(9�(9�<�$�2�H�4E�4E�$�2�!4�h�6G�6G�2�(�(�
��
E�X�&�&�E�P'<��!2�!2�'<�T�z���H�M�M�O�r

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