403Webshell
Server IP : 118.27.122.248  /  Your IP : 216.73.216.15
Web Server : Apache
System : Linux web0264.sh.tyo1 4.18.0-553.79.1.lve.el7h.x86_64 #1 SMP Wed Oct 15 16:34:46 UTC 2025 x86_64
User : c9415830 ( 11735)
PHP Version : 8.4.17
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python36/lib64/python3.6/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python36/lib64/python3.6/test/__pycache__/test_pathlib.cpython-36.opt-2.pyc
3

�
�^Ya�@sddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl	m
Z
ddlmZddl
mZmZyddlZddlZWnek
r�dZZYnXGdd�de�ZGdd�dee	j�ZGd	d
�d
ee	j�ZGdd�de�ZGd
d�dee	j�ZGdd�dee	j�ZGdd�dee	j�Zejje�Zdd�Zdd�Z dd�Z!e!�Z!e	j"ej#dkd�Z$e	j"ej#dkd�Z%e	j"e!e!�Z&e%Gdd�de��Z'e$Gdd�de��Z(Gdd �d e�Z)Gd!d"�d"e)e	j�Z*e%Gd#d$�d$e)e	j��Z+e$Gd%d&�d&e)e	j��Z,e-d'k�re	j.�dS)(�N)�mock)�support)�TESTFN�FakePathc@seZdZdd�Zdd�ZdS)�_BaseFlavourTestcsd|jj}|jj�|jj�|�fdd�|D��}|j||��r`|�fdd�|D��}|j||�dS)Ncsg|]}|jd���qS)�/)�replace)�.0�x)�sep��1/opt/alt/python36/lib64/python3.6/test_pathlib.py�
<listcomp>sz7_BaseFlavourTest._check_parse_parts.<locals>.<listcomp>csg|]}|jd���qS)r)r)r	r
)�altseprr
rs)�flavourZparse_partsrr�assertEqual)�self�arg�expected�f�actualr)rrr
�_check_parse_partssz#_BaseFlavourTest._check_parse_partscCs�|j}|jj}|gddgf�|dgdddgf�|dgdddgf�|ddgddddgf�|dgddddgf�|dgddddgf�|dddgddddd	dgf�|dd
dgddddd	dgf�|dddgddddd	dgf�|dgddgf�|dddgdddgf�|dddgddddgf�|dddgdddgf�|d
gd||ddgf�|ddgd||ddgf�|ddgd||ddgf�|ddd	gd||dd	gf�|dddgd||d	gf�dS)N��aza/�bza/bza/b/zb/c�d�czb//czb/c/�.z/a/bz/az/a/z/bz/c)rrr)r�checkrrrr
�test_parse_parts_common"s(z(_BaseFlavourTest.test_parse_parts_commonN)�__name__�
__module__�__qualname__rrrrrr
rs
rc@s"eZdZejZdd�Zdd�ZdS)�PosixFlavourTestcCs�|j}|ddgdddddgf�|ddgdddddgf�|ddgdddddgf�|d	gddd	gf�|d
gddd
gf�|dgdddgf�dS)Nz//arrz//rz///arz////azc:azc:\az\a)r)rrrrr
�test_parse_partsBsz!PosixFlavourTest.test_parse_partscCs�|jj}|j|d�d�|j|d�d�|j|d�d�|j|d�d�|j|d�d�|j|d�d�|j|d�d�|j|d	�d�|j|d�d�|j|d�d�|j|d
�d�|j|d�d�|j|d�d�dS)Nrr�a/b�a/b/z/arz/a/bz/a/b/z//a�//z///az///a/b�c:/a/b�\/a/b�\a\b)rrr)rrr)rrr%)rrr&)rrr)rrr%)rrr&)rr'r)rrr)rrr%)rrr()rrr))rrr*)r�	splitrootr)rrrrr
�test_splitrootNszPosixFlavourTest.test_splitrootN)r r!r"�pathlibZ_posix_flavourrr$r,rrrr
r#?sr#c@s"eZdZejZdd�Zdd�ZdS)�
NTFlavourTestcCs|j}|dgdddgf�|dgdddgf�|dgdddgf�|dgddddgf�|d	gddddgf�|d
gddddgf�|dgddd
gf�|dgddd
gf�|dgddd
dgf�|dddgdddddgf�|dddgdddddgf�|dddgddddgf�|dddgddddddgf�|dddgddddgf�|dgdddgf�|d gddddgf�|d d!gddddgf�|d"gd#dd$gf�|d%gd#dd$dgf�|dd!dgdddddgf�|d&d!dgdddddgf�|d'd!dgd(dd)ddgf�dS)*Nzc:rzc:/�\zc:\rzc:arzc:/az/az//a/bz\\a\bz\\a\b\z//a/b/z//a/b/crzZ:bzZ:rzZ:/bzZ:\z//b/crz\\b\cz\\b\c\z	Z://b//c/zd/z//b/c//z//?/c:/z\\?\c:z\\?\c:\z//?/c:/az/bz//?/UNC/b/cz\\?\UNC\b\cz\\?\UNC\b\c\z
//?/UNC/b/c/dzZ:/az//?/Z:/az\\?\Z:z\\?\Z:\)r)rrrrr
r$fs.zNTFlavourTest.test_parse_partscCs|jj}|j|d�d�|j|d�d�|j|d�d�|j|d�d�|j|d�d�|j|d�d�|j|d	�d�|j|d
�d�|j|d�d�|j|d
�d�|j|d�d�|j|d�d�|j|d�d �|j|d�d!�|j|d�d"�|j|d
�d#�dS)$Nrr�a\bz\ar/z\a\bzc:a\b�c:zc:\a\bz\\az\\\a/b�a/bzc:\\azc:\\\a/b�\\a\bz\\a\b\z	\\a\b\c\d�c\dz\\\a\b)rrr)rrr)rrr0)rr/r)rr/r0)r1rr0)r1r/r0)rr/r)rr/r2)r1r/r)r1r/r2)r3r/r)r3r/r)r3r/r4)rr/r0)rr/r)rr+r)rrrrr
r,�s"zNTFlavourTest.test_splitrootN)r r!r"r-Z_windows_flavourrr$r,rrrr
r.cs"r.c@s.eZdZdRdSdTdUdVdWdXdYdZd[g
d\d]d^d_d`dagd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Z	dd �Z
d!d"�Zd#d$�Zd%d&�Z
d'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Zd=d>�Zd?d@�ZdAdB�ZdCdD�ZdEdF�ZdGdH�ZdIdJ�ZdKdL�Z dMdN�Z!dOdP�Z"dQS)b�_BasePurePathTestrr�a/�b/�a/b/�a//b�a//b//r�/b/cr�///b//c�d/�/ar�c/d�b/c/d�/b/c/d)za/bz/b/c/dcCs*|jd�}|j|_|jj|_|jj|_dS)Nr)�clsZ_flavourrrr)r�prrr
�setUp�s

z_BasePurePathTest.setUpcCs�|j}|d�}|j||�|ddd�|ddd�|d�|d�|td��|j||d��|d��|j||d�d�|d��|j||d�|d��|d��|j||d�|d�|d��|td���dS)Nrrrz/aza/b/cz/a/b/cza/b)rB�assertIsInstancerr)r�PrCrrr
�test_constructor_common�sz)_BasePurePathTest.test_constructor_commoncs`Gdd�dt��|j}|�fdd�|D��}|j|||��x|jD]}|jt|�t�qDWdS)Nc@seZdZdS)z:_BasePurePathTest._check_str_subclass.<locals>.StrSubclassN)r r!r"rrrr
�StrSubclass�srHc3s|]}�|�VqdS)Nr)r	r
)rHrr
�	<genexpr>�sz8_BasePurePathTest._check_str_subclass.<locals>.<genexpr>)�strrBr�parts�assertIs�type)r�argsrFrC�partr)rHr
�_check_str_subclass�sz%_BasePurePathTest._check_str_subclasscCs6|jd�|jd�|jd�|jd�|jd�dS)Nrrrza/b.txtz/a/b.txt)rP)rrrr
�test_str_subclass_common�s




z*_BasePurePathTest.test_str_subclass_commoncCs�|j}|d�}|jd�}|j||d��|jt|�t|��|jdd�}|j||d��|j|d��}|j||d��|jd�}|j||d��dS)Nza/brza/b/crza/b/c/dz/c)rB�joinpathrrLrM)rrFrC�pprrr
�test_join_common�s

