Current File : //usr/local/apps/python3/lib/python3.11/test/__pycache__/test_pkgutil.cpython-311.opt-1.pyc
�

�Ke_[��t�ddlmZddlmZmZddlmZddlZddlZddl	Z	ddl
mZddlZddl
Z
ddlZ
ddlZddlZddlZGd�dej��ZGd�d	ej��ZGd
�dej��ZGd�d
ej��ZGd�dej��Zd�Zedkrej��dSdS)�)�Path)�unload�CleanImport)�check_warningsN)�spec_from_file_locationc�J�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�ZdS)�PkgutilTestsc���tj��|_|�tj|j��tj�d|j��dS�Nr)	�tempfile�mkdtemp�dirname�
addCleanup�shutil�rmtree�sys�path�insert��selfs �;/usr/local/apps/python3/lib/python3.11/test/test_pkgutil.py�setUpzPkgutilTests.setUpsH���'�)�)�������
�t�|�4�4�4������4�<�(�(�(�(�(�c� �tjd=dSr)rrrs r�tearDownzPkgutilTests.tearDowns���H�Q�K�K�Krc��d}d}tj�|j|��}tj|��ttj�|d��d��}|���ttj�|d��d��}|�|��|���tjtj�|d����ttj�|dd��d��}|�|��|���tj	|d��}|�
||��tj	|d��}|�
||��tj|=dS)N�test_getdata_filesys�%Hello, world!
Second line
Third line�__init__.py�wb�res.txt�sub�sub/res.txt)
�osr�joinr�mkdir�open�close�write�pkgutil�get_data�assertEqualr�modules)r�pkg�
RESOURCE_DATA�package_dir�f�res1�res2s       rrz!PkgutilTests.test_getdata_filesyssd��$��D�
��g�l�l�4�<��5�5��
�����������k�=�9�9�4�@�@��	���	�	�	������k�9�5�5�t�<�<��	���
����	���	�	�	�
������k�5�1�1�2�2�2������k�5�)�<�<�d�C�C��	���
����	���	�	�	����Y�/�/������}�-�-�-����]�3�3������}�-�-�-��K����rc�:�d}d}d}tj�|j|��}t	j|d��}|�|dzd��|�|dz|��|�|dz|��|���tj�	d	|��tj|d
��}|�||��tj|d��}|�||��g}tj
|g��D]<}	|�|	tj��|�|	j���=|�|dg��tjd	=tj|=dS)N�test_getdata_zipfile.zip�test_getdata_zipfiler�w�/__init__.py��/res.txtz/sub/res.txtrr!r#)r$rr%r�zipfile�ZipFile�writestrr(rrr*r+r,�iter_modules�assertIsInstance�
ModuleInfo�append�namer-)
r�zipr.r/�zip_file�zr2r3�names�
moduleinfos
          rr6z!PkgutilTests.test_getdata_zipfile<s���(��$��D�
��7�<�<���c�2�2���O�H�c�*�*��	
�
�
�3��'��,�,�,�	�
�
�3��#�]�3�3�3�	�
�
�3��'��7�7�7�	���	�	�	�	�����8�$�$�$����Y�/�/������}�-�-�-����]�3�3������}�-�-�-���!�.��z�:�:�	*�	*�J��!�!�*�g�.@�A�A�A��L�L���)�)�)�)�����!7� 8�9�9�9��H�Q�K��K����rc��d}d}d}tj�|j|��}t	j|d��}|�|dzd��|�|dz|��|���tj�	d|��	tj|d	��}|�||��g}tj
t|��g��D]<}|�|tj��|�|j���=|�||g��tjd=tj�|d��n2#tjd=tj�|d��wxYwd
}	|�t,|	��5t/tj
d����ddd��dS#1swxYwYdS)Nr5r6rr7r8r9r:rr!z9path must be None or list of paths to look for modules in�invalid_path)r$rr%rr;r<r=r(rrr*r+r,r>rr?r@rArBr-�pop�assertRaisesRegex�
ValueError�list)
rrCr.r/rDrE�resrFrG�expected_msgs
          r�test_issue44061_iter_modulesz)PkgutilTests.test_issue44061_iter_modules_s��(��$��D�
��7�<�<���c�2�2���O�H�c�*�*��	
�
�
�3��'��,�,�,�	�
�
�3��#�]�3�3�3�	���	�	�	�	�����8�$�$�$�	'��"�3�	�2�2�C����S�-�0�0�0��E�%�2�D��N�N�3C�D�D�
.�
.�
��%�%�j�'�2D�E�E�E����Z�_�-�-�-�-����U�S�E�*�*�*������K�O�O�C��&�&�&�&�������K�O�O�C��&�&�&�&����S��
�
#�
#�J��
=�
=�	7�	7���%�n�5�5�6�6�6�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7����	7�	7�	7�	7�	7�	7s�(B#E9�9/F(�"G7�7G;�>G;c�$�d}tj�|j|��}tj|d��|�tj|��tj|jg���D]}|�	d���dS)N�unreadable_packager)rzunexpected package found)
r$rr%rr&r�rmdirr*�
walk_packages�fail)r�package_name�d�ts    r�test_unreadable_dir_on_syspathz+PkgutilTests.test_unreadable_dir_on_syspath�s���+���G�L�L���|�4�4��	���A���������!�$�$�$��&�T�\�N�;�;�;�	2�	2�A��I�I�0�1�1�1�1�	2�	2rc��d}tj�|j|��}tj|��ttj�|d��d��}|���tjtj�|d����ttj�|dd��d��}|���ttj�|dd��d��}|���d}tj�|j|��}tj|��ttj�|d��d��}|���tjtj�|d����ttj�|dd��d��}|���ttj�|dd��d��}|���gd�}d�tj|jg��D��}|�	||��|D]%}|�
d��r�tj|=�&dS)	N�test_walkpackages_filesysrr r"zmod.py)r"zsub.test_walkpackages_filesysz!sub.test_walkpackages_filesys.modr[ztest_walkpackages_filesys.subz!test_walkpackages_filesys.sub.modc��g|]
}|d��S�����.0�es  r�
<listcomp>z:PkgutilTests.test_walkpackages_filesys.<locals>.<listcomp>�s��E�E�E�!��1��E�E�Er�mod)
r$rr%rr&r'r(r*rTr,�endswithrr-)	r�pkg1�pkg1_dirr1�pkg2�pkg2_dir�expected�actualr.s	         rr[z&PkgutilTests.test_walkpackages_filesys�s:��*���7�<�<���d�3�3��
�����������h�
�6�6��=�=��	���	�	�	�
������h��.�.�/�/�/������h��}�=�=�t�D�D��	���	�	�	������h��x�8�8�$�?�?��	���	�	�	����7�<�<���d�3�3��
�����������h�
�6�6��=�=��	���	�	�	�
������h�(C�D�D�E�E�E������h�(C�]�S�S�UY�Z�Z��	���	�	�	������h�(C�X�N�N�PT�U�U��	���	�	�	�
�
�
��F�E�w�4�d�l�^�D�D�E�E�E�������*�*�*��	!�	!�C��|�|�E�"�"�
����C� � �	!�	!rc�&�d}d}d}tj�|j|��}t	j|d��}|�|dzd��|�|dz|zdzd��|�|dz|zdzd��|�|dzd��|�|dz|zdzd��|�|dz|zdzd��|���tj�	d	|��gd
�}d�tj|g��D��}|�||��tjd	=|D]%}|�
d��r�tj|=�&d
S)zBTests the same as test_walkpackages_filesys, only with a zip file.ztest_walkpackages_zipfile.zip�test_walkpackages_zipfiler"r7r8r9�/z/mod.pyr)r"zsub.test_walkpackages_zipfilez!sub.test_walkpackages_zipfile.modrmztest_walkpackages_zipfile.subz!test_walkpackages_zipfile.sub.modc��g|]
}|d��Sr]r_r`s  rrcz:PkgutilTests.test_walkpackages_zipfile.<locals>.<listcomp>�s��A�A�A�!��1��A�A�ArrdN)r$rr%rr;r<r=r(rrr*rTr,rer-)	rrCrfrhrDrErjrkr.s	         rrmz&PkgutilTests.test_walkpackages_zipfile�s���.��*�����7�<�<���c�2�2���O�H�c�*�*��	�
�
�4�.�(�"�-�-�-�	�
�
�4�#�:��$�~�5�r�:�:�:�	�
�
�4�#�:��$�y�0�"�5�5�5�	�
�
�4�.�(�"�-�-�-�	�
�
�4�#�:��$�~�5�r�:�:�:�	�
�
�4�#�:��$�y�0�"�5�5�5�	���	�	�	������8�$�$�$�
�
�
��B�A�w�4�h�Z�@�@�A�A�A�������*�*�*��H�Q�K��	!�	!�C��|�|�E�"�"�
����C� � �	!�	!rc�x�d}|�ttf��5tt	j|����ddd��n#1swxYwYd}|�ttf��5tt	j|����ddd��dS#1swxYwYdS)N�test_dirstest_dir)�assertRaises�	TypeErrorrLrMr*rT)r�	str_input�bytes_inputs   r�2test_walk_packages_raises_on_string_or_bytes_inputz?PkgutilTests.test_walk_packages_raises_on_string_or_bytes_input�s+���	�
�
�
�	�:�6�
7�
7�	3�	3���&�y�1�1�2�2�2�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3����	3�	3�	3�	3�"��
�
�
�	�:�6�
7�
7�	5�	5���&�{�3�3�4�4�4�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5����	5�	5�	5�	5�	5�	5s#�"A�A�A�"B/�/B3�6B3c��ddl}ddl}dtfdtjfdtjjfd|fd|fd|jfd|jfd	|jjfd
|jjfd|jjjfd|jjjfd
tfdtfdtj	fdtj	fdtfdtfdtjff}dtfdtfdtfdtfdtfdtfdtfdtfdtfdtfdtfdtfdtfd tfd!tfd"tfd#tff}d$}|D�]}tj�|j|��}	tj|d�%��n#t$$rY�LwxYwtj�|d&��}t'|d'��5}|�d��|���ddd��n#1swxYwYt-j��t-j|��}|||ffz
}t3|��dkr||dd(�tffz
}��|d)tffz
}|D]]\}	}
|�|	�*��5t7j|	��}|�||
��ddd��n#1swxYwY�^|D]t\}	}|�|	�*��5|�|��5t7j|	��ddd��n#1swxYwYddd��n#1swxYwY�udS)+Nrr$zos.pathzos.path:pathsep�loggingzlogging:zlogging.handlerszlogging.handlers:zlogging.handlers:SysLogHandlerzlogging.handlers.SysLogHandlerz(logging.handlers:SysLogHandler.LOG_ALERTz(logging.handlers.SysLogHandler.LOG_ALERTzbuiltins.intzbuiltins:intzbuiltins.int.from_byteszbuiltins:int.from_byteszbuiltins.ZeroDivisionErrorzbuiltins:ZeroDivisionErrorzos:pathr^g@Tr9z?abczabc/foo�foozos.foozos.foo:zos.pth:pathsepzlogging.handlers:NoSuchHandlerz,logging.handlers:SysLogHandler.NO_SUCH_VALUEz,logging.handlers.SysLogHandler.NO_SUCH_VALUE�ZeroDivisionErrorzos.path.9abc�9abc)	u	वमस�é�Èu안녕하세요uさよならuありがとうuХорошоuспасибоu现代汉语常用字表��exist_okrr7���u०वमस)�s)rx�logging.handlersr$r�pathsep�handlers�
SysLogHandler�	LOG_ALERT�int�
from_bytesrzrsrL�ImportError�AttributeErrorr%r�makedirs�UnicodeEncodeErrorr'r)�flush�	importlib�invalidate_caches�
import_module�len�subTestr*�resolve_namer,rr)
rrx�
success_cases�
failure_cases�
unicode_words�uwrWr1rdr�rj�o�excs
             r�test_name_resolutionz!PkgutilTests.test_name_resolution�s������������2�J�
��� �
����0�
�� �
��!�
��!1�2�
 �'�"2�3�
-�w�/?�/M�N�
-�w�/?�/M�N�
7�� �.�8�
:�
7�� �.�8�
:�
�S�!�
�S�!�
&���7�
&���7�
)�+<�=�
)�+<�=�
��� �)
�
�0�9��
�	�N�
�)��
�9��
���
�Z� �
�
�#�
�K� �
�~�&�
��$�
�{�+�
-�~�>�
;�^�L�
;�^�L�
 �+�.�
�Z�(�
�Z� �#
�
�,M�
� �	9�	9�B�����T�\�2�.�.�A�
���A��-�-�-�-�-��&�
�
�
���
��������Q�
�.�.�A��a����
������������	�	�	�
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�

�'�)�)�)��)�"�-�-�C��b�#�Y�Z�'�M��2�w�w��{�{��"�S�b�S�'�;�!7�!8�8�
��	�4�j�A�B�B�
�(�	.�	.�K�A�x������"�"�
.�
.��(��+�+��� � ��H�-�-�-�
.�
.�
.�
.�
.�
.�
.�
.�
.�
.�
.����
.�
.�
.�
.��$�	,�	,�F�A�s������"�"�
,�
,��&�&�s�+�+�,�,��(��+�+�+�,�,�,�,�,�,�,�,�,�,�,����,�,�,�,�
,�
,�
,�
,�
,�
,�
,�
,�
,�
,�
,����
,�
,�
,�
,��	,�	,sl�F�
F(�'F(�*H�H	�H	�+K�K	�K	�?M
�L6�*M
�6L:�:M
�=L:�>M
�
M	�M	N)
�__name__�
__module__�__qualname__rrrr6rPrYr[rmrvr�r_rrr	r	s�������)�)�)�
������:!�!�!�F%7�%7�%7�N	2�	2�	2�&!�&!�&!�P!!�!!�!!�F5�5�5�Y,�Y,�Y,�Y,�Y,rr	c�^�eZdZGd�de��ZGd�de��Zd�Zd�Zd�Zd�Z	d	S)
�PkgutilPEP302Testsc� �eZdZd�Zd�Zd�ZdS)�PkgutilPEP302Tests.MyTestLoaderc��dS�Nr_)r�specs  r�
create_modulez-PkgutilPEP302Tests.MyTestLoader.create_moduleEs���4rc�R�|j�dd��dz|jd<dS)N�loadsrr^)�__dict__�get)rrds  r�exec_modulez+PkgutilPEP302Tests.MyTestLoader.exec_moduleHs+��$'�L�$4�$4�W�a�$@�$@�1�$D�C�L��!�!�!rc��dS)N�
Hello, world!r_)rrs  rr+z(PkgutilPEP302Tests.MyTestLoader.get_dataLs��"�?rN)r�r�r�r�r�r+r_rr�MyTestLoaderr�DsD������	�	�	�	E�	E�	E�	#�	#�	#�	#�	#rr�c��eZdZdd�ZdS)�!PkgutilPEP302Tests.MyTestImporterNc�t�t���}t|d|jjz|g���S)Nz<%s>)�loader�submodule_search_locations)r�r�r�	__class__r�)r�fullnamer�targetr�s     r�	find_specz+PkgutilPEP302Tests.MyTestImporter.find_specPsD��'�4�4�6�6�F�*�8�+1�F�4D�4M�+M�28�FH�J�J�J�
Jr)NN)r�r�r�r�r_rr�MyTestImporterr�Os.������	J�	J�	J�	J�	J�	Jrr�c�j�tj�d|�����dSr)r�	meta_pathrr�rs rrzPkgutilPEP302Tests.setUpWs,���
���Q�� 3� 3� 5� 5�6�6�6�6�6rc� �tjd=dSr)rr�rs rrzPkgutilPEP302Tests.tearDownZs���M�!���rc�r�|�tjdd��d��tjd=dS)Nry�dummyr�)r,r*r+rr-rs r�test_getdata_pep302z&PkgutilPEP302Tests.test_getdata_pep302]s5������)�%��9�9�?�K�K�K��K����rc���ddl}|�|jd��|�tjdd��d��|�|jd��t
jd=dS)Nrr^ryr�r�)ryr,r�r*r+rr-)rrys  r�test_alreadyloadedz%PkgutilPEP302Tests.test_alreadyloadedbsp��	�
�
�
������A�&�&�&�����)�%��9�9�?�K�K�K������A�&�&�&��K����rN)
r�r�r��objectr�r�rrr�r�r_rrr�r�Bs�������	#�	#�	#�	#�	#�v�	#�	#�	#�J�J�J�J�J��J�J�J�7�7�7�������
����rr�c�,�eZdZd�Zd�Zd�Zd�Zd�ZdS)�ExtendPathTestsc��tj��}tj�d|��t
j�||��}tj|��tt
j�|d��d��5}|�	d��ddd��n#1swxYwY|S)Nrrr7zKfrom pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
)
rr
rrrr$r%r&r'r))r�pkgnamer�pkgdir�fls     r�create_initzExtendPathTests.create_initps����"�$�$�������7�#�#�#�����g�w�/�/��
������
�"�'�,�,�v�}�5�5�s�
;�
;�	f�r��H�H�d�e�e�e�	f�	f�	f�	f�	f�	f�	f�	f�	f�	f�	f����	f�	f�	f�	f��s�B8�8B<�?B<c���tj�|||dz��}t|d��5}t	d�|��|���ddd��dS#1swxYwYdS)N�.pyr7zvalue={})�file)r$rr%r'�print�format)rrr��submodule_name�value�module_namer�s       r�create_submodulez ExtendPathTests.create_submodule{s����g�l�l�7�G�^�e�5K�L�L��
�+�s�
#�
#�	5�r��*�#�#�E�*�*��4�4�4�4�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5����	5�	5�	5�	5�	5�	5s�%A'�'A+�.A+c
��d}|�|��}|�|��}|�||dd��|�||dd��ddl}ddl}|�|jjd��|�|jjd��|�t|j	��ttj�||��tj�||��g����tj|��tj|��tjd=tjd=tjd=tjd=tjd=dS)Nry�barr�bazr^�foo.bar�foo.baz)r�r��foo.bar�foo.bazr,r�r�r��sorted�__path__r$rr%rrrr-�rr��	dirname_0�	dirname_1rys     r�test_simplezExtendPathTests.test_simple�sb�����$�$�W�-�-�	��$�$�W�-�-�	����i��%��;�;�;����i��%��;�;�;����������������*�*�*��������*�*�*�	
������-�-������i��!A�!A�!#����i��!A�!A�!C�D�D�	E�	E�	E�
	�
�i� � � ��
�i� � � ��H�Q�K��H�Q�K��K����K�	�"��K�	�"�"�"rc���tj}tj}d}d}|�|��}tj�||��}d�||��}tj	�
|d��tj	�
|d��	|�|||d��tj
|��t||����}||��}	|D]�}
tj|
|��}|j}	|j}n#t"$rYnwxYw|�|
tjj��|�|
|	��|�|tjj��|�tj|
|������|�t2��5t|d����ddd��n#1swxYwY|�t2��5t|d����ddd��n#1swxYwYt5j|��tjd=	tj	d=tj	d=dS#t8$rYdSwxYw#t5j|��tjd=	tj	d=tj	d=w#t8$rYwwxYwxYw)N�spam�eggsz{}.{}rzinvalid.modulez.spamz	spam.eggs)r*�iter_importers�get_importerr�r$rr%r�rr-rJr�r�r�rM�	_get_specr�r�r?�	machinery�
FileFinderr,�SourceFileLoader�assertIsNonerrr�rr�KeyError)
rr�r�r��modnamer�pathitemr��	importers�expected_importer�finderr�r�s
             r�test_iter_importersz#ExtendPathTests.test_iter_importers�so�� �/���+�������"�"�7�+�+���7�<�<���1�1���>�>�'�7�3�3�������$�'�'�'�������&�&�&�"	��!�!�'�7�G�Q�?�?�?��#�H�-�-�-��^�^�H�5�5�6�6�I� ,��X� 6� 6��#�

F�

F���(���:�:������#�]�F�F��%�����D������%�%�f�i�.A�.L�M�M�M�� � ��):�;�;�;��%�%�f�&/�&9�&J�L�L�L��!�!�'�"3�F�G�"D�"D�E�E�E�E��"�"�;�/�/�
7�
7��^�^�$4�5�5�6�6�6�
7�
7�
7�
7�
7�
7�
7�
7�
7�
7�
7����
7�
7�
7�
7��"�"�;�/�/�
.�
.��^�^�G�,�,�-�-�-�
.�
.�
.�
.�
.�
.�
.�
.�
.�
.�
.����
.�
.�
.�
.�
�M�'�"�"�"�����
��K��'��K��,�,�,���
�
�
����
�����
�M�'�"�"�"�����
��K��'��K��,�,���
�
�
���
������s��)A/J�D!� J�!
D.�+J�-D.�.B&J�G9�-J�9G=�=J�G=�J�I�7J�I�J�
I�J�0J�
J�J�"K+�K�K+�
K(�%K+�'K(�(K+c
�l�d}|�|��}|�|��}|�||dd��tjtj�||d����|�||dd��ddl}ddl}|�|j	j
d��|�|jj
d��|�t|j
��ttj�||��tj�||��g����tj|��tj|��t jd=t jd=t jd=t jd=t jd=dS)	Nryr�rrr�r^r�r�)r�r�r$�unlinkrr%r�r�r,r�r�r�r�r�rrrr-r�s     r�test_mixed_namespacez$ExtendPathTests.test_mixed_namespace�s������$�$�W�-�-�	��$�$�W�-�-�	����i��%��;�;�;�
�	�"�'�,�,�y�'�=�A�A�B�B�B����i��%��;�;�;����������������*�*�*��������*�*�*�	
������-�-������i��!A�!A�!#����i��!A�!A�!C�D�D�	E�	E�	E�
	�
�i� � � ��
�i� � � ��H�Q�K��H�Q�K��K����K�	�"��K�	�"�"�"rN)r�r�r�r�r�r�r�r�r_rrr�r�os`������	�	�	�5�5�5�
#�#�#�:-�-�-�`#�#�#�#�#rr�c�&�eZdZd�Zd�Zd�Zd�ZdS)�NestedNamespacePackageTestc�h�tj��|_tjdd�|_dSr�)rr
�basedirrr�old_pathrs rrz NestedNamespacePackageTest.setUp�s'���'�)�)����������
�
�
rc�d�|jtjdd�<tj|j��dSr�)r�rrrrr�rs rrz#NestedNamespacePackageTest.tearDown�s+���m��������
�d�l�#�#�#�#�#rc��|�dd��\}}tj�|j|�dtjj����}tj|d���ttj�||dz��d��5}|�	|��ddd��dS#1swxYwYdS)N�.r^Tr~r�r7)
�rsplitr$rr%r��replace�sepr�r'r))rrB�contents�base�final�	base_pathr1s       rr�z(NestedNamespacePackageTest.create_module�s����k�k�#�q�)�)���e��G�L�L���t�|�|�C����/M�/M�N�N�	�
��I��-�-�-�-�
�"�'�,�,�y�%�%�-�8�8�#�
>�
>�	�!�
�G�G�H����	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�)C�C�Cc��d}|�d|��|�d|��|�d|��|�d|��|�dd��|�dd	��tj�d
tj�|jd����tj�d
tj�|jd����d
dl}|�td
��|�
t|j��d��d
dl
}|�td��|�
t|jj��d��d
dlm}d
dlm}|�
|d��|�
|d��dS)NzBimport pkgutil; __path__ = pkgutil.extend_path(__path__, __name__)za.pkg.__init__zb.pkg.__init__za.pkg.subpkg.__init__zb.pkg.subpkg.__init__za.pkg.subpkg.czc = 1zb.pkg.subpkg.dzd = 2r�a�br.�z
pkg.subpkg)�c)rWr^)r�rrrr$r%r�r.rrr,r�r��
pkg.subpkg�subpkg�pkg.subpkg.cr�pkg.subpkg.drW)r�pkgutil_boilerplater.rrWs     r�test_nestedz&NestedNamespacePackageTest.test_nested�s���
A�	�	
���+�-@�A�A�A����+�-@�A�A�A����2�4G�H�H�H����2�4G�H�H�H����+�W�5�5�5����+�W�5�5�5������2�7�<�<���c�:�:�;�;�;������2�7�<�<���c�:�:�;�;�;��
�
�
������&�&�&�����S�\�*�*�A�.�.�.����������-�-�-�����S�Z�0�1�1�1�5�5�5�"�"�"�"�"�"�"�"�"�"�"�"�����A��������A�����rN)r�r�r�rrr�rr_rrr�r��sP������$�$�$�$�$�$��������rr�c��eZdZd�Zd�Zd�Zd�Zejedkd��d���Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�ZdS)�ImportlibMigrationTestsc�.�tdtf��S)Nz[This emulation is deprecated and slated for removal in Python 3.12; use 'importlib' instead)r�DeprecationWarningrs r�check_deprecatedz(ImportlibMigrationTests.check_deprecateds!���4�
�
!�"�"�	"rc��|���5tjd��ddd��dS#1swxYwYdS�Nr9)rr*�ImpImporterrs r�test_importer_deprecatedz0ImportlibMigrationTests.test_importer_deprecated s���
�
"�
"�
$�
$�	$�	$����#�#�#�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$����	$�	$�	$�	$�	$�	$s�7�;�;c��|���5tjdddd��ddd��dS#1swxYwYdSr)rr*�	ImpLoaderrs r�test_loader_deprecatedz.ImportlibMigrationTests.test_loader_deprecated$s���
�
"�
"�
$�
$�	.�	.���b�"�b�"�-�-�-�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.�	.�	.s
�:�>�>c��t��5}|�tjd����|�tjd����|�tjd����|�t|j��d��ddd��dS#1swxYwYdS�Nrr$ztest.supportr)r�assertIsNotNoner*�
get_loaderr,r��warnings�rr7s  r� test_get_loader_avoids_emulationz8ImportlibMigrationTests.test_get_loader_avoids_emulation(s���
�
�
�	1��� � ��!3�E�!:�!:�;�;�;�� � ��!3�D�!9�!9�:�:�:�� � ��!3�N�!C�!C�D�D�D����S���_�_�a�0�0�0�		1�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1����	1�	1�	1�	1�	1�	1��BB:�:B>�B>�__main__znot compatible with __main__c��t}b	t��5}|�tjt
����|�t|j��d��ddd��n#1swxYwY|adS#|awxYwr)	�
__loader__rrr*rr�r,r�r)r�this_loaderr7s   r�0test_get_loader_handles_missing_loader_attributezHImportlibMigrationTests.test_get_loader_handles_missing_loader_attribute/s���!���	%��!�!�
5�Q��$�$�W�%7��%A�%A�B�B�B�� � ��Q�Z���!�4�4�4�
5�
5�
5�
5�
5�
5�
5�
5�
5�
5�
5����
5�
5�
5�
5�%�J�J�J���J�$�$�$�$s/�B�AA9�-B�9A=�=B�A=�B�Bc��d}tt��|��}|`t|��5|tj|<tj|��}ddd��n#1swxYwY|�|��dS�Nr���typer�__spec__rr-r*rr��rrBrdr�s    r�.test_get_loader_handles_missing_spec_attributezFImportlibMigrationTests.test_get_loader_handles_missing_spec_attribute;s������d�3�i�i��o�o���L�
��
�
�	.�	.� #�C�K����'��-�-�F�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.�	
���&�!�!�!�!�!s�$A!�!A%�(A%c��d}tt��|��}d|_t|��5|tj|<tj|��}ddd��n#1swxYwY|�|��dSr&r'r*s    r�+test_get_loader_handles_spec_attribute_nonezCImportlibMigrationTests.test_get_loader_handles_spec_attribute_noneDs������d�3�i�i��o�o�����
��
�
�	.�	.� #�C�K����'��-�-�F�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.�	
���&�!�!�!�!�!s�$A&�&A*�-A*c��d}dtj|<	tj|��}tj|=n#tj|=wxYw|�|��dS�Nz
totally bogus)rr-r*rr��rrBr�s   r�#test_get_loader_None_in_sys_modulesz;ImportlibMigrationTests.test_get_loader_None_in_sys_modulesMse���� ���D��	"��'��-�-�F���D�!�!����D�!�!�!�!�!����&�!�!�!�!�!s	�5�Ac�\�d}tj|��}|�|��dSr/)r*�find_loaderr�r0s   r�test_find_loader_missing_modulez7ImportlibMigrationTests.test_find_loader_missing_moduleVs1�����$�T�*�*�����&�!�!�!�!�!rc��t��5}|�tjd����|�tjd����|�tjd����|�t|j��d��ddd��dS#1swxYwYdSr)rrr*r3r,r�rrs  r�!test_find_loader_avoids_emulationz9ImportlibMigrationTests.test_find_loader_avoids_emulation[s���
�
�
�	1��� � ��!4�U�!;�!;�<�<�<�� � ��!4�T�!:�!:�;�;�;�� � ��!4�^�!D�!D�E�E�E����S���_�_�a�0�0�0�		1�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1����	1�	1�	1�	1�	1�	1rc���t��5}|�tjd����|�t|j��d��ddd��dS#1swxYwYdS)Nz*??r)rr�r*r�r,r�rrs  r�"test_get_importer_avoids_emulationz:ImportlibMigrationTests.test_get_importer_avoids_emulationbs���
�
�
�	1�����g�2�5�9�9�:�:�:����S���_�_�a�0�0�0�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1����	1�	1�	1�	1�	1�	1s�AA,�,A0�3A0c��	tjtd����dS#t$r|�d��YdSwxYw)Nz/homez3Unexpected AttributeError when calling get_importer)r*r�rr�rUrs r�test_issue44061z'ImportlibMigrationTests.test_issue44061hs`��	M�� ��g���/�/�/�/�/���	M�	M�	M��I�I�K�L�L�L�L�L�L�	M���s�!%�A�Ac���t��5}tj��D]}�|�t	|j��d��ddd��dS#1swxYwYdSr)rr*r�r,r�r)rr7�importers   r�$test_iter_importers_avoids_emulationz<ImportlibMigrationTests.test_iter_importers_avoids_emulationns���
�
�
�	1��#�2�4�4�:�:������S���_�_�a�0�0�0�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1����	1�	1�	1�	1�	1�	1s�?A�A�"AN)r�r�r�rrrr�unittest�skipIfr$r+r-r1r4r6r8r:r=r_rrr
r
s�������
"�"�"�$�$�$�.�.�.�1�1�1��X�_�X��+�-K�L�L�	%�	%�M�L�	%�"�"�"�"�"�"�"�"�"�"�"�"�
1�1�1�1�1�1�M�M�M�1�1�1�1�1rr
c�f�ddl}ddl}|j���|j��dSr)�	zipimportr��_zip_directory_cache�clearr�)rAr�s  r�tearDownModulerDtsF����������
�"�(�(�*�*�*��I��!�!�!�!�!rr )�pathlibr�test.support.import_helperrr�test.support.warnings_helperrr>rr��importlib.utilrr*r$�os.pathrrr;�TestCaser	r�r�r�r
rDr��mainr_rr�<module>rLs���������:�:�:�:�:�:�:�:�7�7�7�7�7�7�����
�
�
�
�����2�2�2�2�2�2�����	�	�	�	���������
�
�
�
�����j,�j,�j,�j,�j,�8�$�j,�j,�j,�Z	(�(�(�(�(��*�(�(�(�Zx#�x#�x#�x#�x#�h�'�x#�x#�x#�z&�&�&�&�&��!2�&�&�&�R\1�\1�\1�\1�\1�h�/�\1�\1�\1�~"�"�"��z����H�M�O�O�O�O�O��r