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_posixpath.cpython-39.opt-1.pyc

a

��g�t�@s�ddlZddlZddlZddlmZmZmZmZddlmZm	Z	ddl
mZddlmZzddl
Z
WneyzdZ
Yn0eej�Zdd�Zdd	�ZGd
d�dej�ZGdd
�d
e	jej�ZGdd�dej�Zedkr�e��dS)�N)�realpath�abspath�dirname�basename)�support�test_genericpath)�FakePath)�mockcCs"dtv}d}|t�|�|�g|S)z�
    On Windows, posixpath.abspath still returns paths with backslashes
    instead of posix forward slashes. If this is the case, several tests
    fail, so skip them.
    �\z'ABSTFN is not a posix path - tests fail)�ABSTFN�unittest�skip)�testZfound_backslash�msg�r�//usr/local/lib/python3.9/test/test_posixpath.py�!skip_if_ABSTFN_contains_backslashsrcCs&zt�|�Wnty Yn0dS�N)�os�rmdir�OSError)rrrr�
safe_rmdirsrc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Ze�e��d�dd��Ze�edud�dd��Ze�edud�d d!��Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zed*d+��Zed,d-��Ze�ee d.�d/�ed0d1���Z!e�ee d.�d/�ed2d3���Z"e�ee d.�d/�ed4d5���Z#e�ee d.�d/�ed6d7���Z$e�ee d.�d/�ed8d9���Z%e�ee d.�d/�ed:d;���Z&e�ee d.�d/�ed<d=���Z'e�ee d.�d/�ed>d?���Z(d@dA�Z)dBdC�Z*dDdE�Z+dS)F�
PosixPathTestcCs|��dSr)�tearDown��selfrrr�setUp&szPosixPathTest.setUpcCs,dD]"}t�tj|�ttj|�qdS)N)��1�2)r�unlink�TESTFNr)r�suffixrrrr)szPosixPathTest.tearDowncCs�|�t�dddd�d�|�t�ddd�d�|�t�ddd	�d
�|�t�ddd
d�d�|�t�ddd�d�|�t�ddd�d�dS)N�/foo�barz/barZbazz/bar/bazz/foo/bar/bazz/foo/zbar/zbaz/z
/foo/bar/baz/�/foo�bars/barsbazs/bar/bazs/foo/bar/bazs/foo/sbar/sbaz/s
/foo/bar/baz/)�assertEqual�	posixpath�joinrrrr�	test_join.s �����zPosixPathTest.test_joincCs�|�t�d�d�|�t�d�d�|�t�d�d�|�t�d�d�|�t�d	�d
�|�t�d�d�|�t�d
�d�|�t�d�d�|�t�d�d�|�t�d�d�dS)N�/foo/bar)r#r$�/)r,r�foo)rr-�////foo)�////r-�
//foo//bar)�//foor$�/foo/bar)r%r&�/)r3��foo)r4r5�////foo)�////r5�
//foo//bar)�//foor&)r'r(�splitrrrr�
test_split<szPosixPathTest.test_splitcCs�|�t�|�||f�|�t�d|�d||f�|�t�d|�d||f�|�t�d|�d||f�|�t�d|�d||f�|�t�|d�||ddf�t|d�}t|d�}t|d�}|�t�|�||f�|�t�d|�d||f�|�t�d|�d||f�|�t�d	|�d	||f�|�t�d
|�d
||f�|�t�|d�||ddf�dS)Nr,zabc/zabc.def/z	/abc.def/r�ASCIIr3sabc/sabc.def/s	/abc.def/r4)r'r(�splitext�bytes)r�path�filename�extrrr�splitextTestIsB
�
�
��



