Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.9/test/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.9/test/__pycache__/test_glob.cpython-39.opt-1.pyc

a

��g!4�@s�ddlZddlZddlZddlZddlZddlmZmZmZm	Z	m
Z
Gdd�dej�ZeGdd�dej��Z
edkr|e��dS)�N)�TESTFN�skip_unless_symlink�can_symlink�create_empty_file�
change_cwdc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zedd��Zedd��Ze�ejdkd �d!d"��Zd#d$�Zd%d&�Ze�ejdkd �d'd(��Zd)d*�Zd+d,�Zd-d.�Zd/S)0�	GlobTestscGstj�tjj|jg|�R��S�N)�os�path�normpath�join�tempdir)�self�parts�r�*/usr/local/lib/python3.9/test/test_glob.py�norm
szGlobTests.normcs�fdd�|D�S)Ncs"g|]}tjj�jg|�R��qSr)r	r
rr
)�.0r�rrr�
<listcomp>�z#GlobTests.joins.<locals>.<listcomp>r)rZtuplesrrr�joinsszGlobTests.joinscGs<|j|�}tj�|�\}}tj�|�s0t�|�t|�dSr)rr	r
�split�exists�makedirsr)rr�filename�base�filerrr�mktemps


zGlobTests.mktempcCs�td|_|�dd�|�dd�|�dd�|�dd	�|�d
d�|�d�|�d
�|�ddd
�|�dddd�t�r�t�|�d�|�d��t�d|�d��t�tj�dd�|�d��dS)N�_dir�a�D�aab�F�.aa�G�.bb�H�aaa�zzzF�ZZZ�EF�bcd�efg�ha�broken�sym1�sym2�sym3)	rr
rrr	�symlinkrr
rrrrr�setUps


zGlobTests.setUpcCst�|j�dSr)�shutil�rmtreer
rrrr�tearDown*szGlobTests.tearDowncOs�t|�dkr|d}ntjj|�}tj�|j|�}tj|fi|��}|�tj|fi|��|�dd�|D�}|�tjt�|�fi|��|�|�tjt�|�fi|��|�|S)N�rcSsg|]}t�|��qSr)r	�fsencode)r�xrrrr5rz"GlobTests.glob.<locals>.<listcomp>)	�lenr	r
rr
�globZassertCountEqual�iglobr9)rr�kwargs�pattern�p�resZbresrrrr<-s
  zGlobTests.globcCs<t|�}t|�}|�t|�t|��|�t|�t|��dSr)�list�assertEqual�set�sorted)r�l1�l2rrr�assertSequencesEqual_noorder:sz&GlobTests.assertSequencesEqual_noordercCs|j}||�d�|�d�g�||�dd�|�dd�g�||�d�|�d�g�||�d�g�t�d�}|�dd�|D�th�t�tj�tjd��}|�dd�|D�th�t�d	�}|�d
d�|D�t	h�t�tj�t�
tj�d	��}|�dd�|D�t	h�dS)Nr r!r"Zzymurgy�*cSsh|]}t|��qSr��type�r�rrrr�	<setcomp>Hrz.GlobTests.test_glob_literal.<locals>.<setcomp>cSsh|]}t|��qSrrJrLrrrrNJr�*cSsh|]}t|��qSrrJrLrrrrNMrcSsh|]}t|��qSrrJrLrrrrNOr)rHr<rrC�strr	r
r�curdir�bytesr9)r�eqrArrr�test_glob_literal@s