z"_BasePurePathTest.test_join_commoncCs�|j}|d�}|d}|j||d��|jt|�t|��|d}|j||d��|dd}|j||d��d|d}|j||d��||d�}|j||d��|d}|j||d��dS)	Nza/brza/b/czc/dza/b/c/drzc/a/b/dz/c)rBrrLrM)rrFrCrSrrr
�test_div_common�sz!_BasePurePathTest.test_div_commoncCs(|j|�}|jt|�|jd|j��dS)Nr)rBrrJrr)rrrNrCrrr
�
_check_str�s
z_BasePurePathTest._check_strcCs,xd	D]}|j||f�qW|jdd
�dS)Nr�a/b�a/b/cr�/a/b�/a/b/crr)rrWrXrrYrZ)r)rV)r�pathstrrrr
�test_str_commons
z!_BasePurePathTest.test_str_commoncCs,|j}x dD]}|j||�j�|�qWdS)Nr�a/b�a/b/cr�/a/b�/a/b/c)rr]r^rr_r`)rBr�as_posix)rrFr[rrr
�test_as_posix_common
s
z&_BasePurePathTest.test_as_posix_commoncCs2tj|j�}|j}|jt|d��d|d�dS)Nza/b�a�b)�os�fsencoderrBr�bytes)rrrFrrr
�test_as_bytes_commonsz&_BasePurePathTest.test_as_bytes_commoncCsL|j}|jt��|d�j�WdQRX|jt��|�j�WdQRXdS)Nr)rB�assertRaises�
ValueError�as_uri)rrFrrr
�test_as_uri_commons
z$_BasePurePathTest.test_as_uri_commoncCs�x�d
D]�}|j|�}|jj}t|�}|j|j|d�|�|j|jd�|�|t|�d	d�}|jt	|�|j
��t	|tj�}|j
|j|j�|j||�|jt|�|�qWdS)Nr�a/b�a/b/cr�/a/b�/a/b/c�(�)�)rrmrnrrorp���)rB�	__class__r �repr�
assertTrue�
startswith�endswith�lenr�evalrar-�__dict__rL)rr[rCZclsname�r�inner�qrrr
�test_repr_commons

z"_BasePurePathTest.test_repr_commoncCs�|j}|j|d�|d��|j|d�|dd��|j|d�|d��|j|d�|d��|j|d�|��|j|d�|d��|j|�|d��|j|�d�|j|�i�|j|�t�dS)Nza/brrz/a/brr)rBr�assertNotEqual�int)rrFrrr
�test_eq_common,sz _BasePurePathTest.test_eq_commoncCs&|j}|jt|d�jd�|jt|d�jd�|j|d�jd��|j|d�jd��|j|d�jd��|j|d�jd��|j|d�jd��|j|d	�jd��|j|d
�jd��|j|d�jd��|j|d�jd��|j|d�jd��|j|d�jd��|j|d
�jd��|j|d
�jd��|j|d�jd��|j|d�jd��|j|d�jd��|j|d�jd��|j|d�jd��|j|d�jd��|j|d�jd��|j|d�jd��|j|d�jd��|j|d�jd��|j|d�jd��|j|d�jd��dS)Nrrrzb.pyza/b.pyz/a/b.pyza.pyzb/pyz/a.pyzb.py/cz*.pyzb.pyczb./pyzab/c.pyza*/*.pyz
/d/ab/c.pyz	/dab/c.pyz	ab/c.py/dz/b.pyz/*.pyz/a/*.pyz/ab.pyz	/a/b/c.py)rBrirj�matchrw�assertFalse)rrFrrr
�test_match_common9s8z#_BasePurePathTest.test_match_commonc	s��fdd�}�j}|d�}|d�}|d�}|d�}|||�|||�|||�|||�|||��j}|d�}|d�}|d	�}|d
�}|||�|||�|||�|||�|||��jt��|�ikWdQRXdS)Ncs�j||��j||�dS)N)�
assertLessZ
assertGreater)rr)rrr
r�^sz:_BasePurePathTest.test_ordering_common.<locals>.assertLessrza/b�abcrz/az/a/bz/abcz/b)rBri�	TypeError)rr�rFrrrrr)rr
�test_ordering_common\s.









z&_BasePurePathTest.test_ordering_commoncCsX|j}|j}|d�}|j}|j|d�|j||j�|d�}|j}|j||ddf�dS)Nza/brrz/a/b)rr)rrBrKrrL)rrrFrCrKrrr
�test_parts_commonxsz#_BasePurePathTest.test_parts_commoncCs4|j}|d�}|j|j�d�|jtj|�d�dS)N�a/b)r�)r�)rBrV�
__fspath__re�fspath)rrFrCrrr
�test_fspath_common�sz$_BasePurePathTest.test_fspath_commoncs�xƈjj�D]�\}}|jd�j�}|j�jd�}||krZ|�fdd�|D�}|j|f��j|�}x^|D]V}�j|�}�j||dj|���jt|�t|���jt	|�|��j|j
�|�qjWqWdS)Nrcs"g|]}t�fdd�|D���qS)c3s|]}|jd�j�VqdS)rN)rr)r	rO)rrr
rI�szA_BasePurePathTest.test_equivalences.<locals>.<listcomp>.<genexpr>)�tuple)r	�t)rrr
r�sz7_BasePurePathTest.test_equivalences.<locals>.<listcomp>zfailed with args {})�equivalences�itemsrr�appendrBr�format�hashrJra)r�kZtuplesZcanon�posixZpcanonr�rCr)rr
�test_equivalences�s




z#_BasePurePathTest.test_equivalencescCs�|j}|d�}|j|j|d��|j|jj|d��|j|jjj|��|j|jjjj|��|d�}|j|j|d��|j|jj|d��|j|jjj|d��|j|jjjj|d��dS)Nza/b/cza/brz/a/b/cz/a/bz/ar)rBr�parent)rrFrCrrr
�test_parent_common�sz$_BasePurePathTest.test_parent_commoncCsz|j}|d�}|j}|jt|�d�|j|d|d��|j|d|d��|j|d|d��|jt|�|d�|d�|d�g�|jt��|d
WdQRX|jt��|dWdQRX|jt��||d<WdQRX|d	�}|j}|jt|�d�|j|d|d
��|j|d|d��|j|d|d��|jt|�|d
�|d�|d�g�|jt��|dWdQRXdS)Nza/b/c�rza/brsr�rz/a/b/cz/a/bz/arrt)rB�parentsrrz�listri�
IndexErrorr�)rrFrC�parrrr
�test_parents_common�s.""z%_BasePurePathTest.test_parents_commoncCs@|j}|j|d�jd�|j|d�jd�|j|d�jd�dS)Nza/brz/a/b)rBr�drive)rrFrrr
�test_drive_common�sz#_BasePurePathTest.test_drive_commoncCsX|j}|j}|j|d�jd�|j|d�jd�|j|d�j|�|j|d�j|�dS)Nrza/brz/a/b)rBrr�root)rrFrrrr
�test_root_common�sz"_BasePurePathTest.test_root_commoncCsX|j}|j}|j|d�jd�|j|d�jd�|j|d�j|�|j|d�j|�dS)Nrza/brz/a/b)rBrr�anchor)rrFrrrr
�test_anchor_common�sz$_BasePurePathTest.test_anchor_commoncCs�|j}|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd	�|j|d
�jd	�dS)Nrrrza/brz/a/bz/a/b/.za/b.pyzb.pyz/a/b.py)rBr�name)rrFrrr
�test_name_common�sz"_BasePurePathTest.test_name_commoncCs<|j}|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd	�|j|d
�jd	�|j|d�jd�|j|d�jd�|j|d
�jd�|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�dS)Nrrz..rza/bz/a/bz/a/b/.za/b.pyz.pyz/a/b.pyza/.hgrcz/a/.hgrcza/.hg.rcz.rcz	/a/.hg.rcz
a/b.tar.gzz.gzz/a/b.tar.gzza/Some name. Ending with a dot.z /a/Some name. Ending with a dot.)rBr�suffix)rrFrrr
�test_suffix_common�s$z$_BasePurePathTest.test_suffix_commoncCs:|j}|j|d�jg�|j|d�jg�|j|d�jg�|j|d�jg�|j|d�jg�|j|d�jg�|j|d�jdg�|j|d	�jdg�|j|d
�jg�|j|d�jg�|j|d�jd
g�|j|d�jd
g�|j|d�jddg�|j|d�jddg�|j|d�jg�|j|d�jg�dS)Nrrrza/bz/a/bz/a/b/.za/b.pyz.pyz/a/b.pyza/.hgrcz/a/.hgrcza/.hg.rcz.rcz	/a/.hg.rcz
a/b.tar.gzz.tarz.gzz/a/b.tar.gzza/Some name. Ending with a dot.z /a/Some name. Ending with a dot.)rBr�suffixes)rrFrrr
�test_suffixes_common�s"z&_BasePurePathTest.test_suffixes_commoncCs�|j}|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd	�|j|d
�jd�|j|d�jd
�|j|d�jd�dS)Nrrz..rza/brza/b.pyza/.hgrcz.hgrcza/.hg.rcz.hgz
a/b.tar.gzzb.tarza/Some name. Ending with a dot.zSome name. Ending with a dot.)rBr�stem)rrFrrr
�test_stem_commonsz"_BasePurePathTest.test_stem_commoncCs2|j}|j|d�jd�|d��|j|d�jd�|d��|j|d�jd�|d��|j|d�jd�|d��|j|d�jd�|d��|j|d	�jd�|d��|jt|d
�jd�|jt|d�jd�|jt|d�jd�|jt|d�jd
�|jt|d�jd
�|jt|d�jd�|jt|d�jd�dS)Nza/bzd.xmlza/d.xmlz/a/bz/a/d.xmlza/b.pyz/a/b.pyz
a/Dot ending.z/a/Dot ending.rrrz/czc/zc/d)rBr�	with_namerirj)rrFrrr
�test_with_name_commonsz'_BasePurePathTest.test_with_name_commoncCs�|j}|j|d�jd�|d��|j|d�jd�|d��|j|d�jd�|d��|j|d�jd�|d��|j|d�jd�|d��|j|d�jd�|d��|jt|d�jd�|jt|d	�jd�|jt|d
�jd�|jt|d�jd�|jt|d�jd
�|jt|d�jd	�|jt|d�jd�|jt|d�jd
�|jt|d�jd�|jt|d�jd�|jt|d�jd�dS)Nza/bz.gzza/b.gzz/a/bz/a/b.gzza/b.pyz/a/b.pyrrr�gzz/.gzzc/dz.c/.dz./.dz.d/.)rBr�with_suffixrirj)rrFrrr
�test_with_suffix_common.s$z)_BasePurePathTest.test_with_suffix_commoncCsR|j}|d�}|jt|j�|jt|jd�|j|j|��|d��|j|jd�|d��|j|j|d��|d��|j|jd�|d��|j|jd�|d��|j|j|d��|��|j|jd�|��|j|jdd�|��|jt|j|d��|jt|j|d��|jt|j|d	��|jt|j|d
��|d�}|j|j|d��|d��|j|jd�|d��|j|j|d
��|d��|j|jd
�|d��|j|jd
�|d��|j|j|d��|��|j|jd�|��|jt|j|d��|jt|j|d��|jt|j|d��|jt|j|��|jt|jd�|jt|j|d��dS)Nza/brcrrrza/rza/b/cza/cz/az/a/brz/a/z/cz/a/b/cz/a/c)rBrir��relative_torrj)rrFrCrrr
�test_relative_to_commonEs<z)_BasePurePathTest.test_relative_to_commoncCs�|j}|d�}xrtdtjd�D]^}tj||�}tj|�}|j|j|j�|j||�|jt	|�t	|��|jt
|�t
|��q WdS)Nz/a/brrs)rB�range�pickle�HIGHEST_PROTOCOL�dumps�loadsrLrurr�rJ)rrFrC�proto�dumpedrSrrr
�test_pickling_commonhs
z&_BasePurePathTest.test_pickling_commonN)rr)r6r)rr7)r6r7)r8)r9)r:)rrr)rrr)rrr)rr;r)rr<r=)r>r;r)rrrr?)rrr@)rrA)#r r!r"r�rDrGrPrQrTrUrVr\rbrhrlr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr
r5�sJ

##r5c@sZeZdZejZdd�Zdd�Zdd�Zdd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
dd�ZdS)�PurePosixPathTestcCs@|j}|j|d�jd�|j|d�jd�|j|d�jd�dS)Nz/a/brz///a/bz//a/bz//)rBrr�)rrFrrr
�	test_rootwszPurePosixPathTest.test_rootcCsF|j}|j|d�|d��|j|d�|d��|j|d�|d��dS)Nza/bzA/bz/az///az//a)rBr�r)rrFrrr
�test_eq~szPurePosixPathTest.test_eqcCsF|j}|j|d�j�d�|j|d�j�d�|j|d�j�d�dS)Nrzfile:///z/a/b.cz
file:///a/b.cz/a/b%#czfile:///a/b%25%23c)rBrrk)rrFrrr
�test_as_uri�szPurePosixPathTest.test_as_uricCsfddlm}|j}ytjd�Wntk
r>|jd�YnX|j|d�j�d|tjd���dS)Nr)�quote_from_bytes�éz1\xe9 cannot be encoded to the filesystem encodingu/a/bézfile:///a/b)	Zurllib.parser�rBrerf�UnicodeEncodeError�skipTestrrk)rr�rFrrr
�test_as_uri_non_ascii�sz'PurePosixPathTest.test_as_uri_non_asciicCs|j}|j|d�jd��dS)NzA.pyza.PY)rBr�r�)rrFrrr
�
test_match�szPurePosixPathTest.test_matchcCs�|j}|j|�j��|j|d�j��|j|d�j��|j|d�j��|j|d�j��|j|d�j��|j|d�j��|j|d�j��dS)Nrza/b/rz/az/a/b/z//az//a/b)rBr��is_absoluterw)rrFrrr
�test_is_absolute�sz"PurePosixPathTest.test_is_absolutecCsZ|j}|jd|d�j��|jd|d�j��|jd|d�j��|jd|d�j��dS)NFrrz/foo/barz/dev/con/PRN/NUL)rBrL�is_reserved)rrFrrr
�test_is_reserved�s
z"PurePosixPathTest.test_is_reservedcCsh|j}|d�}|jd�}|j||d��|d�jd�}|j||d��|d�jd�}|j||d��dS)Nz//arz//a/bz/az//cz/c)rBrRr)rrFrCrSrrr
�	test_join�s
zPurePosixPathTest.test_joincCsb|j}|d�}|d}|j||d��|d�d}|j||d��|d�d}|j||d��dS)Nz//arz//a/bz/az//cz/c)rBr)rrFrCrSrrr
�test_div�szPurePosixPathTest.test_divN)r r!r"r-�
PurePosixPathrBr�r�r�r�r�r�r�r�r�rrrr
r�ts

r�c	@s�eZdZejZejj�Zej	d<d=d>gd?d@dAdBdCgdDgdEdFgd��d
d�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Z d;S)G�PureWindowsPathTest�c:r�a/r�c:/�/a�/z�//x/y�//a/br�//a/b/)zc:azc:/az//a/b/z//a/b/ccCs�|jd�}|jt|�d�|jd�}|jt|�d�|jd�}|jt|�d�|jd�}|jt|�d�|jd	�}|jt|�d
�dS)Nza/b/cza\b\czc:/a/b/czc:\a\b\cz//a/bz\\a\b\z//a/b/cz\\a\b\cz	//a/b/c/dz	\\a\b\c\d)rBrrJ)rrCrrr
�test_str�s




zPureWindowsPathTest.test_strcCs^|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd	�dS)
Nzc:zc:az	c:a\b.txtzc:\zc:\az
c:\a\b.txtz\\some\sharez\\some\share\az\\some\share\a\b.txt)rP)rrrr
�test_str_subclass�s







z%PureWindowsPathTest.test_str_subclasscCs�|j}|j|d�|d��|j|d�|ddd��|j|d�|d��|j|d�|d��|j|d�|d��|j|d�|d	��|j|d
�|d��|j|d�|d
��dS)Nzc:a/bzc:rrzd:a/bzc:/a/bz/a/bza/BzA/bzC:a/Bzc:A/bz//Some/SHARE/a/Bz//somE/share/A/b)rBrr�)rrFrrr
r��szPureWindowsPathTest.test_eqcCs�|j}|jt��|d�j�WdQRX|jt��|d�j�WdQRX|j|d�j�d�|j|d�j�d�|j|d�j�d�|j|d	�j�d
�|j|d�j�d�|j|d
�j�d�|j|d�j�d�dS)Nz/a/bzc:a/bzc:/zfile:///c:/zc:/a/b.czfile:///c:/a/b.cz	c:/a/b%#czfile:///c:/a/b%25%23cuc:/a/bézfile:///c:/a/b%C3%A9z
//some/share/zfile://some/share/z//some/share/a/b.czfile://some/share/a/b.cu//some/share/a/b%#céz"file://some/share/a/b%25%23c%C3%A9)rBrirjrkr)rrFrrr
r��szPureWindowsPathTest.test_as_uricCsr|j}|j|d�jd��|j|d�jd��|j|d�jd��|j|d�jd��|j|d�jd��|j|d�jd��|j|d�jd��|j|d�jd��|j|d�jd��|j|d�jd��|j|d�jd��|j|d	�jd��|j|d	�jd
��|j|d�jd
��|j|d�jd
��|j|d
�jd��|j|d�jd��|j|d�jd��dS)Nzc:/b.pyz/*.pyzc:*.pyzc:/*.pyzd:/b.pyzb.pyzc:b.pyz/b.pyz//some/share/a.pyz//some/share/*.pyz//other/share/a.pyz//some/share/a/b.pyzB.pyzb.PYz	c:/a/B.Pyz	C:/A/*.pYz//Some/Share/B.Pyz//somE/sharE/*.pY)rBrwr�r�)rrFrrr
r�s&z%PureWindowsPathTest.test_match_commoncs��fdd�}�j}|d�}|d�}|||��j||k��j||k�|d�}|d�}|||��j||k��j||k�dS)Ncs�j||��j||�dS)N)ZassertLessEqual�assertGreaterEqual)rr)rrr
�assertOrderedEqualszDPureWindowsPathTest.test_ordering_common.<locals>.assertOrderedEqualzc:A/bzC:a/Bz//some/Share/A/bz//Some/SHARE/a/B)rBr�)rr�rFrCrr)rr
r�s

z(PureWindowsPathTest.test_ordering_commoncCsX|j}|d�}|j}|j|d�|d�}|j}|j|d�|d�}|j}|j|d
�dS)Nzc:a/b�c:rrzc:/a/b�c:\z	//a/b/c/d�\\a\b\rr)r�rr)r�rr)r�rr)rBrKr)rrFrCrKrrr
�
test_parts,szPureWindowsPathTest.test_partscCs|j}|d�}|j|j|d��|j|jj|d��|j|jjj|d��|j|jjjj|d��|d�}|j|j|d��|j|jj|d��|j|jjj|d��|j|jjjj|d��|d	�}|j|j|d
��|j|jj|d��|j|jjj|d��dS)Nzz:a/b/czz:a/bzz:azz:zz:/a/b/czz:/a/bzz:/azz:/z	//a/b/c/dz//a/b/cz//a/b)rBrr�)rrFrCrrr
�test_parent8szPureWindowsPathTest.test_parentcCs�|j}|d�}|j}|jt|�d�|j|d|d��|j|d|d��|jt|�|d�|d�g�|jt��|dWdQRX|d�}|j}|jt|�d�|j|d|d��|j|d|d	��|jt|�|d�|d	�g�|jt��|dWdQRX|d
�}|j}|jt|�d�|j|d|d��|j|d|d��|jt|�|d�|d�g�|jt��|dWdQRXdS)
Nzz:a/b/r�rzz:arszz:zz:/a/b/zz:/azz:/z	//a/b/c/dz//a/b/cz//a/b)rBr�rrzr�rir�)rrFrCr�rrr
�test_parentsJs2z PureWindowsPathTest.test_parentscCs�|j}|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�dS)	Nzc:zc:a/bzc:/zc:/a/b/z//a/bz\\a\bz//a/b/z	//a/b/c/d)rBrr�)rrFrrr
�
test_drivefszPureWindowsPathTest.test_drivecCs�|j}|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�|j|d	�jd�dS)
Nzc:rzc:a/bzc:/r/zc:/a/b/z//a/bz//a/b/z	//a/b/c/d)rBrr�)rrFrrr
r�pszPureWindowsPathTest.test_rootcCs�|j}|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�|j|d	�jd�dS)
Nzc:zc:a/bzc:/zc:\zc:/a/b/z//a/bz\\a\b\z//a/b/z	//a/b/c/d)rBrr�)rrFrrr
�test_anchorzszPureWindowsPathTest.test_anchorcCs�|j}|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�|j|d	�jd�|j|d
�jd�|j|d�jd�dS)Nzc:rzc:/zc:a/brzc:/a/bzc:a/b.pyzb.pyz	c:/a/b.pyz//My.py/Share.phpz//My.py/Share.php/a/b)rBrr�)rrFrrr
�	test_name�szPureWindowsPathTest.test_namecCs*|j}|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�|j|d	�jd�|j|d
�jd�|j|d�jd�|j|d
�jd�|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�dS)Nzc:rzc:/zc:a/bzc:/a/bzc:a/b.pyz.pyz	c:/a/b.pyz	c:a/.hgrcz
c:/a/.hgrcz
c:a/.hg.rcz.rczc:/a/.hg.rczc:a/b.tar.gzz.gzz
c:/a/b.tar.gzz!c:a/Some name. Ending with a dot.z"c:/a/Some name. Ending with a dot.z//My.py/Share.phpz//My.py/Share.php/a/b)rBrr�)rrFrrr
�test_suffix�s"zPureWindowsPathTest.test_suffixcCs:|j}|j|d�jg�|j|d�jg�|j|d�jg�|j|d�jg�|j|d�jdg�|j|d�jdg�|j|d�jg�|j|d	�jg�|j|d
�jdg�|j|d�jdg�|j|d
�jddg�|j|d�jddg�|j|d�jg�|j|d�jg�|j|d�jg�|j|d�jg�dS)Nzc:zc:/zc:a/bzc:/a/bzc:a/b.pyz.pyz	c:/a/b.pyz	c:a/.hgrcz
c:/a/.hgrcz
c:a/.hg.rcz.rczc:/a/.hg.rczc:a/b.tar.gzz.tarz.gzz
c:/a/b.tar.gzz//My.py/Share.phpz//My.py/Share.php/a/bz!c:a/Some name. Ending with a dot.z"c:/a/Some name. Ending with a dot.)rBrr�)rrFrrr
�
test_suffixes�s"z!PureWindowsPathTest.test_suffixescCs�|j}|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�|j|d�jd�|j|d	�jd�|j|d
�jd�|j|d�jd
�|j|d�jd�|j|d�jd�dS)Nzc:rzc:.zc:..z..zc:/zc:a/brzc:a/b.pyz	c:a/.hgrcz.hgrcz
c:a/.hg.rcz.hgzc:a/b.tar.gzzb.tarz!c:a/Some name. Ending with a dot.zSome name. Ending with a dot.)rBrr�)rrFrrr
�	test_stem�szPureWindowsPathTest.test_stemcCs�|j}|j|d�jd�|d��|j|d�jd�|d��|j|d�jd�|d��|j|d�jd�|d��|jt|d�jd�|jt|d	�jd�|jt|d
�jd�|jt|d�jd�|jt|d�jd�|jt|d�jd
�|jt|d�jd
�dS)Nzc:a/bzd.xmlz	c:a/d.xmlzc:/a/bz
c:/a/d.xmlzc:a/Dot ending.zc:/a/Dot ending.zc:zc:/z
//My/Sharezd:zd:ezd:/e)rBrr�rirj)rrFrrr
�test_with_name�sz"PureWindowsPathTest.test_with_namecCs�|j}|j|d�jd�|d��|j|d�jd�|d��|j|d�jd�|d��|j|d�jd�|d��|jt|d�jd�|jt|d	�jd�|jt|d
�jd�|jt|d�jd�|jt|d�jd�|jt|d�jd
�|jt|d�jd
�|jt|d�jd�|jt|d�jd�|jt|d�jd�|jt|d�jd�|jt|d�jd�|jt|d�jd�|jt|d�jd�|jt|d�jd�dS)Nzc:a/bz.gzzc:a/b.gzzc:/a/bz	c:/a/b.gzzc:a/b.pyz	c:/a/b.pyrrrz
//My/Sharer�r/zc:z/.gzz\.gzzc:.gzzc/dzc\dz.c/dz.c\d)rBrr�rirj)rrFrrr
�test_with_suffix�s(z$PureWindowsPathTest.test_with_suffixcCs0|j}|d�}|j|j|d��|d��|j|jd�|d��|j|j|d��|d��|j|jd�|d��|j|jd�|d��|j|j|d��|��|j|jd�|��|jt|j|��|jt|jd�|jt|j|d	��|jt|j|d
��|jt|j|d��|jt|j|d��|jt|j|d
��|jt|j|d��|jt|j|d��|d�}|j|j|d��|d��|j|jd�|d��|jt|j|d���d�|jt|jd��d�|j|j|d��|d��|j|jd�|d��|j|j|d��|d��|j|jd�|d��|j|jd�|d��|j|j|d��|��|j|jd�|��|jt|j|d��|jt|j|d��|jt|j|d��|jt|j|d��|jt|j|d	��|jt|j|d��|jt|j|d
��|jt|j|d��|jt|j|d��|d�}|j|j|d��|d��|j|jd�|d��|j|jd�|d��|j|j|d ��|d��|j|jd �|d��|j|jd!�|d��|j|j|d"��|��|j|jd"�|��|jt|j|d#��|jt|j|d$��|jt|j|d%��|jt|j|d&��dS)'Nz	C:Foo/Barzc:zFoo/Barzc:foOZBarzc:foO/z	c:foO/baRrzd:rZFooz/FoozC:/Fooz
C:Foo/Bar/Bazz	C:Foo/Bazz
C:/Foo/Barz/Foo/Barz\Foo\Barzc:/zc:/foOzc:/foO/z
c:/foO/baRzC:/BazzC:/Foo/Bar/Bazz
C:/Foo/BazzC:Foozd:/z//C/Fooz//Server/Share/Foo/Barz//sErver/sHarez//sErver/sHare/z//sErver/sHare/Fooz//sErver/sHare/Foo/z//sErver/sHare/Foo/Barz/Server/Share/Foozc:/Server/Share/Fooz
//z/Share/Fooz//Server/z/Foo)rBrr�rirjrJ)rrFrCrrr
�test_relative_to�shz$PureWindowsPathTest.test_relative_tocCs(|j}|j|�j��|j|d�j��|j|d�j��|j|d�j��|j|d�j��|j|d�j��|j|d�j��|j|d�j��|j|d�j��|j|d	�j��|j|d
�j��|j|d�j��|j|d�j��|j|d
�j��|j|d�j��|j|d�j��dS)Nrza/b/rz/az/a/b/zc:zc:azc:a/b/zc:/zc:/azc:/a/b/z//a/bz//a/b/z//a/b/cz	//a/b/c/d)rBr�r�rw)rrFrrr
r�#s"z$PureWindowsPathTest.test_is_absolutecCs�|j}|d�}|jd�}|j||d��|jd�}|j||d��|jd�}|j||d��|jd�}|j||d��|jd�}|j||d��|jd	�}|j||d��|jd
�}|j||d��dS)NzC:/a/bzx/yz
C:/a/b/x/yz/x/yzC:/x/yzD:x/yzD:/x/yz//host/share/x/yzc:x/yzc:/x/y)rBrRr)rrFrCrSrrr
r�8s 






zPureWindowsPathTest.test_joincCs�|j}|d�}|j|d|d��|j|dd|d��|j|d|d��|j|dd|d��|j|d	|d	��|j|d
d|d	��|j|d|d��|j|d
d|d��|j|d|d��|j|d
|d��|j|d|d��dS)NzC:/a/bzx/yz
C:/a/b/x/yr
�yz/x/yzC:/x/yz/xzD:x/yzD:zD:/x/yz//host/share/x/yzc:x/yzc:/x/y)rBr)rrFrCrrr
r�NszPureWindowsPathTest.test_divcCs"|j}|jd|d�j��|jd|d�j��|jd|d�j��|jd|d�j��|jd|d�j��|jd|d�j��|jd|d	�j��|jd|d
�j��|jd|d�j��|jd|d�j��|jd|d
�j��|jd|d�j��|jd|d�j��|jd|d�j��dS)NFrrz/foo/barTZconZNULzNUL.txtZcom1zcom9.barzbar.com9Zlpt1zlpt9.barzbar.lpt9zc:/NUL/con/bazz//my/share/nul/con/aux)rBrLr�)rrFrrr
r�bsz$PureWindowsPathTest.test_is_reservedN)r�r)r�r�)rr�r)r�r)r�rr)r�r�)r�r�r)r�r�r)r�)r�r)r�r)!r r!r"r-�PureWindowsPathrBr5r��copy�updater�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr
r��s>



:r�c@s*eZdZejZdd�Zdd�Zdd�ZdS)�PurePathTestcCs0|jd�}|jt|�tjdkr$tjntj�dS)Nr�nt)rBrLrMrer�r-r�r�)rrCrrr
�test_concrete_classxs

z PurePathTest.test_concrete_classcCs$tjd�}tjd�}|j||�dS)Nr)r-r�r�r�)rrCrrrr
�test_different_flavours_unequal}s

z,PurePathTest.test_different_flavours_unequalcCs�tjd�}tjd�}|jt��||kWdQRX|jt��||kWdQRX|jt��||kWdQRX|jt��||kWdQRXdS)Nr)r-r�r�rir�)rrCrrrr
�!test_different_flavours_unordered�s

z.PurePathTest.test_different_flavours_unorderedN)	r r!r"r-ZPurePathrBr�r�r�rrrr
r�usr�cGstjjtf|��S)N)re�path�join�BASE)r
rrr
�<lambda>�sr�cGstjjtf|��S)N)rer�r�r)r
rrr
r��scCsNtjs
dSytjtt�Wn$tk
r>}zt|�Sd}~XnXtj	t�dS)Nzno system support for symlinks)
r-Zsupports_symlinksre�symlink�__file__r��OSErrorrJr�unlink)�errr
�symlink_skip_reason�s
r�r�z)test requires a Windows-compatible systemz'test requires a POSIX-compatible systemc@seZdZejZdS)�PosixPathAsPureTestN)r r!r"r-�	PosixPathrBrrrr
r�src@s"eZdZejZdd�Zdd�ZdS)�WindowsPathAsPureTestc	Cs,|j}|jt��|d�j�WdQRXdS)Nzc:/)rBri�NotImplementedError�owner)rrFrrr
�
test_owner�sz WindowsPathAsPureTest.test_ownerc	Cs,|j}|jt��|d�j�WdQRXdS)Nzc:/)rBrir�group)rrFrrr
�
test_group�sz WindowsPathAsPureTest.test_groupN)r r!r"r-�WindowsPathrBrrrrrr
r�src@s�eZdZdd�Zejdkr$dd�Zndd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zed#d$��Zd%d&�Zd'd(�Zd)d*�Zed+d,��Zd-d.�Zd�d0d1�ZeZZed2d3��Zed4d5��Z d6d7�Z!d8d9�Z"d:d;�Z#ed<d=��Z$d>d?�Z%e&j'e(d@�dAdB��Z)e&j'e*dC�dDdE��Z+dFdG�Z,dHdI�Z-dJdK�Z.dLdM�Z/dNdO�Z0dPdQ�Z1dRdS�Z2dTdU�Z3dVdW�Z4dXdY�Z5dZd[�Z6e7d\d]��Z8d^d_�Z9d`da�Z:dbdc�Z;eddde��Z<dfdg�Z=dhdi�Z>djdk�Z?dldm�Z@e&j'eAedn�do�dpdq��ZBdrds�ZCe&j'eAeDdt�du�dvdw��ZEdxdy�ZFdzd{�ZGd|d}�ZHd~d�ZId�d��ZJd�d��ZKed�d���ZLed�d���ZMed�d���ZNd�S)��
_BasePathTestc!Cs~dd�}|j|�tjt�tjtd��tjtd��tjtd��tjtdd��tjtd��ttd�d	��}|jd
�WdQRXttdd�d	��}|jd�WdQRXttdd
�d	��}|jd�WdQRXttddd�d	��}|jd�WdQRXtjtd�d�t�sztj	dtd��tj	dtd��|j
dtd��|j
tjjdd�tdd��|j
tjjdd�tdd��dS)NcSstjtd�d�tjt�dS)N�dirEi�)re�chmodr�r�rmtreer�rrrr
�cleanup�sz$_BasePathTest.setUp.<locals>.cleanup�dirA�dirB�dirCZdirDr
�fileA�wbsthis is file A
�fileBsthis is file B
ZfileCsthis is file C
ZfileDsthis is file D
r�linkAznon-existing�
brokenLink�linkBz..�linkC�linkD)�
addCleanupre�mkdirr�r��open�writerr�r��dirlinkr�)rr
rrrr
rD�s.

