HEX
Server: Apache
System: Linux bd12.noc223.com 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64
User: handcraf (1693)
PHP: 8.1.28
Disabled: NONE
Upload Files
File: //opt/alt/python312/lib64/python3.12/test/__pycache__/test_linecache.cpython-312.opt-2.pyc
�

~h�e�&���	ddlZddlZddlZddlZddlZddlmZddlm	Z	ejZedzZdZ
dZejj!e
�Zdj%�Zejj!e�ZdZd	Zd
ZGd�d�ZGd
�de�ZGd�de�ZGd�deej6�ZGd�deej6�ZGd�deej6�ZGd�deej6�ZGd�deej6�Z Gd�dej6�Z!Gd�dej6�Z"e#dk(rejH�yy) �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 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  ��:/opt/alt/python312/lib64/python3.12/test/test_linecache.pyrzTempFile.setUp+sh���
��
��
�
(�
(��
6�	,�"��W�W�D�N��H�H�T�*�*�+�	,�	
���	�(�(�$�.�.�9�	,�	,�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�encoderr
r)rrs �rrzGetLineTestsGoodData.setUp6s,��� "������ 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:s��
�]�]�4�>�>�
*�	4�b�(��}�
4���t��}�}�T�*��D�L�D�'�/�/������	�J��� � ��{�3�
4�	4�	4�	4�s�AB	�	Bc�z�tj|j�}|j||j�y�N)r,�getlinesrr.r#�r�liness  r�
test_getlinesz"GetLineTestsGoodData.test_getlinesCs*���"�"�4�>�>�2���������/r)rrrrr2r8rrs@rrr3s����4�0rrc��eZdZd�Zd�Zy)�GetLineTestsBadDatac�d�|jtj|jd�d�y)Nr'r)r.r,r-r�rs rr2z GetLineTestsBadData.test_getlineKs#������*�*�4�>�>�1�=�r�Brc�b�|jtj|j�g�yr4)r.r,r5rr<s rr8z!GetLineTestsBadData.test_getlinesNs!������+�+�D�N�N�;�R�@rN)rrrr2r8�rrr:r:Hs��C�Arr:c��eZdZgZy)�	EmptyFileN�rrrr#r>rrr@r@Rs���Irr@c��eZdZdgZy)�SingleEmptyLiner&NrAr>rrrCrCVs	����IrrCc��eZdZgd�Zy)�GoodUnicode)uá
zb
zabcdef
uááááá
NrAr>rrrErEZs��;�IrrEc��eZdZdZy)�BadUnicode_NoDeclarations
�abcN�rrrrr>rrrGrG]s��#�rrGc��eZdZdZy)�BadUnicode_WithDeclarations# coding=utf-8
�abcNrHr>rrrJrJ`s��1�rrJc�N�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
y)
�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*r5)rr-�entry�filename�filer/r0�emptys        rr2zLineCacheTests.test_getlinefs1���#�#��	
�����5�1�5�9������2�.��6�	
���)�W�h��<�	
������*�E�2������q�1�5�9��	I�E��w�w�|�|�K��7�%�?�H��h��1�
I�T�#,�T�?�I�K�E�4��$�$�T�7�8�U�Q�Y�+G�H�I�
I�
I�	I��"�"�#6�7�������#�

I�
I�s�.0E�E	c�Z�|jtjtj�t	tjdd��5}|jt�ddd�tjtj�}|j|gd��y#1swY�AxYw)N�wr!rP)r&z	def f():
z
    return 3
)
rrr�TESTFNr)r�SOURCE_3r,r5r.)rrr7s   r�test_no_ending_newlinez%LineCacheTests.test_no_ending_newlinesx�����	�(�(�)�*:�*:�;�
�)�"�"�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)NrOr')rWrXrYr"rZ�appendr,r-�assertNotEqual�cacher.�
clearcache)r�cachedr[r\�fn�cached_emptys      r�test_clearcachezLineCacheTests.test_clearcache�s������	+�E��w�w�|�|�K��7�%�?�H��M�M�(�#����h��*�	+�	
���F�B�'�%+�I�r�r����/H��I��I�����r�*�	����%+�E�r�r�Y�_�_�/D��E��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)NrOr`r!rPr'�dummy)r,r-rrarrr)r�SOURCE_1r*r.re�SOURCE_2�
checkcache)rr-�source_name�source�source_listr/r0s       r�test_checkcachezLineCacheTests.test_checkcache�s����#�#���&�&��.�����	�(�(�+�6�
�+�s�W�
5�	#���L�L��"�	#���Q����
�+��
0�	)�F�(��0�
)���t�� � ��w�{�E�A�I�'F�G��"�"�4�(�
)�	)�
�+�s�W�
5�	#���L�L��"�	#�	���W�%�%�[�1�	D�K�E�4����T�7�;���	�#B�C�	D�	���[�)�
�+��
0�	)�F�(��0�
)���t�� � ��w�{�E�A�I�'F�G��"�"�4�(�
)�	)�	)�/	#�	#��	)�	)��
	#�	#��	)�	)�s2�F/�AF<� G�$AG�/F9�<G�G�Gc��tjt�}tj�|j	dtj
