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_ntpath.cpython-310.pyc
o

�9j��@s^ddlZddlZddlZddlZddlZddlmZddlmZm	Z	ddlm
Z
ddlmZddlm
Z
ddlmZzddlZWneyKdZYnwzejWney\dZYnwd	ZzddlZWneypdZYnwd	Zd
d�Zdd
�Zdd�ZGdd�dej�ZGdd�de�ZGdd�de
jej�ZGdd�de�Ze dkr�e�!�dSdS)�N)�support)�	os_helper�
is_emscripten)�
TestFailed)�FakePath)�test_genericpath)�
TemporaryFileFTcCsntjddd�j}tjtjtjg|_tj|_||dd�}|s&td�t�	����t�
|�}||||�}|d|�S)N�kernel32T)�use_last_errorrz&failed to get short path name 0x{:08X})�ctypes�WinDLL�GetShortPathNameW�	c_wchar_p�c_uint32�argtypes�restype�OSError�format�get_last_error�create_unicode_buffer)�path�GSPN�
result_len�result�r�'/usr/lib/python3.10/test/test_ntpath.py�_getshortpathname"s
�
rcCsBt|tttjf�rt�t�|��St|d�rt	dd�|D��S|S)N�__iter__css �|]}t�t�|��VqdS�N)�ntpath�normcase�os�fsdecode��.0�prrr�	<genexpr>2s�z_norm.<locals>.<genexpr>)
�
isinstance�bytes�strr!�PathLikerr r"�hasattr�tuple)rrrr�_norm.s

r-cCs&|�dd�}t|�}||kr&t|�t|�kr&t�dt|�t|�t|�f��|�dd�}|�dd�}|�dd	�}|�d
d�}|�dd
�}|�dd�}t�|��d�}|�	dd��d�}t
���t
�dt
�t|�}Wd�n1stwYt|�t|�kr�t�dt|�t|�t|�f��dS)N�\�\\z%%s should return: %s but returned: %sz('z(b'z("z(b"z['z[b'z["z[b"z, 'z, b'z, "z, b"�latin1�ascii�backslashreplace�ignore)�replace�evalr-rrr)r!�fsencode�decode�encode�warnings�catch_warnings�simplefilter�DeprecationWarning�repr)�fn�
wantResult�	gotResultrrr�tester6s.�

���rAc@seZdZdd�Zdd�ZdS)�NtpathTestCasecCs,||kst|�t|�krdS|�||�dSr)r-�assertEqual)�self�path1�path2rrr�assertPathEqualOszNtpathTestCase.assertPathEqualcCs|�t|�t|��dSr)�assertInr-)rDr�pathsetrrr�assertPathInTszNtpathTestCase.assertPathInN)�__name__�
__module__�__qualname__rGrJrrrrrBNsrBc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zej
e�ed�dd���Zej
e�ed�dd���Zej
e�ed�dd���Zej
e�ed�dd���Zej
e�ed�dd���Zej
e�ed�dd���Zej
e�ed�d d!���Ze�ed�d"d#��Ze�ed�e�ed$�d%d&���Zd'd(�Ze�ejd)�d*d+��Ze�d,�d-d.��Z d/d0�Z!e�e"d1�d2d3��Z#d4d5�Z$d6d7�Z%d8d9�Z&d:d;�Z'd<d=�Z(e�e"d>�d?d@��Z)dAS)B�
TestNtpathcCshtdd�tdd�tdd�tdd�td	d
�tdd�td
d�tdd�tdd�tdd�dS)Nzntpath.splitext("foo.ext"))�foo�.extzntpath.splitext("/foo/foo.ext"))z/foo/foorPzntpath.splitext(".ext"))rP�zntpath.splitext("\foo.ext\foo"))z\foo.ext\foorQzntpath.splitext("foo.ext\"))zfoo.ext\rQzntpath.splitext(""))rQrQzntpath.splitext("foo.bar.ext"))zfoo.barrPz!ntpath.splitext("xx/foo.bar.ext"))z
xx/foo.barrPz!ntpath.splitext("xx\foo.bar.ext"))z
xx\foo.barrPzntpath.splitext("c:a/b\c.d"))zc:a/b\cz.d�rA�rDrrr�
test_splitextYs








zTestNtpath.test_splitextcCsftdd�tdd�tdd�tdd�td	d
�tdd�td
d�tdd�|�t�d�d�dS)Nzntpath.splitdrive("c:\foo\bar"))�c:�\foo\barzntpath.splitdrive("c:/foo/bar"))rU�/foo/barz/ntpath.splitdrive("\\conky\mountpoint\foo\bar"))z\\conky\mountpointrVz/ntpath.splitdrive("//conky/mountpoint/foo/bar"))z//conky/mountpointrWz0ntpath.splitdrive("\\\conky\mountpoint\foo\bar"))rQz\\\conky\mountpoint\foo\barz0ntpath.splitdrive("///conky/mountpoint/foo/bar"))rQz///conky/mountpoint/foo/barz0ntpath.splitdrive("\\conky\\mountpoint\foo\bar"))rQz\\conky\\mountpoint\foo\barz0ntpath.splitdrive("//conky//mountpoint/foo/bar"))rQz//conky//mountpoint/foo/baru//conky/MOUNTPOİNT/foo/bar)u//conky/MOUNTPOİNTrW)rArCr�
splitdriverSrrr�test_splitdrivees6���������zTestNtpath.test_splitdrivecCs@tdd�tdd�tdd�tdd�td	d
�tdd�dS)
Nzntpath.split("c:\foo\bar"))zc:\foo�barz*ntpath.split("\\conky\mountpoint\foo\bar"))z\\conky\mountpoint\foorZzntpath.split("c:\"))�c:\rQz#ntpath.split("\\conky\mountpoint\"))z\\conky\mountpoint\rQzntpath.split("c:/"))�c:/rQz#ntpath.split("//conky/mountpoint/"))z//conky/mountpoint/rQrRrSrrr�
test_splitzs
�
�
zTestNtpath.test_splitcCs,tdd�tdd�tdd�tdd�dS)Nzntpath.isabs("c:\")�z#ntpath.isabs("\\conky\mountpoint\")zntpath.isabs("\foo")zntpath.isabs("\foo\bar")rRrSrrr�
test_isabs�s


zTestNtpath.test_isabscCs"tdd�tdd�tdd�dS)Nz>ntpath.commonprefix(["/home/swenson/spam", "/home/swen/spam"])z
/home/swenz;ntpath.commonprefix(["\home\swen\spam", "\home\swen\eggs"])z\home\swen\z;ntpath.commonprefix(["/home/swen/spam", "/home/swen/spam"])z/home/swen/spamrRrSrrr�test_commonprefix�s���zTestNtpath.test_commonprefixcCs2tdd�tdd�tdd�tdd�tdd	�td
d�tdd
�tdd�tdd�tdd�tdd�tdd�tdd�tdd�tdd�tdd�tdd�tdd�tdd�td d�td!d"�td#d$�td%d&�td'd(�td)d*�td+d,�td-d.�td/d0�td1d2�td3d4�td5d6�td7d8�td9d:�td;d<�td=d<�td>d0�td?d0�td@d0�tdAd0�tdBd8�tdCd8�tdDd8�tdEdF�tdGdH�tdIdJ�tdKdL�dMD]}dND]}tdO||f|�q�q�tdPdQ�tdRdQ�tdSdQ�tdTdU�tdVdW�tdXdY�dS)ZNzntpath.join("")rQzntpath.join("", "", "")zntpath.join("a")�azntpath.join("/a")z/azntpath.join("\a")�\azntpath.join("a:")za:zntpath.join("a:", "\b")za:\bzntpath.join("a", "\b")z\bzntpath.join("a", "b", "c")za\b\czntpath.join("a\", "b", "c")zntpath.join("a", "b\", "c")zntpath.join("a", "b", "\c")z\czntpath.join("d:\", "\pleep")zd:\pleepzntpath.join("d:\", "a", "b")zd:\a\bzntpath.join('', 'a')z ntpath.join('', '', '', '', 'a')zntpath.join('a', '')za\z ntpath.join('a', '', '', '', '')zntpath.join('a\', '')z!ntpath.join('a\', '', '', '', '')zntpath.join('a/', '')za/zntpath.join('a/b', 'x/y')za/b\x/yzntpath.join('/a/b', 'x/y')z/a/b\x/yzntpath.join('/a/b/', 'x/y')z/a/b/x/yzntpath.join('c:', 'x/y')zc:x/yzntpath.join('c:a/b', 'x/y')z	c:a/b\x/yzntpath.join('c:a/b/', 'x/y')z	c:a/b/x/yzntpath.join('c:/', 'x/y')zc:/x/yzntpath.join('c:/a/b', 'x/y')z
c:/a/b\x/yzntpath.join('c:/a/b/', 'x/y')z
c:/a/b/x/yz&ntpath.join('//computer/share', 'x/y')z//computer/share\x/yz'ntpath.join('//computer/share/', 'x/y')z//computer/share/x/yz*ntpath.join('//computer/share/a/b', 'x/y')z//computer/share/a/b\x/yzntpath.join('a/b', '/x/y')z/x/yzntpath.join('/a/b', '/x/y')zntpath.join('c:', '/x/y')zntpath.join('c:a/b', '/x/y')zntpath.join('c:/', '/x/y')zntpath.join('c:/a/b', '/x/y')z'ntpath.join('//computer/share', '/x/y')z(ntpath.join('//computer/share/', '/x/y')z)ntpath.join('//computer/share/a', '/x/y')zntpath.join('c:', 'C:x/y')zC:x/yzntpath.join('c:a/b', 'C:x/y')z	C:a/b\x/yzntpath.join('c:/', 'C:x/y')zC:/x/yzntpath.join('c:/a/b', 'C:x/y')z
C:/a/b\x/y)
rQza/bz/a/brUzc:a/br\zc:/a/bz//computer/sharez//computer/share/z//computer/share/a/b)zd:zd:x/yzd:/zd:/x/yz//machine/commonz//machine/common/z//machine/common/x/yzntpath.join(%r, %r)z*ntpath.join('\\computer\share\', 'a', 'b')z\\computer\share\a\bz)ntpath.join('\\computer\share', 'a', 'b')z&ntpath.join('\\computer\share', 'a\b')z*ntpath.join('//computer/share/', 'a', 'b')z//computer/share/a\bz)ntpath.join('//computer/share', 'a', 'b')z//computer/share\a\bz&ntpath.join('//computer/share', 'a/b')z//computer/share\a/brR)rD�x�yrrr�	test_join�sp













































�




zTestNtpath.test_joincCs�tdd�tdd�tdd�tdd�tdd�td	d
�tdd�td
d�tdd�tdd�tdd�tdd�tdd�tdd�tdd�tdd�tdd�tdd�td d!�td"d#�td$d%�td&d'�dS)(Nz$ntpath.normpath('A//////././//.//B')zA\Bzntpath.normpath('A/./B')zntpath.normpath('A/foo/../B')zntpath.normpath('C:A//B')zC:A\Bzntpath.normpath('D:A/./B')zD:A\Bzntpath.normpath('e:A/foo/../B')ze:A\Bzntpath.normpath('C:///A//B')zC:\A\Bzntpath.normpath('D:///A/./B')zD:\A\Bz"ntpath.normpath('e:///A/foo/../B')ze:\A\Bzntpath.normpath('..')�..zntpath.normpath('.')�.zntpath.normpath('')zntpath.normpath('/')r.zntpath.normpath('c:/')r[zntpath.normpath('/../.././..')zntpath.normpath('c:/../../..')zntpath.normpath('../.././..')�..\..\..zntpath.normpath('K:../.././..')z
K:..\..\..zntpath.normpath('C:////a/b')zC:\a\bz'ntpath.normpath('//machine/share//a/b')z\\machine\share\a\bzntpath.normpath('\\.\NUL')�\\.\NULzntpath.normpath('\\?\D:/XY\Z')z\\?\D:/XY\ZrRrSrrr�
test_normpath�s,




















zTestNtpath.test_normpathcCsDt�t���}td|�td|�td|�td|�td|�dS)Nzntpath.realpath('.')zntpath.realpath('./.')z&ntpath.realpath('/'.join(['.'] * 100))zntpath.realpath('.\.')z&ntpath.realpath('\'.join(['.'] * 100)))r�normpathr!�getcwdrA�rD�expectedrrr�test_realpath_curdir�s



zTestNtpath.test_realpath_curdircCs~t�t���}tdt�|��tdt�t�|���tdt�|�dd�tdt�t�|���tdt�|�dd�dS)Nzntpath.realpath('..')zntpath.realpath('../..')z&ntpath.realpath('/'.join(['..'] * 50))rr.zntpath.realpath('..\..')z&ntpath.realpath('\'.join(['..'] * 50)))rrkr!rlrA�dirnamerXrmrrr�test_realpath_pardir�s����zTestNtpath.test_realpath_pardirzneed _getfinalpathnamecCs�t�tj�}t|d���|�tj|�|�tj|d�t�	||d�|�
t�|d�|�|�
t�t�|d��t�|��dS�N�wb�1)
r�abspathr�TESTFN�open�close�
addCleanup�unlinkr!�symlinkrG�realpathr6�rD�ABSTFNrrr�test_realpath_basics�zTestNtpath.test_realpath_basiccCsZt�tj�}t�|d|�|�tj|�|jt	tj
|dd�|jt	tj
|ddd�dS)NrtT��strict�2)rrurrvr!r{ryrz�assertRaises�FileNotFoundErrorr|r}rrr�test_realpath_stricts
zTestNtpath.test_realpath_strictcCsjt�tj�}t|d���|�tj|�|�tj|d�t�	|t�
|d��|�t�|d�|�dSrr)
rrurrvrwrxryrzr!r{�relpathrGr|r}rrr�test_realpath_relativesz!TestNtpath.test_realpath_relativecCsvt�tj�}t�|�|�tj|�t�|���t�d�t�	d�t�
dd�t�
dd�t�	d�t�
dd�t�
dd�t�
d	d
�t�
dd�t�
d
d�t�
|dd�t�
dd�|�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�t�
|d��|�t�d�t�
|d��|�t�d�t�
|d��|�t�d�t�
|d��|�t�d�t�
|d��|�t�d �t�
|d��|�t�d!�t�
|d��|�t�d"�t�
|d��Wd�dS1�s4wYdS)#N�subdirrg�	recursiverf�parentrD�missing�brokenz
broken\bar�broken1zself\self\broken�broken2z"subdir\parent\subdir\parent\broken�broken3z\broken�broken4zrecursive\..\broken�broken5z\missingz
broken\fooz\missing\fooz\broken\barzbroken1\bazz\broken\bar\bazz\self\self\missingz$\subdir\parent\subdir\parent\missingsbrokens
broken\foosbroken1sbroken1\bazsbroken2sbroken3sbroken4sbroken5)rrurrvr!�mkdirry�rmtree�
change_cwd�chdirr{rGr|r6r}rrr�test_realpath_broken_symlinks's�



����������������$�z(TestNtpath.test_realpath_broken_symlinkscCsNt�tj�}|�tj|�|�tj|d�|�tj|d�|�tj|d�|�tj|d�|�tj|d�t�||�|�t�	|�|�t�|d|d�t�|d|d�|d|df}|�
t�	|d�|�|�
t�	|d�|�|�
t�	|d�dd�|D��|�t�	|d	�t�|��|�t�	|d
�t�|�d�t�|d|d�|�t�	|d
t�|�d�|d�|�
t�	|d
t�|�d�|�t�t�|�d|d�|�t�	|d�|d�t�dt�t�|��dt�|�d|d�|�t�	|d�|d�|�t�	t�|��|�dS)Nrtr�rd�cra�1\xcss�|]	}t�|d�VqdS)rcN)r�join)r$�rrrrr&xs�z9TestNtpath.test_realpath_symlink_loops.<locals>.<genexpr>�1\..�1\..\xz\xrc�1\..\�a\b�..\r.)
rrurrvryrzr!r{rGr|rJrp�basename)rDr~rnrrr�test_realpath_symlink_loops`sf�������������z&TestNtpath.test_realpath_symlink_loopscCs6t�tj�}|�tj|�|�tj|d�|�tj|d�|�tj|d�|�tj|d�|�tj|d�t�||�|jt	tj
|dd�t�|d|d�t�|d|d�|jt	tj
|ddd�|jt	tj
|ddd�|jt	tj
|ddd�|�tj
|d	dd�t�|��|jt	tj
|d
dd�t�|d|d�|jt	tj
|dt�
|�ddd�|jt	tj
|dt�
|�ddd�t�t�
|�d
|d�|jt	tj
|ddd�t�dt�
t�|��dt�
|�d|d�|jt	tj
|ddd�|jt	tj
t�
|�dd�dS)Nrtr�rdr�raTr�r�r�r�rcr�r�r�r.)rrurrvryrzr!r{r�rr|rGrpr�r}rrr�"test_realpath_symlink_loops_strict�sZ����
�����
�z-TestNtpath.test_realpath_symlink_loops_strictcCst�tj�}|�tj|d�|�tjd|d�|�tj|d�|�tj|d�t|dd��
}|�d�Wd�n1sCwYt�	|d|d�td|dd��
}|�d�Wd�n1skwYt�	d|d|d�|�
t�|d�|d�|�
t�|d�d|d�tt�|d�d	��}|�|�
�d�Wd�n1s�wYtt�|d�d	��}|�|�
�d�Wd�n1s�wY|�
t�d|d�d|d�|�
t�d|d�d|d�dS)
N�3z\\?\z3.�3linkz3.linkrs�0�1�rb)rrurrvryrzrw�writer!r{rGr|rC�read)rDr~�frrr�test_realpath_symlink_prefix�s>���
���
�
�z'TestNtpath.test_realpath_symlink_prefixcCstdd�dS)Nzntpath.realpath('NUL')rirRrSrrr�test_realpath_nul�szTestNtpath.test_realpath_nulzneed _getshortpathnamecCsrt�tj�}t�|�t�|�t�|�|�tj|�t�	|d�}t�|�t
|�}t�	|d�}t�	|d�}t|d��
}|�d�Wd�n1sLwY|�
|t�|��t�|��|�
|t�d��Wd�n1sswYt�|����|�
|t�d��Wd�n1s�wYt�|��|�
|t�d��Wd�dS1s�wYdS)N�MyVeryLongDirectoryNamezfile.txtrsscontent)rrurrvrzr�r!r�ryr�rrwr�rGr|r��lower)rDr~�
test_dir_long�test_dir_short�test_file_long�test_file_shortr�rrr�test_realpath_cwd�s.



���"�zTestNtpath.test_realpath_cwdcCst���x}|��d|d<d|d<d|d<tdd�tdd	�td
d�tdd
�tdd�tdd�tdd�tdd�tdd�tdd�tdd�tdd	�tdd�tdd�tdd�td d!�td"d#�td$d%�td&d'�Wd�dS1swYdS)(NrZrO�baz1z{foo�baz2z{foo}zntpath.expandvars("foo")zntpath.expandvars("$foo bar")zbar barzntpath.expandvars("${foo}bar")�barbarzntpath.expandvars("$[foo]bar")z	$[foo]barzntpath.expandvars("$bar bar")z$bar barzntpath.expandvars("$?bar")z$?barzntpath.expandvars("$foo}bar")zbar}barzntpath.expandvars("${foo")z${foozntpath.expandvars("${{foo}}")zbaz1}zntpath.expandvars("$foo$foo")zntpath.expandvars("$bar$bar")z$bar$barzntpath.expandvars("%foo% bar")zntpath.expandvars("%foo%bar")zntpath.expandvars("%foo%%foo%")z$ntpath.expandvars("%%foo%%foo%foo%")z%foo%foobarzntpath.expandvars("%?bar%")z%?bar%zntpath.expandvars("%foo%%bar")zbar%barz ntpath.expandvars("'%foo%'%bar")z'%foo%'%barzntpath.expandvars("bar'%foo%")z	bar'%foo%)r�EnvironmentVarGuard�clearrA�rD�envrrr�test_expandvars�s2


















"�zTestNtpath.test_expandvarszneed os_helper.FS_NONASCIIcCs�dd�}t���l}|��tj}||d<d|||<|dd|�|d|d|�|dd	|�|d
|d|�|dd
|�|d|d|�|dd|�|d�|�d|�|dd	|�|d�|�d|�Wd�dS1swwYdS)NcSstd||�dS)Nzntpath.expandvars(%r)rR)�valuernrrr�check�z2TestNtpath.test_expandvars_nonascii.<locals>.check�spam�hamz	$spam barz%s barz$%s barz
${spam}barz%sbarz${%s}barzham%sbarz	$spam}barz%s}barz$%s}barz
%spam% barz%{}% barz	ham%s barz	%spam%barz%{}%bar)rr�r��FS_NONASCIIr)rDr�r��nonasciirrr�test_expandvars_nonasciis"
"�z#TestNtpath.test_expandvars_nonascii�cpucCs�tj}t���S}|��d|d<d}|�|d|�d|�|�|d|�d|�|�|d|d�d|d	�|�|d|�d	|�|�|d
|�d|�Wd�dS1s]wYdS)N�B�Ai��z%A%z%A%A�BAz''z%%�%z$$�$)r�
expandvarsrr�r�rC)rDr�r��nrrr�test_expandvars_large,s
 "�z TestNtpath.test_expandvars_largecCsDtdd�t����}|��tdd�d|d<d|d<d	|d
<tdd�tdd
�|d=tdd�tdd�|��d
|d<d	|d
<tdd�tdd
�tdd�tdd�tdd�tdd�|��d|d<d
|d<d	|d
<tdd�tdd
�|��d
|d<d|d
<tdd�tdd
�Wd�dS1s�wYdS)Nzntpath.expanduser("test")�testzntpath.expanduser("~test")z~test�C:\�	HOMEDRIVEz
Users\eric�HOMEPATH�eric�USERNAMEz
C:\Users\testzntpath.expanduser("~")z
C:\Users\ericz
Users\test�USERPROFILEz"ntpath.expanduser("~test\foo\bar")zC:\Users\test\foo\barz"ntpath.expanduser("~test/foo/bar")zC:\Users\test/foo/barzntpath.expanduser("~\foo\bar")zC:\Users\eric\foo\barzntpath.expanduser("~/foo/bar")zC:\Users\eric/foo/barzF:\�HOME�idle)rArr�r�r�rrr�test_expanduser9sR








����


"�zTestNtpath.test_expanduserzabspath requires 'nt' modulecCs~tdd�t�tj��*}td|�td|d�td|d�t�|�\}}td|d	�Wd�dS1s8wYdS)
Nzntpath.abspath("C:\")r�zntpath.abspath("")zntpath.abspath(" ")z\ zntpath.abspath("?")z\?zntpath.abspath("/abc/")z\abc)rAr�temp_cwdrvrrX)rD�cwd_dir�drive�_rrr�test_abspathjs

"�zTestNtpath.test_abspathcCstdd�tdd�tdd�tdd�t�tj��}t�|�}tdd	|d
�tdd	|d�Wd�n1s<wYtd
d�tdd�tdd�tdd�tdd�tdd�tdd�tdd�tdd�tdd�td d�td!d�td"d�td#d�dS)$Nzntpath.relpath("a")raz#ntpath.relpath(ntpath.abspath("a"))zntpath.relpath("a/b")r�zntpath.relpath("../a/b")z..\a\bzntpath.relpath("a", "../b")r�rbzntpath.relpath("a/b", "../c")z\a\bzntpath.relpath("a", "b/c")z..\..\az*ntpath.relpath("c:/foo/bar/bat", "c:/x/y")z..\..\foo\bar\batz@ntpath.relpath("//conky/mountpoint/a", "//conky/mountpoint/b/c")zntpath.relpath("a", "a")rgz(ntpath.relpath("/foo/bar/bat", "/x/y/z")z..\..\..\foo\bar\batz*ntpath.relpath("/foo/bar/bat", "/foo/bar")�batz#ntpath.relpath("/foo/bar/bat", "/")zfoo\bar\batz#ntpath.relpath("/", "/foo/bar/bat")rhz$ntpath.relpath("/foo/bar/bat", "/x")z..\foo\bar\batz$ntpath.relpath("/x", "/foo/bar/bat")z
..\..\..\xzntpath.relpath("/", "/")zntpath.relpath("/a", "/a")zntpath.relpath("/a/b", "/a/b")z"ntpath.relpath("c:/foo", "C:/FOO"))rArr�rvrr�)rDr��
currentdirrrr�test_relpathts.




�












zTestNtpath.test_relpathcsZdd�}�fdd�}��ttjg�|tddg�|tddg�|tddg�|tddg�|dgd�|ddgd�|d	dgd�|d	d	gd�|d
dgd�|dd
gd�|ddgd�|ddgd�|ddgd�|ddgd�|ddgd�|d	dgd�|ddgd�|ddgd�|ddgd�|tddg�|dgd�|ddgd�|ddgd�|ddgd�|ddgd�|dd gd�|gd!�d�|gd"�d�|d#d$gd%�|dgd�|dd&gd�|tdd'g���ttjd(dg���ttjd(d)g���ttjd*dg���ttjdd+g���ttjdd,g���ttjdd+g�dS)-NcSstd|�dd�|�dS)Nzntpath.commonpath(%r)r/r.)rAr4)�pathsrnrrrr��s�z)TestNtpath.test_commonpath.<locals>.checkcs.��|tj|���|tjdd�|D��dS)NcSsg|]}t�|��qSr)r!r6r#rrr�
<listcomp>�szCTestNtpath.test_commonpath.<locals>.check_error.<locals>.<listcomp>)r�r�
commonpath)�excr�rSrr�check_error�s
�z/TestNtpath.test_commonpath.<locals>.check_errorzC:\Program Filesz
Program FileszC:Program Filesz\Program FileszC:\Program Files\zC:\\Program FileszC:\Program Files\\zC:\.\Program FileszC:\Program Files\.r�zC:\binzC:\Program Files\BarzC:\Program Files\FoozC:\ProjectszC:/Program Files/Barzc:/program files/barzc:\program fileszD:\Program Filesr��alotrQ�and\jam�and\spam�andzand\\jamz
and\spam\\z	and\.\jamz
.\and\spam)r�r�r�)r�r�r�z	C:and\jamz
C:and\spamzC:andz	spam\alotz
\spam\alotsC:\Program FileszProgram Files\Foos
Program FilessC:\Program Files\FoosProgram Files\Foo)r��
ValueErrorrr��	TypeError)rDr�r�rrSr�test_commonpath�s����������
�
�
�
�
�
�zTestNtpath.test_commonpathc
Cs�t��^}t��B}|�t�|��|����|�t�|��|����tjdkrB|�t	��t�dd�Wd�n1s=wYWd�n1sLwYWd�dSWd�dS1sdwYdS)N�win32���)
r�
assertTruer�sameopenfile�fileno�assertFalse�sys�platformr�r)rD�tf1�tf2rrr�test_sameopenfile�s
��P�zTestNtpath.test_sameopenfilecCs�|�t�d��|�t�d��|�t�d��|�t�d��|�t�d��|�t�d��|�t�d��|�t�d��|�t�d	��|�t�d
��|�t�d��|�t�d��t���}|�t�|��Wd�n1swwYtjd
kr�t�tj	�\}}t�
t�tj	���|�t�|����|�t�|�
���Wd�n1s�wY|�t�d��|�t�d��|�t�d��|�t�d��dSdS)Nr[r�r\zC:/z\\.\c:\z\\.\C:\sc:\sC:\sc:/sC:/s\\.\c:\s\\.\C:\r�z\\localhost\c$z\\localhost\c$\s\\localhost\c$s\\localhost\c$\)r�r�ismountr�temp_dirr�r�r�rX�
executabler�rpr��upper)rD�dr�rrrr�test_ismount�s4
�
��zTestNtpath.test_ismountcCs|�|��|���dS)z<Assert that two strings are equal ignoring case differences.N)rCr�)rD�s1�s2rrr�
assertEqualCIszTestNtpath.assertEqualCIzOS helpers require 'nt' modulecCst�tj�}|t�|�fD]}t�|�}t�|�d}t�|�d}|�	||�q
t�
tj�\}}|�|d�|�|d�t�
tj�
��\}}	|�||�|�|	d�tjtjfD]*}t�|�}
|�|
t�|�t|
�d�t�|�
��}|�|t�|�t|�d�qYdS)Nr)�nt�_getfinalpathnamer�r�r!r6�_getvolumepathnamerrXr��
_getdiskusage�exec_prefix�
assertGreaterr8rC�prefix�assertIsInstancer)�lenr()rDr�r�volume_path�
path_drive�volume_path_drive�cap�free�b_cap�b_free�
final_path�b_final_pathrrr�test_nt_helperss(

�zTestNtpath.test_nt_helpersN)*rKrLrMrTrYr]r_r`rerjrorqr�skip_unless_symlink�unittest�
skipUnless�HAVE_GETFINALPATHNAMErr�r�r�r�r�r�r��HAVE_GETSHORTPATHNAMEr�r�r�r�r�requires_resourcer�r�r�r�r�r�r�r�r�rrrrrrNXsfA

	
	
7
-
*

 





1
	E
#
rNc@seZdZeZdgZdS)�NtCommonTestr�N)rKrLrMr�
pathmodule�
attributesrrrrr#s
rc@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)d*�Zd+S),�
PathLikeTestscCsbtj|_ttj�|_|�tj|j�t|jdd��}|�d�Wd�dS1s*wYdS)N�xbrstest_ntpath.PathLikeTests)	rrv�	file_namer�	file_pathryrzrwr�)rD�filerrr�setUp,s"�zPathLikeTests.setUpcCs|�||j�||j��dSr)rGrr)rD�funcrrr�_check_function3szPathLikeTests._check_functioncCs2|�|jj�tjdkr|�t�d�d�dSdS)Nr�uΩΩuωΩ)r"rr r�r�rCrrSrrr�test_path_normcase6s
�z PathLikeTests.test_path_normcasecC�|�|jj�dSr)r"r�isabsrSrrr�test_path_isabs;r�zPathLikeTests.test_path_isabscCs,|�|j�dtd�d�|j�ddd��dS)Nra�br�)rCrr�rrSrrr�test_path_join>s�zPathLikeTests.test_path_joincCr$r)r"r�splitrSrrr�test_path_splitBr�zPathLikeTests.test_path_splitcCr$r)r"r�splitextrSrrr�test_path_splitextEr�z PathLikeTests.test_path_splitextcCr$r)r"rrXrSrrr�test_path_splitdriveHr�z"PathLikeTests.test_path_splitdrivecCr$r)r"rr�rSrrr�test_path_basenameKr�z PathLikeTests.test_path_basenamecCr$r)r"rrprSrrr�test_path_dirnameNr�zPathLikeTests.test_path_dirnamecCr$r)r"r�islinkrSrrr�test_path_islinkQr�zPathLikeTests.test_path_islinkcCr$r)r"r�lexistsrSrrr�test_path_lexistsTr�zPathLikeTests.test_path_lexistscCr$r)r"rr�rSrrr�test_path_ismountWr�zPathLikeTests.test_path_ismountcCr$r)r"r�
expanduserrSrrr�test_path_expanduserZr�z"PathLikeTests.test_path_expandusercCr$r)r"rr�rSrrr�test_path_expandvars]r�z"PathLikeTests.test_path_expandvarscCr$r)r"rrkrSrrr�test_path_normpath`r�z PathLikeTests.test_path_normpathcCr$r)r"rrurSrrr�test_path_abspathcr�zPathLikeTests.test_path_abspathcCr$r)r"rr|rSrrr�test_path_realpathfr�z PathLikeTests.test_path_realpathcCr$r)r"rr�rSrrr�test_path_relpathir�zPathLikeTests.test_path_relpathcCs&|j�|j|jg�}|�||j�dSr)rr�rrrG)rD�common_pathrrr�test_path_commonpathlsz"PathLikeTests.test_path_commonpathcCr$r)r"r�isdirrSrrr�test_path_isdirpr�zPathLikeTests.test_path_isdirN)rKrLrMrrr r"r#r&r(r*r,r-r.r/r1r3r4r6r7r8r9r:r;r=r?rrrrr(s.r�__main__)"rr!r�rr9r�r�test.supportrrr�test.support.os_helperrr�tempfilerr��ImportErrorr�AttributeErrorrrrrr-rA�TestCaserBrN�
CommonTestrrrK�mainrrrr�<module>sV�
��
PL�

Youez - 2016 - github.com/yon3zu
LinuXploit