z_BasePathTest.setUpr�cCstj||dd�dS)NT)�target_is_directory)rer�)r�src�destrrr
r�sz_BasePathTest.dirlinkcCstj||�dS)N)rer�)rrr rrr
r�scCs*|jtjjt|�t|��d||f�dS)Nz&%r and %r don't point to the same file)rwrer��samefilerJ)rZpath_aZpath_brrr
�
assertSame�sz_BasePathTest.assertSamec
Os6|jt��}|||�WdQRX|j|jjtj�dS)N)ri�FileNotFoundErrorr�	exception�errno�ENOENT)r�funcrN�kwargs�cmrrr
�assertFileNotFound�sz _BasePathTest.assertFileNotFoundcCsT|jtj��}|j||�|jt|�t|��|jt|�t|��|j|j��dS)N)	rBre�getcwdrrJrLrMrwr�)rrCrrrr
�	_test_cwds
z_BasePathTest._test_cwdcCs|jj�}|j|�dS)N)rB�cwdr,)rrCrrr
�test_cwd
s
z_BasePathTest.test_cwdcCsX|jtjjd��}|j||�|jt|�t|��|jt|�t|��|j|j	��dS)N�~)
rBrer��
expanduserrrJrLrMrwr�)rrCrrrr
�
_test_homes
z_BasePathTest._test_homecCs|jj�}|j|�dS)N)rB�homer1)rrCrrr
�	test_homes
z_BasePathTest.test_homecCs�tjjtd�}tjjtdd�}|j|�}|j|�}|j|�}|j|j|��|j|j|��|j|j|��|j|j|��tjjtd�}|j|�}|jt	|j|�|jt	|j|�|jt	|j|�|jt	|j|�|jt	|j|�|jt	|j|�dS)Nrrr�foo)
rer�r�r�rBrwr!r�rir#)rZ
fileA_pathZ
fileB_pathrCrSrZnon_existentr}rrr
�
test_samefiles"