td��|j	|tjt��y)NF)r,r5rRrhr.�	lazycacher6s  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,r5�NONEXISTENT_FILENAME�globalsrhr.rw�lenrgr6s  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��yr4)r,rhr5rzr{rwr.�updatecacher6s  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
�yr4)r,rhrwrzr{rqr<s r�test_lazycache_checkz#LineCacheTests.test_lazycache_check�s-���������0�'�)�<����rc���tj�|jdtjdt	���|jdtjdt	���y)NFrz<foo>)r,rhr.rwr{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,rhr5rzr{r.rwr|rgr6s  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�r4)�MemoryError)�args�kwargss  r�raise_memoryerrorz:LineCacheTests.test_memoryerror.<locals>.raise_memoryerror�s���rr)r,r5rR�
assertTruer�	swap_attrr.rh)rr7r��lines2�lines3s     r�test_memoryerrorzLineCacheTests.test_memoryerror�s����"�"�8�,�������	�
�
�
�y�-�9J�
K�	2��'�'��1�F�	2������'�����
�
�
�y�-�9J�
K�	2��'�'��1�F�	2������$�����+�+�H�5�u�=�	2�	2��
	2�	2�s�	D
�,D�
D�DN)rrrr2rcrlrurxr}r�r�r�r�r�r>rrrLrLds?��$�2H�+�")�B>�J�M��
I�
H�
>rrLc�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.3r`r!rPzprint("I am z")zprint("was modified"))r
rr,rhrra�deleted_file�
modified_file�unchanged_filerrr)r�assertNotInrgr5�assertInrX�remove)r�fnamersrs   �rrz LineCacheInvalidationTests.setUp�sP���
��
������%�,�,�t�3���&�-�-��4���'�.�.��5����'�'��(�(��)�)�+�		2�E�
�O�O�I�,�,�e�4��e�S�7�3�
7�v����|�E�7�"�5�6�
7�
���U�I�O�O�4����u�%��M�M�%����1�		2�	�	�	�$�#�#�$�
�$�$�$�c�G�
<�	2���L�L�0�1�	2�	2�
7�
7��	2�	2�s�F�,F�F	�Fc�>�tj|j�|j|jtj�|j|jtj�|j|jtj�yr4)r,rqr�r�rgr�r�r�r<s r� test_checkcache_for_deleted_filez;LineCacheInvalidationTests.test_checkcache_for_deleted_file	s`�����T�.�.�/�����*�*�I�O�O�<��
�
�d�(�(�)�/�/�:��
�
�d�)�)�9�?�?�;rc�>�tj|j�|j|jtj
�|j
|jtj
�|j|jtj
�yr4)r,rqr�r�r�rgr�r�r<s r�!test_checkcache_for_modified_filez<LineCacheInvalidationTests.test_checkcache_for_modified_files`�����T�/�/�0��
�
�d�'�'����9�����+�+�Y�_�_�=��
�
�d�)�)�9�?�?�;rc�(�tj�|j|jtj�|j|j
tj�|j
|jtj�yr4)r,rqr�r�rgr�r�r�r<s r�!test_checkcache_with_no_parameterz<LineCacheInvalidationTests.test_checkcache_with_no_parametersZ����������*�*�I�O�O�<�����+�+�Y�_�_�=��
�
�d�)�)�9�?�?�;r)rrrrr�r�r�rrs@rr�r��s���2�,<�<�<rr��__main__)%r,�unittest�os.pathrXrr(�testr�test.supportr�__file__rRrzrVrSrY�dirname�	TEST_PATH�splitrWrZrorprbrrr:�TestCaser@rCrErGrJrLr�r�mainr>rr�<module>r�sU��&�������"������*�,����
���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�K>�X�&�&�K>�\'<��!2�!2�'<�T�z���H�M�M�O�r