zGlobTests.test_glob_literalcCs�|j}||�d�t|jgd���||�d�t|jddg��||�d�t|jddg��||�d	�t|jdg��||�d
�t|jddg��||�d�t|jddg��||�d
�g�dS)Nza*)r r"r(�*ar r(z.*r$r&z?aazaa?r"zaa[ab]z*q)rHr<�mapr�rrSrrr�test_glob_one_directoryQsz!GlobTests.test_glob_one_directorycCs�|j}tj�d�dkr8||�ddd�|�ddd�g�n,||�ddd�|�ddd�|�ddd�g�||�ddd�|�ddd�g�dS)NZabCDr r,zE*r+r-z*g)rHr	r
�normcaser<rrWrrr�test_glob_nested_directory[s"�z$GlobTests.test_glob_nested_directorycCs�|j}||�dd�|�dd�g�||�dd�g�||�dddd�|�dddd�g�||�dd	�|�d
d�|�dd
�g�dS)NrIr!r rUr,r-r.z?a?�*Fr(r)r"r#�rHr<rrWrrr�test_glob_directory_namesfs�
�z#GlobTests.test_glob_directory_namescCs�t�|�d�tj�}|�|g�t�|�d�tj�}|�|g�t�|�d�tj�}|�t|�d�|�t|�|�d�|�d�h|�d�tj|�d�tjhg�dS�NzZ*Zr*zaa*�r(r")r<rr	�seprCr;�assertInrD�rrArrr�'test_glob_directory_with_trailing_slashos
�z1GlobTests.test_glob_directory_with_trailing_slashc
Cs�t�t�|�d�tj��}|�|g�t�t�|�d�tj��}|�|g�t�t�|�d�tj��}|�t|�d�|�t|�t�|�d��t�|�d��ht�|�d�tj�t�|�d�tj�hg�dSr^)	r<r	r9rr`rCr;rarDrbrrr�-test_glob_bytes_directory_with_trailing_slashs
���z7GlobTests.test_glob_bytes_directory_with_trailing_slashcCs�|j}||�d�|�d�g�||�dd�|�dd�|�dd�g�|�|�dtj�|�d�g|�d�tjgg�||�dd�|�dd�|�dd	�|�dd�g�dS)
Nr2rIr+r-r[r(r)r"r#)rHr<rrar	r`rWrrr�test_glob_symlinks�s
��
��zGlobTests.test_glob_symlinkscCsb|j}||�d�|�d�|�d�|�d�g�||�d�|�d�g�||�d�|�d�g�dS)Nzsym*r0r1r2r\rWrrr�test_glob_broken_symlinks�s�z#GlobTests.test_glob_broken_symlinks�win32zWin32 specific testcCs�|j}|t�d�g�|t�d�g�|t�d�g�|t�d�g�|t�d�dg�|t�d�dg�|t�d�g�|t�d�g�dS)	Nz*:s*:z?:s?:z\\?\c:\s\\?\c:\z\\*\*\s\\*\*\)rHr<rWrrr�test_glob_magic_in_drive�sz"GlobTests.test_glob_magic_in_drivecCs4|�t�|�|�|�t�t�|��t�|��dSr)rCr<�escaper	r9)r�argZexpectedrrr�check_escape�szGlobTests.check_escapecCsF|j}|dd�|dd�|dd�|dd�|dd	�|d
d�dS)N�abc�[z[[]�?z[?]rIz[*]z[[_/*?*/_]]z[[][[]_/[*][?][*]/_]]z
/[[_/*?*/_]]/z/[[][[]_/[*][?][*]/_]]/�rk�r�checkrrr�test_escape�s




zGlobTests.test_escapecCsF|j}|dd�|dd�|dd�|dd�|d	d
�|dd�dS)
Nz?:?z?:[?]z*:*z*:[*]z\\?\c:\?z
\\?\c:\[?]z\\*\*\*z	\\*\*\[*]z//?/c:/?z
//?/c:/[?]z//*/*/*z	//*/*/[*]rorprrr�test_escape_windows�s




