Your IP : 216.73.216.213


Current Path : /opt/alt/python310/lib64/python3.10/test/test_importlib/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/test/test_importlib/__pycache__/test_reader.cpython-310.pyc

o

0�i��@sxddlZddlZddlZddlZddlmZddlmZm	Z	Gdd�dej
�ZGdd�dej
�Ze
dkr:e��dSdS)	�N)�
import_module)�MultiplexedPath�NamespaceReaderc@sheZdZedd��Zdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�ZdS)�MultiplexedPathTestcCst�t�jd}t|�|_dS)N�namespacedata01)�pathlib�Path�__file__�parent�str�folder)�cls�path�r�F/opt/alt/python310/lib64/python3.10/test/test_importlib/test_reader.py�
setUpClassszMultiplexedPathTest.setUpClasscCs6|�t��t�Wd�dS1swYdS�N)�assertRaises�FileNotFoundErrorr��selfrrr�test_init_no_pathss"�z&MultiplexedPathTest.test_init_no_pathscCsD|�t��ttj�|jd��Wd�dS1swYdS)N�binary.file)r�NotADirectoryErrorr�osr�joinrrrrr�test_init_files"�z"MultiplexedPathTest.test_init_filec	CsRdd�t|j���D�}z|�d�WnttfyYnw|�|hd��dS)NcS�h|]}|j�qSr��name��.0rrrr�	<setcomp>sz3MultiplexedPathTest.test_iterdir.<locals>.<setcomp>�__pycache__>�utf-16.filer�
utf-8.file)rr�iterdir�remove�KeyError�
ValueError�assertEqual)r�contentsrrr�test_iterdirs�z MultiplexedPathTest.test_iterdirc
Csttj�tj�tdd��}dd�t|j|���D�}dD]}z|�|�Wqt	t
fy/Yqw|�|hd��dS)N�..�data01cSrrrr rrrr""s�z=MultiplexedPathTest.test_iterdir_duplicate.<locals>.<setcomp>)r#z__init__.pyc>r�subdirectoryr%z__init__.pyr$)rr�abspathrr	rrr&r'r(r)r*)rr.r+r'rrr�test_iterdir_duplicate s���z*MultiplexedPathTest.test_iterdir_duplicatecC�|�t|j���d�dS)NT)r*rr�is_dirrrrr�test_is_dir/�zMultiplexedPathTest.test_is_dircCr2)NF)r*rr�is_filerrrr�test_is_file2r5z MultiplexedPathTest.test_is_filecCs�t|j�}|�t��|��Wd�n1swY|�t��|��Wd�n1s2wY|�t��
|��Wd�dS1sLwYdSr)rrrrZ
read_bytesZ	read_text�open)rrrrr�test_open_file5s

�
�
"�z"MultiplexedPathTest.test_open_filecCs�tj�tj�td��}tj�|d�}t|j|�}|�t|�	d��t
|�dd�tj�dd��|�t|�	d��t
|�dd�tj�dd��|�t|�	d��t
|�dd�tj�dd��dS)Nr-r.r�rr/�	imaginary)rrr0rr	rrr*rZjoinpath�len)r�prefixr.rrrr�test_join_path>s���z"MultiplexedPathTest.test_join_pathcCs$|�tt|j��d|j�d��dS)N�MultiplexedPath('�'))r*�reprrrrrrr�	test_reprOs�zMultiplexedPathTest.test_reprcCs"|�t|j�jtj�|j��dSr)r*rrrrr�basenamerrrr�	test_nameUs
�zMultiplexedPathTest.test_nameN)�__name__�
__module__�__qualname__�classmethodrrrr,r1r4r7r9r>rBrDrrrrr
s
	rc@sLeZdZee�e�j�Ze	dd��Z
e	dd��Zdd�Zdd�Z
d	d
�ZdS)�NamespaceReaderTestcC�tj�|j�dSr)�sysr�append�site_dir�r
rrrr_�zNamespaceReaderTest.setUpClasscCrJr)rKrr'rMrNrrr�
tearDownClasscrOz!NamespaceReaderTest.tearDownClasscCs<|�t��tddg�Wd�dS1swYdS)NZpath1Zpath2)rr)rrrrr�test_init_errorgs"�z#NamespaceReaderTest.test_init_errorcCshtd�}t|jj�}tj�tj�tdd��}|�	|�
d�tj�|d��|�	|�
d�tj�|d��dS)Nrr-rr;)rr�__spec__�submodule_search_locationsrrr0rr	r*Z
resource_path�rr�reader�rootrrr�test_resource_pathks��z&NamespaceReaderTest.test_resource_pathcCs\td�}t|jj�}tj�tj�tdd��}|�	|�
�t�|�t
|�
��d|�d��dS)Nrr-r?r@)rrrRrSrrr0rr	ZassertIsInstance�filesrr*rArTrrr�
test_filesws
 zNamespaceReaderTest.test_filesN)rErFrGrrrr	r
rMrHrrPrQrWrYrrrrrI\s

rI�__main__)Zos.pathrrKrZunittest�	importlibr�importlib.readersrrZTestCaserrIrE�mainrrrr�<module>sR#