z_BasePathTest.test_samefilecCs$|jd�}|j|j�tjd��dS)Nrr)rBr�statre)rrCrrr
�test_empty_path-s
z_BasePathTest.test_empty_pathcCs�|j}|d�}|j|j�|tjjd���|d�}|j|j�|�|d�}|j|j�|�|d�}|j|j�|�||d�j�j�d}|j|j�|�dS)Nr/r4z/~z../~r)rBrr0rer��absoluter�)rrFrCrrr
�test_expanduser_common2sz$_BasePathTest.test_expanduser_commoncCs�|j}|t�}|jd|j��|jd|dj��|jd|dj��|jd|ddj��ts�|jd|dj��|jd|dj��|jd|ddj��|jd|ddj��|jd|d	j��|jd|d
�j��dS)NTrrF�bahrrrr4z/xyzzy)rBr�rL�existsr�)rrFrCrrr
�test_exists?sz_BasePathTest.test_existscCs�|jt�}|djd��$}|j|tj�|j|j�d�WdQRX|djd��(}|j|tj�|j|j�j	�d�WdQRX|djddd��(}|j|tj
�|j|j�j	�d�WdQRXdS)Nrr}zthis is file A
�rbsthis is file Ar)�	buffering)rBr�rrE�io�
TextIOBaser�read�BufferedIOBase�strip�	RawIOBase)rrCrrrr
�test_open_commonNs
z_BasePathTest.test_open_commoncCsX|jt�}|djd�|j|dj�d�|jt|djd�|j|dj�d�dS)NrsabcdefgZsomestr)rBr�Zwrite_bytesrZ
read_bytesrir�)rrCrrr
�test_read_write_bytesZs