zGlobTests.test_escape_windowscOs|j|ddi|��S)N�	recursiveT)r<)rrr>rrr�rglob�szGlobTests.rglobc
sT|j}gd�}t�r |gd�7}||�d�|jdg|�R��||�tjd�|jtjdfgdd�|D��R��gd�}t�r�|d	d
g7}||�dd�|jdg|�R��||�dd�|�dd
dddd��||�d�|�ddd��ddg}t�r�|dg7}||�dd�|j|��gd�}t��r0|dg7}||�dd�|j|��||�ddd�g�||�ddd�|�dd��||�ddd�|�d��t|j����tjj	�|t
j
ddd��fdd �|D��|t
j
�dd�dd��fd!d �|D��|t
j
�dd�dd��fd"d �|D��|t
j
�tjd�dd��tjd�g�fd#d �|D��|t
j
�tjdd�dd��tjd�g�fd$d �|D��|t
j
�tjdd�dd��fd%d �|D��|t
j
�dd&�dd��d'd(�g�|t
j
d)dd�g��ddd�dg}t��r|�d*d�g7}|t
j
�dd�dd�|�Wd�n1�sF0YdS)+N)�r+)r*�r �r r!�r r,�r r,r+�r r,r-�r r,r-r.�r(�r(r)�r"�r"r#))r0)r1)r2�r2r+)r2r-)r2r-r.�**)�r�css|]}tjf|VqdSr�r	rQ�r�irrr�	<genexpr>�rz0GlobTests.test_recursive_glob.<locals>.<genexpr>)�r r�)r r,r�)r r,r-r�)r(r�)r"r�)r2r�)r2r-r�r r�rxryrzr{r|za**rwr}rrvr�r+)rzr~r�rvr[r,rIT�rtcsg|]}�|��qSrrr��rrrr�rz1GlobTests.test_recursive_glob.<locals>.<listcomp>csg|]}�|��qSrrr�r�rrr�rcsg|]}�|��qSrrr�r�rrr�rcsg|]}�tjg|�R��qSrr�r�r�rrr�rcsg|]}�tjg|�R��qSrr�r�r�rrrrcsg|]}�tjg|�R��qSrr�r�r�rrrrzzz*Fr(r)z**zz*Fr2)rHrrurr	rQrr
r
rr<)rrS�full�dirs�expectrr�r�test_recursive_glob�sp	 � �

�"�����
�zGlobTests.test_recursive_globcs�d}tj�|jd�}tjj|gdg|�R�}t�|�tjj|gdg|�R���fdd�td�D�}|D]}|�t|�|�qltj�|dd���fd	d�td�D�}|}t|�D],}tj�|d�}|D]}|�t|�|�q�q�dS)
N�Zdeep�drIcsg|]}tj�dd��qS�Tr��r<r=�r�j�r?rrrrz7GlobTests.test_glob_many_open_files.<locals>.<listcomp>�dr�csg|]}tj�dd��qSr�r�r�r�rrrr)r	r
rr
r�rangerC�next)r�depthrr@Ziters�itr�rr�r�test_glob_many_open_filess
z#GlobTests.test_glob_many_open_filesN)�__name__�
__module__�__qualname__rrrr4r7r<rHrTrXrZr]rcrdrrerf�unittestZ
skipUnless�sys�platformrhrkrrrsrur�r�rrrrrs4

	


	
	Arc@seZdZdd�ZdS)�SymlinkLoopGlobTestscCs td}t�|�|�tj|�t|����t�d�ttj�	dd��t�
tjtj�	dd��tjddd�}|�
t|�tt|���t|�}d}|r�tjj	dgdg|�}|�||�|�|�|s�q�tj�	|d�}|�||�|�|�|d	7}q�tjtj�	dd�dd�}|�
t|�tt|���t|�}d}|�rztjj	dgdg|dg�}|�||�|�|�|d	7}�q4tjtj�	dd
�dd�}|�
t|�tt|���t|�}d}|�r�tjj	dgdg|d
g�}|�||�|�|�|d	7}�q�Wd�n1�s0YdS)Nr�dirr�linkr�Tr�rr8r�)rr	rZ
addCleanupr5r6rrr
rr3rQr<rCr;rDra�remove)rr
�resultsr�r
rrr�
test_selflink sN






z"SymlinkLoopGlobTests.test_selflinkN)r�r�r�r�rrrrr�sr��__main__)r<r	r5r�r�Ztest.supportrrrrrZTestCaserr�r��mainrrrr�<module>s/

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists