Uname:Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64

403WebShell
403Webshell
Server IP : 3.111.61.48  /  Your IP : 216.73.216.67
Web Server : Apache
System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.2.31
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3.10/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.10/test/__pycache__/test_posixpath.cpython-310.pyc
o

�9jt��@sddlZddlZddlZddlZddlmZmZmZmZddlm	Z	ddl
mZddl
mZddl
mZddlmZzddlZWneyKdZYnweej�Zdd	�Zd
d�ZGdd
�d
ej�ZGdd�de	jej�ZGdd�dej�Zedkr�e��dSdS)�N)�realpath�abspath�dirname�basename)�test_genericpath)�
import_helper)�	os_helper)�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)�test�found_backslash�msg�r�*/usr/lib/python3.10/test/test_posixpath.py�!skip_if_ABSTFN_contains_backslashsrcCs&zt�|�WdStyYdSw�N)�os�rmdir�OSError)rrrr�
safe_rmdir!s
�rc@sBeZdZdd�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%�Ze�ejd&kd'�d(d)��Zd*d+�Zed,d-��Zed.d/��Z e�e!e"d0�d1�ed2d3���Z#e�e!e"d0�d1�ed4d5���Z$e�e!e"d0�d1�ed6d7���Z%e�e!e"d0�d1�ed8d9���Z&e�e!e"d0�d1�ed:d;���Z'e�e!e"d0�d1�ed<d=���Z(e�e!e"d0�d1�ed>d?���Z)e�e!e"d0�d1�ed@dA���Z*e�e!e"d0�d1�edBdC���Z+e�e!e"d0�d1�edDdE���Z,dFdG�Z-dHdI�Z.dJdK�Z/dS)L�
PosixPathTestcCs|��dSr)�tearDown��selfrrr�setUp)szPosixPathTest.setUpcCs,dD]}t�tj|�ttj|�qdS)N)��1�2)r�unlink�TESTFNr)r�suffixrrrr,s�zPosixPathTest.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/bar�bazz/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_join1s �����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)rr0�////foo)�////r0�
//foo//bar)�//foor&�/foo/bar)r(r)�/)r6��foo)r7r8�////foo)�////r8�
//foo//bar)�//foor))r*r+�splitrrrr�
test_split?�zPosixPathTest.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�ASCIIr6sabc/sabc.def/s	/abc.def/r7)r*r+�splitext�bytes)r�path�filename�extrrr�splitextTestLsB
�
�
��



�
�
�
��zPosixPathTest.splitextTestcCs�|�ddd�|�ddd�|�ddd�|�dd	d
�|�ddd�|�d
d
d�|�ddd�|�ddd�|�ddd�|�ddd�|�ddd�|�ddd�dS)Nzfoo.barr0z.barzfoo.boo.barzfoo.boozfoo.boo.biff.barzfoo.boo.biffz.csh.rcz.cshz.rc�nodotsrz.cshrcz...manydotsz...manydots.extz.ext�.�..z........)rFrrrr�
test_splitexthszPosixPathTest.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/barr7r6r(r5sfoo/bar)�assertIsr+�isabsrrrr�
test_isabsvr?zPosixPathTest.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/rr0r1r3r5r)r6r7r8r9r;)r*r+rrrrr�
test_basename�r?zPosixPathTest.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/r0rr1r2r3r4r5r(r6r8r7r9r:r;r<)r*r+rrrrr�test_dirname�r?zPosixPathTest.test_dirnamecCs�|�t�tjd�d�|�t�tjd�d�ttjdd��
}|�d�Wd�n1s0wY|�t�tjd�d�t��r�t	�
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)Nr Fr!�wbr8Tu�����)rKr+�islinkrr#�lexists�open�write�can_symlinkr�symlink�remove�exists�fsencode)r�frrr�test_islink�s"�"zPosixPathTest.test_islinkcCsT|�t�d�d�|�t�d�d�|�t�td��d�|�t�td��d�dS)Nr/Tr6)rKr+�ismountr	rrrr�test_ismount�szPosixPathTest.test_ismountcCs�|�t�t�d�zt�t�|�t�t�d�Wtt�ntt�w|�t�d�d�|�t�d�d�|�t�d�d�|�t�d�d�dS)NFu/�s/�z/s/)rKr+r_rr�mkdirrrrrr�test_ismount_non_existent�s
z'PosixPathTest.test_ismount_non_existentzTest requires symlink supportc	Cs<zt�dt�|�t�t�d�Wt�t�dSt�t�w)Nr/F)rrYrrKr+r_r"rrrr�test_ismount_symlinks�sz#PosixPathTest.test_ismount_symlinksNzTest requires posix modulecC�<tj}dd�}z|t_|�t�t�d�W|t_dS|t_w)NcSs6d}d}|tkrd}d}t�d||dddddddf
�S)Nr�)r�posix�stat_result�rC�st_ino�st_devrrr�
fake_lstat�sz?PosixPathTest.test_ismount_different_device.<locals>.fake_lstatT�r�lstatrKr+r_r�r�
save_lstatrkrrr�test_ismount_different_device�sz+PosixPathTest.test_ismount_different_devicecCrd)NcSsPd}d}|�t�r|tkrtd��|tkrd}d}t�d||dddddddf
�S)Nrz!Fake [Errno 13] Permission deniedre)�
startswithrrrfrgrhrrrrk�szEPosixPathTest.test_ismount_directory_not_readable.<locals>.fake_lstatTrlrnrrr�#test_ismount_directory_not_readable�sz1PosixPathTest.test_ismount_directory_not_readablecCs(|�t�d�d�|�t�d�d�dS)Nr0r8)r*r+�
expanduserrrrr�test_expanduser�szPosixPathTest.test_expanduserc
Cs�t���]}d|d<|�t�d�d�d|d<|�t�d�d�dD]7}|j|d��'||d<|�t�d�d�|�t�d�d�|�t�d	�d
�Wd�n1sSwYq!Wd�dS1sdwYdS)Nz/home/victor�HOME�~z
/home/victor/)r/r�//�///)�homer/�~/z~/foor%)r�EnvironmentVarGuardr*r+rs�subTest)r�envryrrr�test_expanduser_home_envvar�s
���"�z)PosixPathTest.test_expanduser_home_envvar�vxworkszno home directory on VxWorksc
Cs�t�d�}|�t�d�t�|�t�d�t�t�d�dkr:|�t�d�dt�d��|�t�d�dt�d��|�t�d�t�|�t�d	�t�|�t�d
�t�|�t�d�t�t�	��l}|d=|�
t���j
}|�d�ptd}|�t�d�|�tjj|d
td��/tjj|dtd��dD]}|�t�|�|�q�Wd�n1s�wYWd�n1s�wYWd�dSWd�dS1s�wYdS)N�pwdrzs~/rvr/�~r6z~root/z~foo/s~root/s~foo/ru�getpwuid)�side_effect�getpwnam)rvz~/.localz
~vstinner/)r�
import_module�assertIsInstancer+rs�strrBr*rr{r�r�getuid�pw_dir�rstripr
�patch�object�KeyError)rr�r}ryrCrrr�test_expanduser_pwdsB
��
�����
"�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)NrrHr/rwrxz///foo/.//bar//r.z///foo/.//bar//.//..//.//bazz/foo/bazz///..//./foo/.//barr7�.r6s//s///s///foo/.//bar//r5s///foo/.//bar//.//..//.//bazs/foo/bazs///..//./foo/.//bar)r*r+�normpathrrrr�
test_normpath5s(���zPosixPathTest.test_normpathcCs�|�td�t���|�td�t���|�td�dgd��t���|�td�t���|�td�t���|�td�dgd��t���dS)NrHz./.r/�dr�s./.r6)r*rr�getcwdr,�getcwdbrrrr�test_realpath_curdirIs $z"PosixPathTest.test_realpath_curdircCs�|�td�tt����|�td�ttt�����|�td�dgd��d�|�td�tt����|�td�ttt�����|�td�dgd��d�dS)NrIz../..r/r�s..s../..r6)r*rrrr�r,r�rrrr�test_realpath_pardirSs z"PosixPathTest.test_realpath_pardirrYzMissing symlink implementationc	CsBzt�tdt�|�tt�td�Wt�t�dSt�t�w�Nr )rrYrr*rrr"rrrr�test_realpath_basic]sz!PosixPathTest.test_realpath_basicc	CsVz$t�tdt�|jtttdd�|jtttddd�Wt�t�dSt�t�w)Nr T��strictr!)rrYr�assertRaises�FileNotFoundErrorrrr"rrrr�test_realpath_stricths
z"PosixPathTest.test_realpath_strictc	CsHzt�t�td�t�|�tt�td�Wt�t�dSt�t�wr�)	rrYr+�relpathrr*rrr"rrrr�test_realpath_relativeusz$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�n31s�wYWt�	t�t�	td�t�	td�t�	td�t�	td�t�	td�dSWt�	t�t�	td�t�	td�t�	td�t�	td�t�	td�dSt�	t�t�	td�t�	td�t�	td�t�	td�t�	td�w)Nr r!�1/x�1/..�1/../x�/x�x�y�1/../�a/b�a�../r/�c)
rrYrr*rrrr�
change_cwdr"rrrr�test_realpath_symlink_loopssb������
�

�z)PosixPathTest.test_realpath_symlink_loopsc
Cs��z6t�tt�|jtttdd�t�tdtd�t�tdtd�|jtttddd�|jtttddd�|jtttddd�|jtttddd�|jtttddd�t�tdtd	�|jtttd
tt�d	dd�|jtttd
tt�ddd�t�tt�dtd�|jtttddd�t�d
ttt��dtt�dtd�|jtttddd�t�	tt���|jtttt�dd�Wd�n31s�wYWt�
t�t�
td�t�
td�t�
td	�t�
td�t�
td�dSWt�
t�t�
td�t�
td�t�
td	�t�
td�t�
td�dSt�
t�t�
td�t�
td�t�
td	�t�
td�t�
td�w)NTr�r r!r�r�r�r�r�r�r�r�r�r/r�)rrYrr�rrrrrr�r"rrrr�"test_realpath_symlink_loops_strict�sb������
�

�z0PosixPathTest.test_realpath_symlink_loops_strictc
Cs�z8t�t�t�dtt�td�t�dtd�|�ttd�t�Wt�td�t�td�t	t�dSt�td�t�td�t	t�w)Nr�z/selfzself/self/selfz/link)
rrarrYrr*rrr"rrrrr�(test_realpath_repeated_indirect_symlinks�s
�
z6PosixPathTest.test_realpath_repeated_indirect_symlinkscCsd}zlt�t�t|�D]}t�d�d|gd�td|d�qt�dtd�|�ttd|�t�t�	t��|�td|�t�Wd�n1sQwYWt|d�D]}t�
td|�q]tt�dSt|d�D]}t�
td|�qutt�w)N�
r/z%dz/%drerHz/0)rrar�rangerYr,r*rrr�r"r)r�depth�irrr�test_realpath_deep_recursion�s"
*���
z*PosixPathTest.test_realpath_deep_recursionc
Cs�z_t�t�t�td�t�tdtd�t�td��|�td�td�Wd�n1s3wYWt�td�t	td�t	t�dSWt�td�t	td�t	t�dSt�td�t	td�t	t�w)Nz/y�/kr�z/y/a)
rrarrYrr�r*rr"rrrrr�test_realpath_resolve_parents�s"
���
z+PosixPathTest.test_realpath_resolve_parentsc
Cs6z�t�t�t�td�t�td�t�tdtd�|�ttd�td�t�tt���|�tt	t�d�td�Wd�n"1sJwYWt�
td�ttd�ttd�tt�dSWt�
td�ttd�ttd�tt�dSt�
td�ttd�ttd�tt�w)Nr�z/k/yz/link-yz
/link-y/..)rrarrYr*rrr�rrr"rrrrr�(test_realpath_resolve_before_normalizing
s0
����
z6PosixPathTest.test_realpath_resolve_before_normalizingc
Cszmt�t�t�td�t�ttd�t�tt���"tt�}|�t	|d�t�|�t	|d�td�Wd�n1sAwYWt�
td�ttd�tt�dSWt�
td�ttd�tt�dSt�
td�ttd�tt�w)Nr��linkzlink/k)rrarrYrr�rrr*rr"r)r�baserrr�test_realpath_resolve_first's&
���
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_dS|t_w)NcS�dS)Nz/home/user/barrrrrr�<lambda><�z,PosixPathTest.test_relpath.<locals>.<lambda>���rr�r�z../a/bz../br�z/az../cz/a/bzb/cz../../arHz/foo/bar/batz/x/y/zz../../../foo/bar/batr.�batr/zfoo/bar/batz../../..r�z../foo/bar/batz
../../../x)
rr�rCr=r��
ValueErrorr+r�r*r)r�real_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_dS|t_w)NcSr�)Ns/home/user/barrrrrrr�Vr�z2PosixPathTest.test_relpath_bytes.<locals>.<lambda>r�r7�asa/bs../a/bs../bs../s/as../cs/a/bsb/cs../../ar�s/foo/bar/bats/x/y/zs../../../foo/bar/batr5sbatr6sfoo/bar/bats../../..s/xs../foo/bar/bats
../../../xsbytesr�)rr�rCr=r�r�r+r�r*r�	TypeError)r�real_getcwdbr�rrr�test_relpath_bytesUs8
�
�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)NcS�g|]}t�|��qSr�rr\��.0�prrr�
<listcomp>v�z@PosixPathTest.test_commonpath.<locals>.check.<locals>.<listcomp>)r*r+�
commonpathrr\)�paths�expectedrrr�checkts�z,PosixPathTest.test_commonpath.<locals>.checkcs.��|tj|���|tjdd�|D��dS)NcSr�rr�r�rrrr�{r�zFPosixPathTest.test_commonpath.<locals>.check_error.<locals>.<listcomp>)r�r+r�)�excr�rrr�check_errorxs
�z2PosixPathTest.test_commonpath.<locals>.check_errorz/usr�usrz
/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/lib64�spam�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_commonpathss\
�
�
�
�
�
�zPosixPathTest.test_commonpath)0�__name__�
__module__�__qualname__rrr-r>rFrJrMrNrOr^r`rbr
�
skipUnlessrrXrc�skipIfrfrprrrtr~�sys�platformr�r�rr�r��hasattrrr�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr's�




�


�
'
	
	��
��'�'�����rc@seZdZeZgd�ZdS)�PosixCommonTest)r��samefile�sameopenfile�samestatN)r�r�r�r+�
pathmodule�
attributesrrrrr��sr�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)*�
PathLikeTestscCsbtj|_ttj�|_|�tj|j�t|jdd��}|�d�Wd�dS1s*wYdS)N�xbrstest_posixpath.PathLikeTests)	rr#�	file_namer	�	file_path�
addCleanupr"rVrW)r�filerrrr�s"�zPathLikeTests.setUpcCs|�||j�||j��dSr)r*r�r�)r�funcrrr�assertPathEqual�szPathLikeTests.assertPathEqualcC�|�|jj�dSr)r�rC�normcaserrrr�test_path_normcase��z PathLikeTests.test_path_normcasecCr�r)r�rCrLrrrr�test_path_isabs�r�zPathLikeTests.test_path_isabscCs,|�|j�dtd�d�|j�ddd��dS)Nr��br�)r*rCr,r	rrrr�test_path_join�s�zPathLikeTests.test_path_joincCr�r)r�rCr=rrrr�test_path_split�r�zPathLikeTests.test_path_splitcCr�r)r�rCrArrrr�test_path_splitext�r�z PathLikeTests.test_path_splitextcCr�r)r�rC�
splitdriverrrr�test_path_splitdrive�r�z"PathLikeTests.test_path_splitdrivecCr�r)r�rCrrrrr�test_path_basename�r�z PathLikeTests.test_path_basenamecCr�r)r�rCrrrrr�test_path_dirname�r�zPathLikeTests.test_path_dirnamecCr�r)r�rCrTrrrr�test_path_islink�r�zPathLikeTests.test_path_islinkcCr�r)r�rCrUrrrr�test_path_lexists�r�zPathLikeTests.test_path_lexistscCr�r)r�rCr_rrrr�test_path_ismount�r�zPathLikeTests.test_path_ismountcCr�r)r�rCrsrrrr�test_path_expanduser�r�z"PathLikeTests.test_path_expandusercCr�r)r�rC�
expandvarsrrrr�test_path_expandvars�r�z"PathLikeTests.test_path_expandvarscCr�r)r�rCr�rrrr�test_path_normpath�r�z PathLikeTests.test_path_normpathcCr�r)r�rCrrrrr�test_path_abspath�r�zPathLikeTests.test_path_abspathcCr�r)r�rCrrrrr�test_path_realpath�r�z PathLikeTests.test_path_realpathcCr�r)r�rCr�rrrr�test_path_relpath�r�zPathLikeTests.test_path_relpathcCs&|j�|j|jg�}|�||j�dSr)rCr�r�r�r*)r�common_pathrrr�test_path_commonpath�sz"PathLikeTests.test_path_commonpathN)r�r�r�r+rCrr�r�r�r�r�r�r�r�r�r�r�rrrrrrrr	rrrrr��s,r��__main__)rr+r�r
rrrrrr�test.supportrr�test.support.os_helperr	r
rf�ImportErrorr#rrr�TestCaser�
CommonTestr�r�r��mainrrrr�<module>s:�

G�

Youez - 2016 - github.com/yon3zu
LinuXploit