z#_BasePathTest.test_read_write_bytescCsf|jt�}|djddd�|j|djddd�d�|jt|djd	�|j|djdd�d�dS)
Nruäbcdefgzlatin-1)�encodingzutf-8�ignore)rG�errorsZbcdefgs	somebytes)rBr�Z
write_textrZ	read_textrir�)rrCrrr
�test_read_write_textbs
z"_BasePathTest.test_read_write_textcs\|j��t�}|j�}t|�}dddddg}ts>|dddg7}|j|�fd	d
�|D��dS)Nrrrr
rrrrcsh|]}�t|��qSr)r�)r	r)rFrr
�	<setcomp>ssz-_BasePathTest.test_iterdir.<locals>.<setcomp>)rBr��iterdir�setr�r)rrC�it�pathsrr)rFr
�test_iterdirksz_BasePathTest.test_iterdircs>|j��td�}t|j��}�fdd�dD�}|j||�dS)Nrcsh|]}�td|��qS)r)r�)r	r)rFrr
rK{sz5_BasePathTest.test_iterdir_symlink.<locals>.<setcomp>rr)rr)rBr�rMrLr)rrCrOrr)rFr
�test_iterdir_symlinkus

z"_BasePathTest.test_iterdir_symlinkcCsN|jtd�}|jt��}t|j��WdQRX|j|jjtj	tj
tjf�dS)Nr)rBr�rir��nextrL�assertInr$r%�ENOTDIRr&ZEINVAL)rrCr)rrr
�test_iterdir_nodir~s
z _BasePathTest.test_iterdir_nodircs���fdd�}�j��t�}|jd�}�j|tj�||dg�||jd�g�||jd�ddg�tr~||jd�d	dg�n||jd�d	dd
g�tr�||jd�dg�n||jd�ddd
dg�tr�||jd�dg�n||jd�dd
g�dS)Ncs"�jt|��fdd�|D��dS)Ncsh|]}�t|��qSr)r�)r	r)rFrr
rK�szA_BasePathTest.test_glob_common.<locals>._check.<locals>.<setcomp>)rrM)�globr)rFrrr
�_check�sz._BasePathTest.test_glob_common.<locals>._checkrrz
dir*/file*z
dirB/fileBz
dirC/fileCz*Arrz*B/*z
dirB/linkDzlinkB/fileBzlinkB/linkDz*/fileB)rBr�rVrE�collections�Iteratorr�)rrWrCrNr)rFrr
�test_glob_common�s$

