HEX
Server: Microsoft-IIS/10.0
System: Windows NT ITPWINWEBSVR22 10.0 build 20348 (Windows Server 2022) AMD64
User: www.conferencesearch.co.uk (0)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: D:/Python311/Lib/test/test_importlib/__pycache__/test_pkg_import.cpython-311.pyc
�

��Vc���ddlZddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
Gd�dej��Ze
dkrej��dSdS)�N)�cache_from_source)�create_empty_filec�2�eZdZd�Zd�Zd�Zd�Zd�Zd�ZdS)�
TestImportc�
�d|_|jtjvr?|xjtjt
j��z
c_|jtjv�?|jdz|_tj	j
|g|�Ri|��dS)N�PACKAGE_z.foo)�package_name�sys�modules�random�choice�string�
ascii_letters�module_name�unittest�TestCase�__init__)�self�args�kws   �7D:\Python311\Lib\test\test_importlib\test_pkg_import.pyrzTestImport.__init__s���&�����3�;�.�	E������v�/C�!D�!D�D�����3�;�.�	E��,�v�5�����"�4�5�$�5�5�5�"�5�5�5�5�5�c�^�|j|jfD]}|tjvr
tj|=�dS)N)r	rr
r)rrs  r�remove_moduleszTestImport.remove_moduless@�� �-�t�/?�@�	-�	-�K��c�k�)�
-��K��,��	-�	-rc���tj��|_tj�|j��tj�|j|j��|_	t
j
|j	��ttj�|j	d����tj�|j	d��|_dS)Nz__init__.pyzfoo.py)
�tempfile�mkdtemp�test_dirr
�path�append�os�joinr	�package_dir�mkdirr�module_path�rs r�setUpzTestImport.setUps��� �(�*�*��
������
�&�&�&��7�<�<��
�(,�(9�;�;���
���!�"�"�"��"�'�,�,�t�'7��G�G�H�H�H��7�<�<��(8�(�C�C����rc��tj|j��|�tj�|j��d��tj�|j��|���dS)Nr)	�shutil�rmtreer�assertNotEqualr
r�count�removerr&s r�tearDownzTestImport.tearDown#sh���
�d�m�$�$�$����C�H�N�N�4�=�9�9�1�=�=�=������
�&�&�&��������rc��t|j��}tj�|��rtj|��t
|jdd���5}|�|��ddd��dS#1swxYwYdS)N�wzutf-8)�encoding)rr%r!r�existsr-�open�write)r�contents�
compiled_path�fs    r�rewrite_filezTestImport.rewrite_file)s���)�$�*:�;�;�
�
�7�>�>�-�(�(�	%��I�m�$�$�$�
�$�"�C�'�
:�
:�
:�	�a�
�G�G�H����	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�B�B�	Bc�(�|�d��t|j��td���#t$rYnwxYw|�|jtj��|�ttj|j
d����d}|tt��vr7|tjtj��z
}|tt��v�7|�|��t|j��td���#t"$rYnwxYw|�d|z��t|j��j}|�t)||��d��dS)N�forzFailed to induce SyntaxError�foo�azFailed to induce NameError.z%s = 1�)r8�
__import__r�RuntimeError�SyntaxError�assertNotInr
r�assertFalse�hasattrr	�dir�__builtins__rr
rr�	NameErrorr;�assertEqual�getattr)r�var�modules   r�test_package_import__semanticsz)TestImport.test_package_import__semantics0s���
	
���%� � � �
��(�
)�
)�
)� �!?�@�@�@��� � � �D�D� ��������)�3�;�7�7�7�������T�->�!?��G�G�H�H�H����S��&�&�&�	7��6�=��!5�6�6�6�C��S��&�&�&�	7�	
���#����
��(�
)�
)�
)� �!>�?�?�?������$�$�����
	
���(�S�.�)�)�)��D�,�-�-�1��������-�-�q�1�1�1�1�1s!�9�
A�A�
D-�-
D:�9D:N)	�__name__�
__module__�__qualname__rrr'r.r8rK�rrrrsq������6�6�6�-�-�-�
D�D�D�������2�2�2�2�2rr�__main__)r!r
r)rrrr�importlib.utilr�test.support.os_helperrrrrL�mainrOrr�<module>rTs���	�	�	�	�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
���������,�,�,�,�,�,�4�4�4�4�4�4�@2�@2�@2�@2�@2��"�@2�@2�@2�F�z����H�M�O�O�O�O�O��r