Your IP : 216.73.216.85


Current Path : /opt/alt/python39/lib64/python3.9/test/test_importlib/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/test/test_importlib/__pycache__/test_windows.cpython-39.pyc

a

XC?hA�@sJddlmZe�d�ZddlZddlZddlZddlZddl	m
Z
ddlmZddl
mZddlmZe
jd	d
gd�ddlmZmZmZmZmZmZmZmZmZd
d�Zeddd��Ze�ej�d
�d�Gdd�d��Z ej!e ed�\Z"Z#e�ej�d
�d�Gdd�d��Z$ej!e$ed�\Z%Z&e�ej�d
�d�Gdd�dej'��Z(dS)�)�utilzimportlib.machinery�N)�support)�get_platform)�contextmanager)�temp_module�winreg�win)Zrequired_on)	�	CreateKey�HKEY_CURRENT_USER�SetValue�REG_SZ�KEY_ALL_ACCESS�EnumKey�CloseKey�	DeleteKey�OpenKeycCspzt||td�}Wnty&YdS0zt|d�}WntyLYqZYn0t||�q(t|�t||�dS)N)�accessr)rr�OSErrorr�delete_registry_treerr)�root�subkey�hkeyZ	subsubkey�r�E/opt/alt/python39/lib64/python3.9/test/test_importlib/test_windows.pyrs
rc		cs0|jjr|jj}n|jj}|j|dtjdd�d�}d�tjjtjj�}|�	��
|�	��slJd�||���z�t|d��~}z(tt
|�|jjr�tj�|�}n|}Wnty�|}Yn0tt
|�}|dur�|d}t|dt|�dVWd�n1s�0YW|�r,tt
|�n|�r*tt
|�0dS)	Nz%d.%d�)�fullname�sys_versionz Software\Python\PythonCore\{}.{}z$expected key '{}' to start with '{}'za = 1z.py�)�WindowsRegistryFinder�DEBUG_BUILD�REGISTRY_KEY_DEBUG�REGISTRY_KEY�format�sys�version_info�major�minor�casefold�
startswithrrr�os�path�dirnamerr
rr
r)	�	machinery�namer+r�keyZbase_key�locationZ
delete_keyrrrr�setup_module$s<
��
�


&�r1zrequires Windowsc@s:eZdZd�e���Zdd�Zdd�Zdd�Z	dd	�Z
d
S)�WindowsRegistryFinderTestsz	spamham{}cCs|jj�d�}|�|d�dS�NZspam)r-r�	find_spec�assertIs)�self�specrrr�test_find_spec_missingJsz1WindowsRegistryFinderTests.test_find_spec_missingcCs|jj�d�}|�|d�dSr3)r-r�find_moduler5)r6�loaderrrr�test_find_module_missingNsz3WindowsRegistryFinderTests.test_find_module_missingcCsjt|j|j��H|jj�|j�}|jj�|j�}|�|d�|�|d�Wd�n1s\0YdS)N)r1r-�test_modulerr9r4ZassertIsNot�r6r:r7rrr�test_module_foundRs
z,WindowsRegistryFinderTests.test_module_foundcCsjt|j|jdd��D|jj�|j�}|jj�|j�}|�|�|�|�Wd�n1s\0YdS)N�.)r+)r1r-r<rr9r4ZassertIsNoner=rrr�test_module_not_foundYs

z0WindowsRegistryFinderTests.test_module_not_foundN)�__name__�
__module__�__qualname__r#r*�getpidr<r8r;r>r@rrrrr2Ds
r2)r-c@seZdZdd�ZdS)�WindowsExtensionSuffixTestscCs||jj}d�tjt�ddt���}z|�d�}Wn$t	yT|�d�}d|}Yn0|�
||�|�|�}|�||�dS)Nz.cp{0.major}{0.minor}-{1}.pydz[^a-zA-Z0-9]�_z.pydz_d.pydZ_d)r-�EXTENSION_SUFFIXESr#r$r%�re�subr�index�
ValueErrorZassertInZ
assertLess)r6�suffixesZexpected_tagZ
untagged_iZtagged_irrr�test_tagged_suffixfs�

z.WindowsExtensionSuffixTests.test_tagged_suffixN)rArBrCrMrrrrrEdsrEc@seZdZdd�Zdd�ZdS)�WindowsBootstrapPathTestscGs8ddlm}||�}|��|��kr(dS|�||�dS)Nr)�
_path_join)Zimportlib._bootstrap_externalrOr(ZassertEqual)r6ZexpectedZinputsrOZactualrrr�
check_join}s
z$WindowsBootstrapPathTests.check_joinc	Cs�|�dddd�|�dddddd�|�dddd�|�ddd�|�dd�|�d	d
d�|�d	dd
d�|�d	dd	�|�dddd
�|�ddd�|�ddd�|�dddd
�|�ddd�|�dddd�|�ddddd
�|�dddddd
�|�ddddddd
�|�dddddd
�|�dd�|�dd�|�dd d!�|�dd"d!�|�d#d#d!�|�d$d%d!�|�d$d&d!�dS)'NzC:\A\BzC:\�A�BzD:\�DzC:BzA\BzD:AzD:zC:\B\CzA\B\C�CzB\CzA\B/CzB/CzA/zB\zA\../Cz../CzA.\.\BzA.r?z\\Server\Share\A\B\Cz\\Server\Sharez\Az\\Server2\Share2z\\Serverz\Sharez\\Server\Share\\zC:\AzC:/ArzC:/zC:z//Server/Share\z//Server/Share/z//Server/Share)rP)r6rrr�test_path_join�s6
�z(WindowsBootstrapPathTests.test_path_joinN)rArBrCrPrUrrrrrN{srN)N))rrZ	test_utilZimport_importlibr-r*rHr$Zunittest�testrZdistutils.utilr�
contextlibrr�
import_modulerr
rrr
rrrrrrr1Z
skipUnless�platformr)r2Z	test_bothZ!Frozen_WindowsRegistryFinderTestsZ!Source_WindowsRegistryFinderTestsrEZ"Frozen_WindowsExtensionSuffixTestsZ"Source_WindowsExtensionSuffixTestsZTestCaserNrrrr�<module>s4
,��