z_BasePathTest.test_glob_commoncs���fdd�}�j��t�}|jd�}�j|tj�||dg�||jd�dg�||jd�g�trz||jd�dg�n||jd�ddd	d
g�||jd�dddd
g��td�}||jd�dd
g�||jd�d
g�dS)Ncs"�jt|��fdd�|D��dS)Ncsh|]}�t|��qSr)r�)r	r)rFrr
rK�szB_BasePathTest.test_rglob_common.<locals>._check.<locals>.<setcomp>)rrM)rVr)rFrrr
rW�sz/_BasePathTest.test_rglob_common.<locals>._checkrrz
dirB/fileBz*/fileAz*/fileBzdirB/linkD/fileBzlinkB/fileBzdirA/linkC/fileBzfile*z
dirC/fileCzdirC/dirD/fileDrz*/*)rBr��rglobrErXrYr�)rrWrCrNr)rFrr
�test_rglob_common�s"



z_BasePathTest.test_rglob_commoncsZ|j}|t��t�jd��}dddddddd	d
ddd
ddh}|j|�fdd�|D��dS)N�*rrz
dirA/linkCrz
dirB/fileBz
dirB/linkDrz	dirC/dirDzdirC/dirD/fileDz
dirC/fileCr
rrrcsh|]}�|�qSrr)r	r
)rCrr
rK�sz8_BasePathTest.test_rglob_symlink_loop.<locals>.<setcomp>)rBr�rMr[r)rrF�given�expectr)rCr
�test_rglob_symlink_loop�sz%_BasePathTest.test_rglob_symlink_loopcCsf|j}|t�}|jt|jd��|td�h�|jt|jd��|td�h�|jt|jd��t��dS)Nz..z
dirA/../file*z
dirA/../fileAz../xyzzy)rBr�rrMrV)rrFrCrrr
�test_glob_dotdot�s
z_BasePathTest.test_glob_dotdotTcCs|j|�}|j||�dS)N)�resolver)rrCr�strictrrrr
�_check_resolve�s
z_BasePathTest._check_resolvecCs�|j}|td�}|jt��}|jdd�WdQRX|j|jjtj�|jt	|jdd��t
jjtd��|tddd�}|jt	|jdd��t
jjtddd��|tdddd�}|jt	|jdd��t
jj
t
jjddd���|tdd	�}|j||�|td
�}|j||td��|tdd
d	�}|j||tdd	��|tddd	�}|j||tdd	��|tdd
d	ddd�}|j||tdd	ddd�d�|tdd
dddd�}t
jdk�r�|j||tdddd�d�n|j||tddd�d�tjtjdd��}|jtj|�t
jt
jj|�tdd��t
jtd�t
jj|d��|tdddd	�}|j||tdd	��|tdddddd�}|j||tdddd�d�|tddddddd�}t
jdk�r�|j|||ddd�d�n|j||tddd�d�dS)Nr4T)rcF�inZspamz..rrrrrrrr�z-dirD)r��linkX�linkY)rBr�rir�rbrr$r%r&rJrer�r��abspath�_check_resolve_relativer�rZ	_longpath�tempfileZmkdtemprrr��_check_resolve_absolute)rrFrCr)rrrr
�test_resolve_common�sT


z!_BasePathTest.test_resolve_commoncCs�|jt�}|jdtd��|jtjjdd�td��|jtjjdd�td��|d}|j|jdd�|�|dd}|jt	|jdd�|j|jd	d�|dd�dS)
Nr�0�1�2T)rc�3�4F)
rBr�rr�rer�rrbrir#)rrCrr}rrr
�test_resolve_dots
z_BasePathTest.test_resolve_dotcCs�|jt�}|j�}|j�}t|�|�WdQRX|jtt|�|jtt|�|jt|j�|jt|j�|jt|j�|jt|j	�dS)N)
rBr�rLrRrirjrrbr8�	__enter__)rrCrNZit2rrr
�	test_with s

z_BasePathTest.test_withcCsd|jt�d}|j�j}|d@}|j|�|j|j�j|�|dB}|j|�|j|j�j|�dS)Nr�im���)rBr�r6�st_moderr)rrC�modeZnew_moderrr
�
test_chmod/s


z_BasePathTest.test_chmodcCsZ|jt�d}|j�}|j|j�|�|j|jdA�|j|j|j�|j|j�|�dS)Nrru)rBr�r6rrrvrr�)rrC�strrr
�	test_stat=sz_BasePathTest.test_statcCs*|jt�d}|j�}|j||j��dS)Nr)rBr�r6r��lstat)rrCryrrr
�
test_lstatFsz_BasePathTest.test_lstatcCs*|jt�d}|j�}|j||j��dS)Nr)rBr�r6rr{)rrCryrrr
�test_lstat_nosymlinkLsz"_BasePathTest.test_lstat_nosymlinkz&the pwd module is needed for this testcCs`|jt�d}|j�j}ytj|�j}Wn"tk
rJ|jd|�YnX|j	||j
��dS)Nrz4user %d doesn't have an entry in the system database)rBr�r6�st_uid�pwd�getpwuid�pw_name�KeyErrorr�rr)rrCZuidr�rrr
rQs
z_BasePathTest.test_ownerz&the grp module is needed for this testcCs`|jt�d}|j�j}ytj|�j}Wn"tk
rJ|jd|�YnX|j	||j
��dS)Nrz5group %d doesn't have an entry in the system database)rBr�r6�st_gid�grpZgetgrgidZgr_namer�r�rr)rrC�gidr�rrr
r\s
z_BasePathTest.test_groupcCs2|jt�d}|j�|j|j�|j|j�dS)Nr)rBr�r�r*r6)rrCrrr
�test_unlinkgsz_BasePathTest.test_unlinkcCsL|jt�d}x|j�D]}|j�qW|j�|j|j�|j|j�dS)Nr)rBr�rLr��rmdirr*r6)rrCrrrr
�
test_rmdirmsz_BasePathTest.test_rmdircCs�|jt�}|d}|j�j}|dd}|j|�|j|j�j|�|j|j�td�}|j|�|jtj|�j|�|j|j�dS)Nrr�fileAAZfileAAA)	rBr�r6�st_size�renamerr*�rel_joinre)rrFrC�sizerr}rrr
�test_renameus



z_BasePathTest.test_renamecCs�|jt�}|d}|j�j}|dd}|j|�|j|j�j|�|j|j�tdd�}|j|�|jtj|�j|�|j|j�dS)Nrrr�rr)	rBr�r6r�rrr*r�re)rrFrCr�rr}rrr
�test_replace�s




z_BasePathTest.test_replacecCs�|jt�}|d}|j|j��|j�|j|j��|j�}|j}|j}t	j
t|�|d|df�|j�|j�}|j|j|�|j|j|�|d}|j|j��|jddd�|j|j��|j
t|jdd�dS)NZnewfileA�
ZnewfileBi�F)rw�exist_ok)r�)rBr�r�r;�touchrwr6�st_mtime�st_mtime_nsre�utimerJr�rir�)rrFrCryZ	old_mtimeZold_mtime_nsrrr
�test_touch_common�s$
z_BasePathTest.test_touch_commonc
CsH|jt�}|d}|j�|jd��}|j|j�j�d�WdQRXdS)Nrr=sthis is file A)rBr�r�rrrArC)rrFrCrrrr
�test_touch_nochange�s

z!_BasePathTest.test_touch_nochangec
Csx|jt�}|d}|j|j��|j�|j|j��|j|j��|jt��}|j�WdQRX|j	|j
jtj�dS)NZnewdirA)
rBr�r�r;rrw�is_dirrir�rr$r%�EEXIST)rrFrCr)rrr
�
test_mkdir�s
z_BasePathTest.test_mkdircCs6|jtdd�}|j|j��|jt��}|j�WdQRX|j|jj	t	j
�|jdd�|j|j��|j|j��|jt��}|jdd�WdQRX|j|jj	t	j
�tj|j�j�}|jtdd�}|jddd�|j|j��|j|j��tjdk�r|jtj|j�j�d	|@�|jtj|jj�j�|�dS)
NZnewdirB�newdirCT)r�ZnewdirDZnewdirEimr�im)rBr�r�r;rir�rrr$r%r&rwr�r�r6�S_IMODErvrer�r�)rrCr)rwrrr
�test_mkdir_parents�s&z _BasePathTest.test_mkdir_parentsc
Cs�|jtd�}|j�j}|j|j��|j|j��|jt��}|j	�WdQRX|j
|jjtj
�|j	dd�|j|j��|j
|j�j|�dS)NrT)r�)rBr�r6�st_ctimerwr;r�ri�FileExistsErrorrrr$r%r�)rrC�st_ctime_firstr)rrr
�test_mkdir_exist_ok�s
z!_BasePathTest.test_mkdir_exist_okcCs�|jtd�}|j|j��|jt��}|j�WdQRX|j|jj	t	j
�|d}|jdd�|j�j}|j|j��|jt��}|jdd�WdQRX|j|jj	t	j
�|jddd�|j|j��|j|j�j|�dS)Nrr�T)r�)r�r�)
rBr�rwr;rir�rrr$r%r�r6r�)rrCr)r�rrr
�test_mkdir_exist_ok_with_parent�s
z-_BasePathTest.test_mkdir_exist_ok_with_parentcCs2|jd�j�jdd�|jd�j�jddd�dS)NrT)r�)r�r�)rBrbr)rrrr
�test_mkdir_exist_ok_root�sz&_BasePathTest.test_mkdir_exist_ok_rootc
Cs^x.dD]}|j|d�}|j�sPqW|jd�|jt��|ddjdd�WdQRXdS)NZZYXWVUTSRQPONMLKJIHGFEDCBAz:\z&cannot find a drive that doesn't existZchildr�T)r�)rBr�r�rir�r)rrrCrrr
�test_mkdir_with_unknown_drive�s

z+_BasePathTest.test_mkdir_with_unknown_drivecCs�|jtdd�}|j|j��|jt��}|jdd�WdQRX|j|jj	t	j
�|jt��}|jddd�WdQRX|j|jj	t	j
�dS)NrrT)r�)r�r�)rBr�rwr;rir�rrr$r%r�)rrCr)rrr
�test_mkdir_with_child_filesz(_BasePathTest.test_mkdir_with_child_filecCs�|jtd�}|j|j��|jt��}|j�WdQRX|j|jj	t	j
�|jt��}|jdd�WdQRX|j|jj	t	j
�dS)NrT)r�)rBr�rwr;rir�rrr$r%r�)rrCr)rrr
�test_mkdir_no_parents_filesz(_BasePathTest.test_mkdir_no_parents_filecs�x�td�D]ȉ|jtd��}|j|j��d��fdd�	}�fdd�td�D��t��|d	d
}y*tjd|��|jdd
d�WdQRXWn$t	k
r�|j
t|���YnX|jt|���|j
|j��q
WdS)N� zdirCPC%d�cs6t|�}�j�r&tj||��j|�tj||�dS)N)rJ�poprer�add)r�rw)�concurrently_created�patternrr
�my_mkdir s

zE_BasePathTest.test_mkdir_concurrent_parent_creation.<locals>.my_mkdircsg|]}t�d|>@��qS)rs)�bool)r	�n)�pattern_numrr
r,szG_BasePathTest.test_mkdir_concurrent_parent_creation.<locals>.<listcomp>�Zdir1Zdir2zpathlib._normal_accessor.mkdirTF)r�r�)r�)r�rBr�r�r;rMrZpatchrr�rSrJZassertNotInrw)rrCr�Zp12r)r�r�r�r
�%test_mkdir_concurrent_parent_creationsz3_BasePathTest.test_mkdir_concurrent_parent_creationcCs|jt�}|d}|dd}|j|�|j|j�|j��|j|j�|j��|dd}|jt|��|j|j�|j��|j|j�|j��|j|j	��|d}|dd}|j|dd�|j|j�|j��|j|j�|j��|j
|j	��|j
t|j���dS)	NrrZlinkAAZlinkAAArZlinkAAAAT)r)
rBr�Z
symlink_torr6r�r{rJr�r�rwr�rL)rrF�target�linkrrr
�test_symlink_to8s$

z_BasePathTest.test_symlink_tocCs�|jt�}|j|dj��|j|dj��|j|dj��|j|ddj��ts�|j|dj��|j|dj��|j|dj��dS)Nrrznon-existingr:rrr)rBr�rwr�r�r�)rrFrrr
�test_is_dirPs
z_BasePathTest.test_is_dircCs�|jt�}|j|dj��|j|dj��|j|dj��|j|ddj��ts�|j|dj��|j|dj��|j|dj��dS)Nrrznon-existingr:rrr)rBr�rw�is_filer�r�)rrFrrr
�test_is_file[s
z_BasePathTest.test_is_filecCs�|jt�}|j|dj��|j|dj��|j|dj��|j|ddj��ts�|j|dj��|j|dj��|j|dj��dS)Nrrznon-existingr:rrr)rBr�r��
is_symlinkr�rw)rrFrrr
�test_is_symlinkfs
z_BasePathTest.test_is_symlinkcCsZ|jt�}|j|dj��|j|dj��|j|dj��|j|ddj��dS)Nrrznon-existingr:)rBr�r��is_fifo)rrFrrr
�test_is_fifo_falseqs

z _BasePathTest.test_is_fifo_false�mkfifozos.mkfifo() requiredcCs~|jtd�}ytjt|��Wn0tk
rN}z|jd|�WYdd}~XnX|j|j��|j	|j
��|j	|j��dS)NZmyfifozos.mkfifo(): %s)rBr�rer�rJ�PermissionErrorr�rwr�r��	is_socketr�)rrFr�rrr
�test_is_fifo_truexs z_BasePathTest.test_is_fifo_truecCsZ|jt�}|j|dj��|j|dj��|j|dj��|j|ddj��dS)Nrrznon-existingr:)rBr�r�r�)rrFrrr
�test_is_socket_false�s

z"_BasePathTest.test_is_socket_false�AF_UNIXzUnix sockets requiredcCs�|jtd�}tjtjtj�}|j|j�y|jt|��WnJt	k
r�}z.t
|t�sbdt|�krt|jdt|��WYdd}~XnX|j
|j��|j|j��|j|j��dS)NZmysockzAF_UNIX path too longzcannot bind Unix socket: )rBr��socketr�ZSOCK_STREAMr�closeZbindrJr��
isinstancer�r�rwr�r�r�r�)rrFZsockr�rrr
�test_is_socket_true�s
$z!_BasePathTest.test_is_socket_truecCsZ|jt�}|j|dj��|j|dj��|j|dj��|j|ddj��dS)Nrrznon-existingr:)rBr�r��is_block_device)rrFrrr
�test_is_block_device_false�s

z(_BasePathTest.test_is_block_device_falsecCsZ|jt�}|j|dj��|j|dj��|j|dj��|j|ddj��dS)Nrrznon-existingr:)rBr�r��is_char_device)rrFrrr
�test_is_char_device_false�s

z'_BasePathTest.test_is_char_device_falsecCsJ|jd�}|j�s|jd�|j|j��|j|j��|j|j��dS)Nz	/dev/nullz/dev/null required)rBr;r�rwr�r�r�r�)rrFrrr
�test_is_char_device_true�s

z&_BasePathTest.test_is_char_device_truecCsT|jtd�}xBtdtjd�D].}tj||�}tj|�}|j|j�|j��qWdS)Nrrrs)	rBr�r�r�r�r�r�rr6)rrCr�r�rSrrr
r��s

z"_BasePathTest.test_pickling_commoncCsJ|j}|d�}|d�}|j|jd|jd�|j|jd|jd�dS)Nz/usr/bin/fooz/usr/local/binrsr�r�)rBrLrK)rrFrCrrrr
�test_parts_interning�s
z"_BasePathTest.test_parts_interningcCs�|jt�}|jtjjdd�td��|jtjjdd�td��|jtjjdd�td��|j|td��|dj�}|j||�|jt|�t�|dj�}|j||�|jt|�t�|dj�}|j||�|jt|�t�|dj�}|j||�|jt|�t�tj	�}tj
t�z�|jd�j�}|j||�|jt|�t�|jd�j�}|j||�|jt|�t�|jd�j�}|j||�|jt|�t�|jd�j�}|j||�|jt|�t�Wdtj
|�XdS)NZlink0Zlink1Zlink2Zlink3)rBr�rrer�r�rbrrJr+�chdir)rZlink0_targetrFrCZold_pathrrr
�_check_complex_symlinks�sB

z%_BasePathTest._check_complex_symlinkscCs|jt�dS)N)r�r�)rrrr
�test_complex_symlinks_absolute�sz,_BasePathTest.test_complex_symlinks_absolutecCs|jd�dS)Nr)r�)rrrr
�test_complex_symlinks_relative�sz,_BasePathTest.test_complex_symlinks_relativecCs|jtjjdd��dS)Nrz..)r�rer�r�)rrrr
�&test_complex_symlinks_relative_dot_dot�sz4_BasePathTest.test_complex_symlinks_relative_dot_dotN)T)Or r!r"rDrer�rr"r*r,r.r1r3r5r7r9r<rErFrJrP�
with_symlinksrQrUrZr\r`rardrirkrlrrrtrxrzr|r}�unittest�
skipUnlessrrr�rr�r�r�r�r�r�r�r�r�r�r��only_ntr�r�r�r�r�r�r�r�r��hasattrr�r�r�r�r�r�r�r�r�r�r�r�r�rrrr
r	�s�


	
	
	
<			)r	c@s*eZdZejZdd�Zdd�Zdd�ZdS)�PathTestcCs0|jd�}|jt|�tjdkr$tjntj�dS)Nrr�)rBrLrMrer�r-rr)rrCrrr
r��s

zPathTest.test_concrete_classcCs,tjdkr|jttj�n|jttj�dS)Nr�)rer�rirr-rr)rrrr
�test_unsupported_flavour�s
z!PathTest.test_unsupported_flavourc
Cs2|j�}|jtd��t|jd��WdQRXdS)NzUnacceptable patternr)rBZassertRaisesRegexrjr�rV)rrCrrr
�test_glob_empty_patternsz PathTest.test_glob_empty_patternN)	r r!r"r-ZPathrBr�r�r�rrrr
r��sr�c@sfeZdZejZdd�dd�Zdd�Zdd�Ze	d	d
��Z
dd�Zd
d�Ze
jeed�d�dd��ZdS)�
PosixPathTestT)rcc
Gs2|j|�}|jt��t|j|��WdQRXdS)N)rBri�RuntimeError�printrb)rrcrNr�rrr
�_check_symlink_loops
z!PosixPathTest._check_symlink_loopcCs�tjd�}|jtj|�|jt�}|djd��WdQRXtjtd��}|jtj	|j
�d�tjd�|djd��WdQRXtjtd��}|jtj	|j
�d�dS)Nr�new_fileri���other_new_filei�)re�umaskrrBr�rr6r�rr�rv)r�old_maskrCryrrr
�test_open_modes




zPosixPathTest.test_open_modecCs�tjd�}|jtj|�|jt�}|dj�tjtd��}|jtj	|j
�d�tjd�|dj�tjtd��}|jtj	|j
�d�|djdd	�tjtd��}|jtj	|j
�d�dS)
Nrr�i�r�r�i�Zmasked_new_filei�)rw)rer�rrBr�r�r6r�rr�rv)rr�rCryrrr
�test_touch_mode!s


zPosixPathTest.test_touch_modecCs�tjdtd��|jtd�tjdtd��|jtd�tjdtd��|jtd�|jtdddd�tjtd	�td
��|jtd
�tjtd�td��|jtd�tjtd�td
��|jtd
�|jtd
ddd�dS)NzlinkX/insiderfrgzlinkZ/../linkZZlinkZr4F)rczlinkU/insideZlinkUZlinkVzlinkW/../linkWZlinkW)rer�r�r�r�)rrrr
�test_resolve_loop0szPosixPathTest.test_resolve_loopcCsX|j}|t�}t|jd��}tjt�s,t�n|}|j||�|jt|jd��t��dS)N�FILEazFILEa*)rBr�rMrVr�fs_is_case_insensitiver)rrFrCr^r_rrr
�	test_globEszPosixPathTest.test_globcCsZ|j}|td�}t|jd��}tjt�s.t�n|}|j||�|jt|jd��t��dS)Nr�FILEdzFILEd*)rBr�rMr[rr�r)rrFrCr^r_rrr
�
test_rglobMs
zPosixPathTest.test_rglob�getpwallz%pwd module does not expose getpwall()cCs|j}tjd�ddl}|jtj��}|j}|jj	d�p:d}x8|j
�D]$}|j}|jj	d�}||krF|rFPqFW|}|}|d�}|d|d�}	|d|d�}
|d|d�}|d|d�}|d	�}
|d
�}tj���"}|jdd�|j
|j�||�d�|j
|	j�||�d�|j
|
j�||�d�|j
|j�|�|j
|j�|�|j
|
j�|
�|jt|j�d
|d<|j
|j�|d��|j
|	j�||�d�|j
|
j�||�d�|j
|j�|�|j
|j�|�|j
|
j�|
�|jt|j�WdQRXdS)Nrrrz~/Documentsr/z
/Documentsz../~z/~rz~fakeuser/Documents�HOMEZ	Documentsz/tmpz/tmp/Documents)rBr�
import_modulerr�re�getuidr��pw_dir�rstripr��EnvironmentVarGuardr�rr0rir�)rrFrZpwdentZusername�userhomeZ	othernameZ	otherhome�p1�p2�p3�p4�p5�p6Zp7�envrrr
�test_expanduserUsJ
zPosixPathTest.test_expanduserN)r r!r"r-rrBr�r�r�r�r�r�r�r�r�r�rr�rrrr
r�
sr�c@s*eZdZejZdd�Zdd�Zdd�ZdS)�WindowsPathTestcCs0|j}|t�}|jt|jd��|td�h�dS)Nr�r)rBr�rrMrV)rrFrCrrr
r��szWindowsPathTest.test_globcCs2|j}|td�}|jt|jd��|td�h�dS)Nrr�zdirC/dirD/fileD)rBr�rrMr[)rrFrCrrr
r��s
zWindowsPathTest.test_rglobcsb�j�tj���H��jdd��jdd��jdd��jdd�d�d<�d���d���d	���d
���d���d���jt�j��jt�j��jt�j��j�j����j�j����j�j������������f	d
d�}d�d<|��jdd�d�d<|�d�d<d�d<|��jdd��jdd�d�d<|�WdQRXdS)Nr�ZUSERPROFILEZHOMEPATHZ	HOMEDRIVE�alice�USERNAMEz~/My Documentsz~alice/My Documentsz~bob/My Documentsz/~/My Documentszd:~/My Documentsrcs��jdd��j�j��d���jt�j�d�d<�j�j��d���j�j��d���j�j����j�j����j�j���dS)Nr�zC:/Users/alice/My Documentsr�zC:/Users/bob/My Documents)r�rr0rir�r)	rFr�r�r�r�r�r�r�rrr
r�s





z.WindowsPathTest.test_expanduser.<locals>.checkzC:\Users\alicezC:\zUsers\alice)rBrr�r�rir�r0r)rrr)	rFr�r�r�r�r�r�r�rr
r��s@zWindowsPathTest.test_expanduserN)	r r!r"r-rrBr�r�r�rrrr
r��sr��__main__)/rXr?rer%r-r�r�r6rjr�rZtestrZtest.supportrrr�r�ImportError�objectrZTestCaser#r.r5r�r�r�r��realpathr�r�r�r�ZskipIfr�r�Z
only_posixr�rrr	r�r�r�r �mainrrrr
�<module>sr)$BRL8=zE


Youez - 2016 - github.com/yon3zu
LinuXploit