�
�
�
��zPosixPathTest.splitextTestcCs�|�ddd�|�ddd�|�ddd�|�dd	d
�|�ddd�|�d
d
d�|�ddd�|�ddd�|�ddd�|�ddd�|�ddd�|�ddd�dS)Nzfoo.barr-z.barzfoo.boo.barzfoo.boozfoo.boo.biff.barzfoo.boo.biffz.csh.rcz.cshz.rcZnodotsrz.cshrcz...manydotsz...manydots.extz.ext�.�..z........)rBrrrr�
test_splitexteszPosixPathTest.test_splitextcCs�|�t�d�d�|�t�d�d�|�t�d�d�|�t�d�d�|�t�d�d�|�t�d�d�|�t�d	�d�|�t�d
�d�|�t�d�d�|�t�d�d�dS)
NrFr,Tr#r+zfoo/barr4r3r%r2sfoo/bar)�assertIsr(�isabsrrrr�
test_isabssszPosixPathTest.test_isabscCs�|�t�d�d�|�t�d�d�|�t�d�d�|�t�d�d�|�t�d�d�|�t�d�d	�|�t�d
�d�|�t�d�d�|�t�d
�d�|�t�d�d	�dS)Nr+r$r,rr-r.r0r2r&r3r4r5r6r8)r'r(rrrrr�
test_basename�szPosixPathTest.test_basenamecCs�|�t�d�d�|�t�d�d�|�t�d�d�|�t�d�d�|�t�d�d	�|�t�d
�d�|�t�d�d�|�t�d
�d�|�t�d�d�|�t�d�d�dS)Nr+r#r,r-rr.r/r0r1r2r%r3r5r4r6r7r8r9)r'r(rrrrr�test_dirname�szPosixPathTest.test_dirnamecCs�|�t�tjd�d�|�t�tjd�d�ttjdd��}|�d�Wd�n1s`0Y|�t�tjd�d�t���rt	�
tjdtjd�|�t�tjd�d�t	�tjd�|�t�tjd�d�|�t�tjd�d�|�t�tjd�d�|�t�tjd�d�|�t�t	�
tj�d�d�|�t�tjd	�d�|�t�t	�
tj�d
�d�dS)NrFr�wbr5Tu�����)rFr(�islinkrr!�lexists�open�write�can_symlinkr�symlink�remove�exists�fsencode)r�frrr�test_islink�s (
zPosixPathTest.test_islinkcCs(|�t�d�d�|�t�d�d�dS)Nr,Tr3)rFr(�ismountrrrr�test_ismount�szPosixPathTest.test_ismountcCs�|�t�t�d�z(t�t�|�t�t�d�Wtt�n
tt�0|�t�d�d�|�t�d�d�|�t�d�d�|�t�d�d�dS)NFu/�s/�z/s/)rFr(rZrr�mkdirrrrrr�test_ismount_non_existent�s
z'PosixPathTest.test_ismount_non_existentzTest requires symlink supportc	Cs>z,t�dt�|�t�t�d�Wt�t�nt�t�0dS)Nr,F)rrTrrFr(rZr rrrr�test_ismount_symlinks�sz#PosixPathTest.test_ismount_symlinksNzTest requires posix modulecCs>tj}dd�}z"|t_|�t�t�d�W|t_n|t_0dS)NcSs6d}d}|tkrd}d}t�d||dddddddf
�S)Nr�)r�posix�stat_result�r?�st_ino�st_devrrr�
fake_lstat�sz?PosixPathTest.test_ismount_different_device.<locals>.fake_lstatT�r�lstatrFr(rZr�rZ
save_lstatrerrr�test_ismount_different_device�sz+PosixPathTest.test_ismount_different_devicecCs>tj}dd�}z"|t_|�t�t�d�W|t_n|t_0dS)NcSsPd}d}|�t�r"|tkr"td��|tkr2d}d}t�d||dddddddf
�S)Nrz!Fake [Errno 13] Permission deniedr_)�
startswithrrr`rarbrrrre�szEPosixPathTest.test_ismount_directory_not_readable.<locals>.fake_lstatTrfrhrrr�#test_ismount_directory_not_readable�sz1PosixPathTest.test_ismount_directory_not_readablecCs(|�t�d�d�|�t�d�d�dS)Nr-r5)r'r(�
expanduserrrrr�test_expanduser�szPosixPathTest.test_expanduserc
Cs�t����}d|d<|�t�d�d�d|d<|�t�d�d�dD]n}|j|d��N||d<|�t�d�d�|�t�d�d�|�t�d	�d
�Wd�qB1s�0YqBWd�n1s�0YdS)Nz/home/victor�HOME�~z
/home/victor/)r,r�//�///)�homer,�~/z~/foor#)r�EnvironmentVarGuardr'r(rlZsubTest)r�envrrrrr�test_expanduser_home_envvar�s
z)PosixPathTest.test_expanduser_home_envvarc
Cs�t�d�}|�t�d�t�|�t�d�t�t�d�dkrt|�t�d�dt�d��|�t�d�dt�d��|�t�d�t�|�t�d	�t�|�t�d
�t�|�t�d�t�t����}|d=|�	t
���j}|�
d�p�d}|�t�d�|�tjj|d
td��btjj|dtd��.dD]}|�t�|�|��q(Wd�n1�sX0YWd�n1�sx0YWd�n1�s�0YdS)N�pwdrss~/ror,�~r3z~root/z~foo/s~root/s~foo/rn�getpwuid)Zside_effect�getpwnam)roz~/.localz
~vstinner/)r�
import_moduleZassertIsInstancer(rl�strr>r'rtryr�getuid�pw_dir�rstripr	Zpatch�object�KeyError)rrwrurrr?rrr�test_expanduser_pwds4
��
�z!PosixPathTest.test_expanduser_pwdcCs|�t�d�d�|�t�d�d�|�t�d�d�|�t�d�d�|�t�d�d�|�t�d�d	�|�t�d
�d�|�t�d�d�|�t�d
�d
�|�t�d�d�|�t�d�d
�|�t�d�d�|�t�d�d�|�t�d�d�dS)NrrCr,rprqz///foo/.//bar//r+z///foo/.//bar//.//..//.//bazz/foo/bazz///..//./foo/.//barr4�.r3s//s///s///foo/.//bar//r2s///foo/.//bar//.//..//.//bazs/foo/bazs///..//./foo/.//bar)r'r(�normpathrrrr�
test_normpath.s(���zPosixPathTest.test_normpathcCs�|�td�t���|�td�t���|�td�dgd��t���|�td�t���|�td�t���|�td�dgd��t���dS)NrCz./.r,�dr�s./.r3)r'rr�getcwdr)�getcwdbrrrr�test_realpath_curdirBs z"PosixPathTest.test_realpath_curdircCs�|�td�tt����|�td�ttt�����|�td�dgd��d�|�td�tt����|�td�ttt�����|�td�dgd��d�dS)NrDz../..r,r�s..s../..r3)r'rrrr�r)r�rrrr�test_realpath_pardirLsz"PosixPathTest.test_realpath_pardirrTzMissing symlink implementationc	CsDz2t�tdt�|�tt�td�Wt�t�nt�t�0dS�Nr)rrTrr'rrr rrrr�test_realpath_basicVsz!PosixPathTest.test_realpath_basicc	CsJz8t�t�td�t�|�tt�td�Wt�t�nt�t�0dSr�)	rrTr(�relpathrr'rrr rrrr�test_realpath_relativeasz$PosixPathTest.test_realpath_relativec
Cs��z(t�tt�|�tt�t�t�tdtd�t�tdtd�|�ttd�td�|�ttd�td�|�ttd�td�|�ttd�tt��|�ttd�tt�d�t�tdtd�|�ttd	tt�d�td�|�ttd	tt�d�td�t�tt�d
td�|�ttd�td
�t�dttt��d
tt�dtd�|�ttd�td�t�tt���$|�ttt��t�Wd�n1�s�0YWt�	t�t�	td�t�	td�t�	td�t�	td�t�	td�nRt�	t�t�	td�t�	td�t�	td�t�	td�t�	td�0dS)Nrrz1/xz1/..z1/../x�/x�x�yz1/../�a/b�a�../r,�c)
rrTrr'rrrr�
change_cwdr rrrr�test_realpath_symlink_loopsksR�����6
�
z)PosixPathTest.test_realpath_symlink_loopsc
Cs�znt�t�t�dtt�td�t�dtd�|�ttd�t�Wt�td�t�td�t	t�n&t�td�t�td�t	t�0dS)Nr�z/selfzself/self/selfz/link)
rr\rrTrr'rrr rrrrr�(test_realpath_repeated_indirect_symlinks�s

�z6PosixPathTest.test_realpath_repeated_indirect_symlinkscCsd}z�t�t�t|�D],}t�d�d|gd�td|d�qt�dtd�|�ttd|�t�t�	t��$|�td|�t�Wd�n1s�0YWt|d�D]}t�
td|�q�tt�n.t|d�D]}t�
td|�q�tt�0dS)N�
r,z%dz/%dr_rCz/0)rr\r�rangerTr)r'rrr�r r)r�depth�irrr�test_realpath_deep_recursion�s
*4
�z*PosixPathTest.test_realpath_deep_recursionc
Cs�z�t�t�t�td�t�tdtd�t�td��$|�td�td�Wd�n1sf0YWt�td�t	td�t	t�n$t�td�t	td�t	t�0dS)Nz/y�/kr�z/y/a)
rr\rrTrr�r'rr rrrrr�test_realpath_resolve_parents�s
4
�z+PosixPathTest.test_realpath_resolve_parentsc
Csz�t�t�t�td�t�td�t�tdtd�|�ttd�td�t�tt���,|�tt	t�d�td�Wd�n1s�0YWt�
td�ttd�ttd�tt�n0t�
td�ttd�ttd�tt�0dS)Nr�z/k/yz/link-yz
/link-y/..)rr\rrTr'rrr�rrr rrrrr�(test_realpath_resolve_before_normalizing�s$
�$
�z6PosixPathTest.test_realpath_resolve_before_normalizingc
Cs�z�t�t�t�td�t�ttd�t�tt���Dtt�}|�t	|d�t�|�t	|d�td�Wd�n1s�0YWt�
td�ttd�tt�n$t�
td�ttd�tt�0dS)Nr��linkzlink/k)rr\rrTrr�rrr'rr r)r�baserrr�test_realpath_resolve_first�s
8
�z)PosixPathTest.test_realpath_resolve_firstcCs�tjdd�}t_�z�tj�t���d}|�ttjd�|�t�d�d�|�t�t�	d��d�|�t�d�d�|�t�d�d�|�t�dd�d	|d
�|�t�dd�d	|d�|�t�dd
�d�|�t�dd�d�|�t�dd�d�|�t�dd�d�|�t�dd�d�|�t�dd�d�|�t�dd�d�|�t�dd�d�|�t�dd�d�|�t�d
d
�d�|�t�dd�d�W|t_n|t_0dS)NcSsdS)Nz/home/user/barrrrrr�<lambda>�r4z,PosixPathTest.test_relpath.<locals>.<lambda>���rr�r�z../a/bz../br�z/az../cz/a/bzb/cz../../arCz/foo/bar/batz/x/y/zz../../../foo/bar/batr+Zbatr,zfoo/bar/batz../../..r�z../foo/bar/batz
../../../x)
rr�r?r:�assertRaises�
ValueErrorr(r�r'r)rZreal_getcwd�curdirrrr�test_relpath�s0
�zPosixPathTest.test_relpathcCs�tjdd�}t_�z�tj�t���d}|�ttjd�|�t�d�d�|�t�t�	d��d�|�t�d�d�|�t�d�d�|�t�dd�d	|d
�|�t�dd�d	|d�|�t�dd
�d�|�t�dd�d�|�t�dd�d�|�t�dd�d�|�t�dd�d�|�t�dd�d�|�t�dd�d�|�t�dd�d�|�t�dd�d�|�t�d
d
�d�|�t�dd�d�|�t
tjdd�|�t
tjdd�W|t_n|t_0dS)NcSsdS)Ns/home/user/barrrrrrr�r4z2PosixPathTest.test_relpath_bytes.<locals>.<lambda>r�r4�asa/bs../a/bs../bs../s/as../cs/a/bsb/cs../../ar�s/foo/bar/bats/x/y/zs../../../foo/bar/batr2sbatr3sfoo/bar/bats../../..s/xs../foo/bar/bats
../../../xsbytesr|)rr�r?r:r�r�r(r�r'r�	TypeError)rZreal_getcwdbr�rrr�test_relpath_bytess8
�
�z PosixPathTest.test_relpath_bytescs��fdd�}�fdd�}��ttjg�|tddg�|tddg�|dgd�|ddgd�|ddgd�|ddgd�|d	d
gd�|ddgd�|d
dgd
�|ddgd
�|ddgd�|ddgd�|ddgd�|ddgd�|dgd�|ddgd�|ddgd�|ddgd�|ddgd�|ddgd�|gd�d�|gd�d�|dgd�|dd gd�|tdd!g���ttjd"dg���ttjd"d#g���ttjd$dg���ttjdd%g���ttjdd&g���ttjd'd%g�dS)(Ncs8��t�|�|���t�dd�|D��t�|��dS)NcSsg|]}t�|��qSr�rrW��.0�prrr�
<listcomp>8r4z@PosixPathTest.test_commonpath.<locals>.check.<locals>.<listcomp>)r'r(�
commonpathrrW)�pathsZexpectedrrr�check6s�z,PosixPathTest.test_commonpath.<locals>.checkcs.��|tj|���|tjdd�|D��dS)NcSsg|]}t�|��qSrr�r�rrrr�=r4zFPosixPathTest.test_commonpath.<locals>.check_error.<locals>.<listcomp>)r�r(r�)�excr�rrr�check_error:s
�z2PosixPathTest.test_commonpath.<locals>.check_errorz/usrZusrz
/usr/localz/usr/local/z/usr//localz//usr/localz/usr/./localz/./usr/localr,z/devz	/usr/lib/z/usr/lib/python3z/usr/libz/usr/lib64/z
/usr/lib64Zspam�alotr�and/jam�and/spam�andzand//jamz
and/spam//z	and/./jamz
./and/spam)r�r�r�)r�r�r�z	spam/alotz
/spam/alots	/usr/lib/zusr/lib/python3susr/lib/s/usr/lib/python3susr/lib/python3zusr/lib/)r�r�r(r�r�)rr�r�rrr�test_commonpath5s\
�
�
�
�
�
�zPosixPathTest.test_commonpath),�__name__�
__module__�__qualname__rrr*r;rBrErHrIrJrYr[r]rZ
skipUnlessrrSr^ZskipIfr`rirkrmrvr�r�rr�r��hasattrrr�r�r�r�r�r�r�r�r�r�r�rrrrr$s�




