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_metadata_api.cpython-311.pyc
�

��Vc
/�	�j�ddlZddlZddlZddlZddlZddlZddlmZddlm	Z	m
Z
mZmZm
Z
mZmZmZejd���ZGd�dejejejejej��ZGd�d	ejej��ZGd
�dejej��ZGd�d
ej��ZdS)�N�)�fixtures)�Distribution�PackageNotFoundError�distribution�entry_points�files�metadata�requires�versionc#�K�tjd���5}tjdt���|V�ddd��dS#1swxYwYdS)NT)�record�default)�category)�warnings�catch_warnings�simplefilter�DeprecationWarning)�ctxs �9D:\Python311\Lib\test\test_importlib\test_metadata_api.py�suppress_known_deprecationrs�����	�	 ��	-�	-�	-�����i�2D�E�E�E�E��	�	�	���������������������s� A�A	�A	c���eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zed���Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"d �Z#d!S)"�APITestsz\d+\.\d+(\.\d)?c��td��}t|t��sJ�tj|j|��sJ�dS�N�egginfo-pkg�r�
isinstance�str�re�match�version_pattern��self�pkg_versions  r�test_retrieves_version_of_selfz'APITests.test_retrieves_version_of_self&sF���m�,�,���+�s�+�+�+�+�+��x��,�k�:�:�:�:�:�:�:�c��td��}t|t��sJ�tj|j|��sJ�dS�N�distinfo-pkgrr#s  r�&test_retrieves_version_of_distinfo_pkgz/APITests.test_retrieves_version_of_distinfo_pkg+sF���n�-�-���+�s�+�+�+�+�+��x��,�k�:�:�:�:�:�:�:r'c��|�t��5td��ddd��dS#1swxYwYdS)Nzdoes-not-exist)�assertRaisesrr�r$s r�test_for_name_does_not_existz%APITests.test_for_name_does_not_exist0s���
�
�
�3�
4�
4�	+�	+��)�*�*�*�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+����	+�	+�	+�	+�	+�	+s�8�<�<c��d}|D]P}|�|��5t|��jddksJ�	ddd��n#1swxYwY�QdS�N)�pkg.dot�pkg_dotzpkg-dotzpkg..dotzPkg.Dot�Namer2��subTestrr
�r$�names�names   r�test_name_normalizationz APITests.test_name_normalization4���F���	H�	H�D����d�#�#�
H�
H�#�D�)�)�2�6�:�i�G�G�G�G�G�
H�
H�
H�
H�
H�
H�
H�
H�
H�
H�
H����
H�
H�
H�
H��	H�	H��!A
�
A	�A	c���d}|D]p}|�|��5|�t��5t|��ddd��n#1swxYwYddd��n#1swxYwY�qdS)N)�p�pkgzpkg.)r6r-rr)r$�prefixes�prefixs   r�test_prefix_not_matchedz APITests.test_prefix_not_matched:s��%���	)�	)�F����f�%�%�
)�
)��&�&�';�<�<�)�)� ��(�(�(�)�)�)�)�)�)�)�)�)�)�)����)�)�)�)�
)�
)�
)�
)�
)�
)�
)�
)�
)�
)�
)����
)�
)�
)�
)��	)�	)s4�A*�A�A*�A�A*�A�A*�*A.	�1A.	c��|�td���d�����d��dS)Nr�
top_level.txt�mod)�assertEqualr�	read_text�stripr.s r�test_for_top_levelzAPITests.test_for_top_levelAsK�������'�'�1�1�/�B�B�H�H�J�J�E�	
�	
�	
�	
�	
r'c��d�td��D��d}|�|���d��dS)Nc�(�g|]}|jdk�
|��S)rD�r9)�.0�paths  r�
<listcomp>z+APITests.test_read_text.<locals>.<listcomp>Gs4��
�
�
��T�Y�/�5Q�
��
�
�
r'rrzmod
)r	rFrG)r$�	top_levels  r�test_read_textzAPITests.test_read_textFsZ��
�
�"�=�1�1�
�
�
�
�
�	�	
����,�,�.�.��8�8�8�8�8r'c��t��}d|jvsJ�|�d���}d|jvsJ�|d}|�|jd��|�|jg��dS)N�entries��group�mainzmod:main)r�groups�selectr8rF�value�extras)r$�epsrS�eps    r�test_entry_pointszAPITests.test_entry_pointsLs����n�n���C�J�&�&�&�&��*�*�9�*�-�-�����&�&�&�&�
�V�_�������:�.�.�.������B�'�'�'�'�'r'c��td���}dD]J}||}|�|jjd��|�|jjd���KdS)NrSrT)rV�ns:sub)r*r�1.0.0)r�assertIn�distr9rFr)r$rS�entryr\s    r�test_entry_points_distributionz'APITests.test_entry_points_distributionUsj���Y�/�/�/��'�	7�	7�E����B��M�M�"�'�,�(G�H�H�H����R�W�_�g�6�6�6�6�	7�	7r'c�Z�|j�tj����}|j�|�|����dddd�i}tj||��td���}t
d�|D����rJ�d|jvsJ�d	S)
zr
        Entry points should only be exposed for the first package
        on sys.path with a given name.
        zdistinfo_pkg-1.1.0.dist-infozS
                Name: distinfo-pkg
                Version: 1.1.0
                zJ
                [entries]
                main = mod:altmain
            )�METADATAzentry_points.txtrSrTc3�VK�|]$}|jjdko|jjdkV��%dS)r*r`N)rbr9r)rMr\s  r�	<genexpr>z=APITests.test_entry_points_unique_packages.<locals>.<genexpr>qsM����
�
��
�G�L�N�*�I�r�w��'�/I�
�
�
�
�
�
r'r_N)r�
enter_context�tempdir�add_sys_path�build_filesr�anyr8)r$�alt_site_dir�alt_pkgrSs    r�!test_entry_points_unique_packagesz*APITests.test_entry_points_unique_packages\s���
�}�2�2�8�3C�3E�3E�F�F���
�#�#�D�$5�$5�l�$C�$C�D�D�D�*��%�	-�	-�
��	��W�l�3�3�3��Y�/�/�/���
�
��
�
�
�
�
�	
�	
�	
�
�w�}�,�,�,�,�,�,r'c��|�t��5td���dddd��dS#1swxYwYdS)NrSrT�missing)r-�KeyErrorrr.s r�test_entry_points_missing_namez'APITests.test_entry_points_missing_namexs���
�
�
�x�
(�
(�	5�	5��y�)�)�)�)�4�4�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5����	5�	5�	5�	5�	5�	5s�?�A�Ac�2�td���dksJ�dS)NrrrT�)rr.s r�test_entry_points_missing_groupz(APITests.test_entry_points_missing_group|s$���)�,�,�,��2�2�2�2�2�2r'c�Z�t��5}ttd�����}ddd��n#1swxYwYd|vsJ�|dtd���dksJ�tt	|����}|jtusJ�dt|��vsJ�dS)z�
        Prior versions of entry_points() returned simple lists and
        allowed casting those lists into maps by name using ``dict()``.
        Capture this now deprecated use-case.
        rSrTNrVz1Construction of dict of EntryPoints is deprecated)r�dictr�next�iterrrr)r$�caughtr[�expecteds    r�#test_entry_points_dict_constructionz,APITests.test_entry_points_dict_constructions���(�
)�
)�	6�V��|�)�4�4�4�5�5�C�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6����	6�	6�	6�	6���}�����6�{�l��;�;�;�F�C�C�C�C�C���V���%�%��� �$6�6�6�6�6�B�c�(�m�m�S�S�S�S�S�Ss
�9�=�=c��td��j}t��5}|dddd��n#1swxYwYtt	|����}|jtusJ�dt|��vsJ�dS)z�
        Prior versions of Distribution.entry_points would return a
        tuple that allowed access by index.
        Capture this now deprecated use-case
        See python/importlib_metadata#300 and bpo-44246.
        r*rNz-Accessing entry points by index is deprecated)rrrrzr{rrr)r$r[r|r}s    r�test_entry_points_by_indexz#APITests.test_entry_points_by_index�s����>�*�*�7��
'�
)�
)�	�V���F�F�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	���V���%�%��� �$6�6�6�6�6�>�#�h�-�-�O�O�O�O�O�Os�	8�<�<c�,�t��5t��dtd���k|�t��5t��dddd��n#1swxYwYddd��dS#1swxYwYdS)z�
        Prior versions of entry_points() returned a dict. Ensure
        that callers using '.__getitem__()' are supported but warned to
        migrate.
        rSrTrrN)rrr-rsr.s r� test_entry_points_groups_getitemz)APITests.test_entry_points_groups_getitem�s��(�
)�
)�	*�	*��N�N�9�%��I�)F�)F�)F�F�F��"�"�8�,�,�
*�
*����y�)�)�
*�
*�
*�
*�
*�
*�
*�
*�
*�
*�
*����
*�
*�
*�
*�	*�	*�	*�	*�	*�	*�	*�	*�	*�	*�	*�	*����	*�	*�	*�	*�	*�	*s6�AB	�A1�%B	�1A5	�5B	�8A5	�9B	�	B
�B
c�\�t��5t���dd��dkt���dd��t��dkt���dd��dkddd��dS#1swxYwYdS)z�
        Prior versions of entry_points() returned a dict. Ensure
        that callers using '.get()' are supported but warned to
        migrate.
        rrrrSrvN)rr�getr.s r�test_entry_points_groups_getz%APITests.test_entry_points_groups_get�s���(�
)�
)�	4�	4��N�N���y�)�4�4�	�A�A��N�N���y�)�4�4����y�8Q�Q�Q��N�N���y�"�-�-��3�3�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4����	4�	4�	4�	4�	4�	4s�BB!�!B%�(B%c��t���dd���}|�t��5d|_ddd��dS#1swxYwYdS)NrSrV)rUr9�)rrXr-�AttributeError�foo)r$r\s  r�&test_entry_points_allows_no_attributesz/APITests.test_entry_points_allows_no_attributes�s���
�^�^�
"�
"���
"�
@�
@��
�
�
�~�
.�
.�	�	��B�F�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�A�A�Ac��td��}|ddksJ�|ddksJ�|ddksJ�|�d��}d|vsJ�dS)	Nr�authorz	Steven Ma�LICENSE�Unknownr4�
Classifierz*Topic :: Software Development :: Libraries)r
�get_all)r$�md�classifierss   r�test_metadata_for_this_packagez'APITests.test_metadata_for_this_package�sv��
�m�
$�
$���(�|�{�*�*�*�*��)�}�	�)�)�)�)��&�z�]�*�*�*�*��j�j��.�.��;�{�J�J�J�J�J�Jr'c���|dj}|D]�}|j|ksJ�|jr|jjsJ�|jr|jjdksJ�|jr
|jdksJ�|������sJ�t|���t��sJ�|j
�d��r|�����dS)Nr�sha256z.py)
�root�hashrY�mode�size�locate�existsr�read_binary�bytesr9�endswithrG)r	r��files   r�_test_fileszAPITests._test_files�s����Q�x�}���	!�	!�D��9��$�$�$�$��y�3�D�I�O�3�3�3��y�>�D�I�N�h�$>�>�>�>��y�2�D�I��N�2�2�2��;�;�=�=�'�'�)�)�)�)�)��d�.�.�0�0�%�8�8�8�8�8��y�!�!�%�(�(�
!���� � � ��	!�	!r'c��d�td��D��d}|�t|j��d��dS)Nc�(�g|]}|jdk�
|��S)zmod.pyrL)rMr>s  rrOz0APITests.test_file_hash_repr.<locals>.<listcomp>�s$��G�G�G�a�A�F�h�4F�G��G�G�Gr'r*rz!<FileHash mode: sha256 value: .*>)r	�assertRegex�reprr�)r$�utils  r�test_file_hash_reprzAPITests.test_file_hash_repr�sG��G�G�5��0�0�G�G�G��J������d�i���*M�N�N�N�N�Nr'c�J�|�td����dSr)�r�r	r.s r�test_files_dist_infozAPITests.test_files_dist_info�s$������~�.�.�/�/�/�/�/r'c�J�|�td����dSrr�r.s r�test_files_egg_infozAPITests.test_files_egg_info�s$������}�-�-�.�.�.�.�.r'c�L�|�td��d��dS)N�egginfo-filez0.1)rFrr.s r�test_version_egg_info_filez#APITests.test_version_egg_info_file�s&�������0�0�%�8�8�8�8�8r'c�N�td��}|�|��dS)Nr�)r�assertIsNone)r$�requirementss  r�test_requires_egg_info_filez$APITests.test_requires_egg_info_file�s)����/�/�����,�'�'�'�'�'r'c��td��}t|��dksJ�td�|D����sJ�dS)Nr�c3�"K�|]
}|dkV��dS)z%wheel >= 1.0; python_version >= "2.7"Nrv)rM�deps  rrhz2APITests.test_requires_egg_info.<locals>.<genexpr>�s(����R�R�c�3�A�A�R�R�R�R�R�Rr')r�lenrm�r$�depss  r�test_requires_egg_infozAPITests.test_requires_egg_info�sN���
�&�&���4�y�y�A�~�����R�R�T�R�R�R�R�R�R�R�R�R�Rr'c��tjddi|j�d����t	d��}|gksJ�dS)Nzrequires.txt�zegginfo_pkg.egg-infor)rrl�site_dir�joinpathrr�s  r�test_requires_egg_info_emptyz%APITests.test_requires_egg_info_empty�s\������
�
�M�"�"�#9�:�:�		
�	
�	
��
�&�&���r�z�����r'c��td��}t|��dksJ�t|��sJ�d|vsJ�d|vsJ�dS)Nr*r�zwheel >= 1.0zpytest; extra == 'test')rr��allr�s  r�test_requires_dist_infoz APITests.test_requires_dist_info�s_����'�'���4�y�y�A�~�����4�y�y������%�%�%�%�(�D�0�0�0�0�0�0r'c��tjd��}ttj|����}gd�}||ksJ�dS)Na
            dep1
            dep2

            [:python_version < "3"]
            dep3

            [extra1]
            dep4
            dep6@ git+https://example.com/python/dep.git@v1.0.0

            [extra2:python_version < "3"]
            dep5
            )�dep1�dep2zdep3; python_version < "3"zdep4; extra == "extra1"z2dep5; (python_version < "3") and extra == "extra2"zGdep6@ git+https://example.com/python/dep.git@v1.0.0 ; extra == "extra1")�textwrap�dedent�sortedr�_deps_from_requires_text)r$rr�r}s    r�$test_more_complex_deps_requires_textz-APITests.test_more_complex_deps_requires_text�s\���?�

�
�
�� �l�;�H�E�E�F�F��
�
�
���x������r'c���td��j}d|vsJ�|dddgksJ�|d}|�d��sJ�t|d��d	ksJ�dS)
Nr*r9�keywords�sample�package�description�Once upon a time
There was�
requires_distr��r
�json�
startswithr��r$r��descs   r�test_as_jsonzAPITests.test_as_jsons���
�n�
%�
%�
*����|�����*�~�(�I�!6�6�6�6�6��-� �����<�=�=�=�=�=��2�o�&�'�'�1�,�,�,�,�,�,r'c���td��j}d|vsJ�|dddgksJ�|d}|�d��sJ�t|d��d	ksJ�dS)
Nrr9r�r�r�r�r��
classifierr�r�r�s   r�test_as_json_egg_infozAPITests.test_as_json_egg_info s���
�m�
$�
$�
)����|�����*�~�(�I�!6�6�6�6�6��-� �����<�=�=�=�=�=��2�l�#�$�$��)�)�)�)�)�)r'c��|���td��j}d|vsJ�t|d��dksJ�|dddgksJ�dS)Nr*r9r�r�r��SAMPLE�PACKAGE)�make_uppercaser
r�r�)r$r�s  r�test_as_json_odd_casezAPITests.test_as_json_odd_case(sr��������
�n�
%�
%�
*����|�����2�o�&�'�'�1�,�,�,�,��*�~�(�I�!6�6�6�6�6�6�6r'N)$�__name__�
__module__�__qualname__r"r&r+r/r:rBrIrQr]rdrprtrwr~r�r�r�r�r��staticmethodr�r�r�r�r�r�r�r�r�r�r�r�r�rvr'rrrs������)�O�;�;�;�
;�;�;�
+�+�+�H�H�H�)�)�)�
�
�
�
9�9�9�(�(�(�7�7�7�-�-�-�85�5�5�3�3�3�T�T�T�"P�P�P� 
*�
*�
*�	4�	4�	4����
K�K�K��
!�
!��\�
!�O�O�O�0�0�0�/�/�/�9�9�9�(�(�(�S�S�S�
���1�1�1� � � �@-�-�-�*�*�*�7�7�7�7�7r'rc��eZdZd�Zd�ZdS)�
LegacyDotsc��d}|D]P}|�|��5t|��jddksJ�	ddd��n#1swxYwY�QdSr1r5r7s   rr:z"LegacyDots.test_name_normalization1r;r<c��d}|D]P}|�|��5t|��jddksJ�	ddd��n#1swxYwY�QdS)N)�pkg.lot�pkg_lotzpkg-lotzpkg..lotzPkg.Lotr4r�r5r7s   r�,test_name_normalization_versionless_egg_infoz7LegacyDots.test_name_normalization_versionless_egg_info7r;r<N)r�r�r�r:r�rvr'rr�r�0s:������H�H�H�H�H�H�H�Hr'r�c� �eZdZd�Zd�Zd�ZdS)�OffSysPathTestsc��tjt|j��g���}t	d�|D����sJ�dS)N)rNc3�8K�|]}|jddkV��dS)r4r*N)r
)rMrbs  rrhzIOffSysPathTests.test_find_distributions_specified_path.<locals>.<genexpr>As.����M�M�t�4�=��(�N�:�M�M�M�M�M�Mr')r�discoverrr�rm)r$�distss  r�&test_find_distributions_specified_pathz6OffSysPathTests.test_find_distributions_specified_path?sK���%�C��
�,>�,>�+?�@�@�@���M�M�u�M�M�M�M�M�M�M�M�M�Mr'c�\�|jdz}tj|��}|jdksJ�dS)z9Demonstrate how to load metadata direct from a directory.�distinfo_pkg-1.0.0.dist-infor`N)r�r�atr�r$�dist_info_pathrbs   r�test_distribution_at_pathlibz,OffSysPathTests.test_distribution_at_pathlibCs7����)G�G����~�.�.���|�w�&�&�&�&�&�&r'c�v�|jdz}tjt|����}|jdksJ�dS)Nr�r`)r�rr�rrr�s   r�test_distribution_at_strz(OffSysPathTests.test_distribution_at_strIs?����)G�G����s�>�2�2�3�3���|�w�&�&�&�&�&�&r'N)r�r�r�r�r�r�rvr'rr�r�>sD������N�N�N�'�'�'�'�'�'�'�'r'r�c��eZdZd�ZdS)�InvalidateCachec�,�tj��dS)N)�	importlib�invalidate_cachesr.s r�test_invalidate_cachez%InvalidateCache.test_invalidate_cachePs���#�%�%�%�%�%r'N)r�r�r�r�rvr'rr�r�Os#������&�&�&�&�&r'r�)r r��unittestrr��
contextlibr�r�importlib.metadatarrrrr	r
rr�contextmanagerr�
EggInfoPkg�DistInfoPkg�DistInfoPkgWithDot�EggInfoFile�TestCaser�DistInfoPkgWithDotLegacyr��DistInfoPkgOffPathr�r�rvr'r�<module>rs���	�	�	�	���������������������������	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	��������Q7�Q7�Q7�Q7�Q7�����������Q7�Q7�Q7�hH�H�H�H�H��2�H�4E�H�H�H�'�'�'�'�'�h�1�8�3D�'�'�'�"&�&�&�&�&�h�'�&�&�&�&�&r'