�


'
	
	���'�����rc@seZdZeZgd�ZdS)�PosixCommonTest)r��samefile�sameopenfile�samestatN)r�r�r�r(Z
pathmoduleZ
attributesrrrrr�lsr�c@s�eZdZeZdd�Zdd�Zdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)S)*�
PathLikeTestscCs`tj|_ttj�|_|�tj|j�t|jdd��}|�d�Wd�n1sR0YdS)N�xbrstest_posixpath.PathLikeTests)	rr!�	file_namer�	file_pathZ
addCleanupr rQrR)r�filerrrrus
zPathLikeTests.setUpcCs|�||j�||j��dSr)r'r�r�)r�funcrrr�assertPathEqual|szPathLikeTests.assertPathEqualcCs|�|jj�dSr)r�r?�normcaserrrr�test_path_normcasesz PathLikeTests.test_path_normcasecCs|�|jj�dSr)r�r?rGrrrr�test_path_isabs�szPathLikeTests.test_path_isabscCs,|�|j�dtd�d�|j�ddd��dS)Nr��br�)r'r?r)rrrrr�test_path_join�s�zPathLikeTests.test_path_joincCs|�|jj�dSr)r�r?r:rrrr�test_path_split�szPathLikeTests.test_path_splitcCs|�|jj�dSr)r�r?r=rrrr�test_path_splitext�sz PathLikeTests.test_path_splitextcCs|�|jj�dSr)r�r?�
splitdriverrrr�test_path_splitdrive�sz"PathLikeTests.test_path_splitdrivecCs|�|jj�dSr)r�r?rrrrr�test_path_basename�sz PathLikeTests.test_path_basenamecCs|�|jj�dSr)r�r?rrrrr�test_path_dirname�szPathLikeTests.test_path_dirnamecCs|�|jj�dSr)r�r?rOrrrr�test_path_islink�szPathLikeTests.test_path_islinkcCs|�|jj�dSr)r�r?rPrrrr�test_path_lexists�szPathLikeTests.test_path_lexistscCs|�|jj�dSr)r�r?rZrrrr�test_path_ismount�szPathLikeTests.test_path_ismountcCs|�|jj�dSr)r�r?rlrrrr�test_path_expanduser�sz"PathLikeTests.test_path_expandusercCs|�|jj�dSr)r�r?�
expandvarsrrrr�test_path_expandvars�sz"PathLikeTests.test_path_expandvarscCs|�|jj�dSr)r�r?r�rrrr�test_path_normpath�sz PathLikeTests.test_path_normpathcCs|�|jj�dSr)r�r?rrrrr�test_path_abspath�szPathLikeTests.test_path_abspathcCs|�|jj�dSr)r�r?rrrrr�test_path_realpath�sz PathLikeTests.test_path_realpathcCs|�|jj�dSr)r�r?r�rrrr�test_path_relpath�szPathLikeTests.test_path_relpathcCs&|j�|j|jg�}|�||j�dSr)r?r�r�r�r')rZcommon_pathrrr�test_path_commonpath�sz"PathLikeTests.test_path_commonpathN)r�r�r�r(r?rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr�qs*r��__main__)rr(rrrrrrrrZtest.supportrr	r`�ImportErrorr!rrrZTestCaserZ
CommonTestr�r�r��mainrrrr�<module>s,


LG

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