
    <e                       d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl	Z	d dl
Z
d dlZd dlZd dlmZ d dlmZ d dlmZmZ d dlmZ d dlmZmZ 	 d dlZd dlZn# e$ r dxZZY nw xY w G d de          Z G d	 d
eej                  Z G d deej                  Z G d de          Z G d deej                  Z G d deej                  Z  G d deej                  Z!ej"        #                    e          Z$d Z%d Z& ej'        ej(        dk    d          Z) ej'        ej(        dk    d          Z*e* G d de                      Z+e) G d de                       Z, G d de          Z- G d  d!e-ej                  Z.e* G d" d#e-ej                              Z/e) G d$ d%e-ej                              Z0 G d& d'ej                  Z1e2d(k    r ej3                     dS dS ))    N)mock)import_helper)is_emscriptenis_wasi)	os_helper)TESTFNFakePathc                       e Zd Zd Zd ZdS )_BaseFlavourTestc                    | j         j        }| j         j        | j         j         |fd|D                       }|                     ||           r/ |fd|D                       }|                     ||           d S d S )Nc                 <    g | ]}|                     d           S /replace).0xseps     (/usr/lib/python3.11/test/test_pathlib.py
<listcomp>z7_BaseFlavourTest._check_parse_parts.<locals>.<listcomp>    s'    555AAIIc3''555    c                 <    g | ]}|                     d           S r   r   )r   r   altseps     r   r   z7_BaseFlavourTest._check_parse_parts.<locals>.<listcomp>#   s'    <<<1		#v..<<<r   )flavourparse_partsr   r   assertEqual)selfargexpectedfactualr   r   s        @@r   _check_parse_partsz#_BaseFlavourTest._check_parse_parts   s    L$l$555555566*** 	/Q<<<<<<<==FVX.....	/ 	/r   c                    | j         }| j        j        } |g ddg f            |dgdddgf            |dgdddgf            |ddgddddgf            |dgddddgf            |dgddddgf            |g dddg df            |g d	ddg df            |g d
ddg df            |dgddg f            |g ddddgf            |g dddddgf            |g ddddgf            |dgd||ddgf            |ddgd||ddgf            |ddgd||ddgf            |g dd||ddgf            |g dd||dgf           d S )N aa/ba/ba/b/)r%   zb/cd)r%   r'   cr*   )r%   zb//cr*   )r%   zb/c/r*   .)r,   r,   r'   )r%   r,   r'   )r%   r,   r,   /a/b/a/a/r%   /br+   r+   )r%   r1   /c)r"   r   r   )r   checkr   s      r   test_parse_parts_commonz(_BaseFlavourTest.test_parse_parts_common&   sf   'lbRRL111seRcUO444tfRcUO444sCjRc3Z$8999ugRc3Z$8999vhRc3Z$8999R-A-A-A$BCCC   R-A-A-A$BCCC   R-A-A-A$BCCCseRRL111oooRcUO444oooRc3Z$8999oooRcUO444vhRsCo$>???tSkRsCo$>???uclRsCo$>???RsCo$>???RsCj$9:::::r   N)__name__
__module____qualname__r"   r4    r   r   r   r      s2        / / /; ; ; ; ;r   r   c                   (    e Zd Zej        Zd Zd ZdS )PosixFlavourTestc                     | j         } |ddgddg df            |ddgddg df            |d	dgddg df            |d
gddd
gf            |dgdddgf            |dgdddgf           d S )N//ar'   r$   //)r=   r%   r'   ///ar   )r   r%   r'   z////ac:ac:\a\ar"   r   r3   s     r   test_parse_partsz!PosixFlavourTest.test_parse_partsF   s    ' 	uclT3C3C3C(DEEEvsmS///(BCCCwnS///(BCCCugR%(9:::wiR'(;<<<ugR%(9:::::r   c                 D   | j         j        }|                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d           |                      |d	          d
           |                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d
           |                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d           d S )Nr$   r$   r$   r$   r%   r$   r$   r%   r(   )r$   r$   r(   r)   )r$   r$   r)   r.   )r$   r   r%   r-   )r$   r   r(   /a/b/)r$   r   r)   r<   )r$   r=   r%   r>   ///a/bc:/a/b)r$   r$   rJ   \/a/b)r$   r$   rK   \a\b)r$   r$   rL   r   	splitrootr   r   r    s     r   test_splitrootzPosixFlavourTest.test_splitrootR   s   L"2---3///5?3336$45554.1116$45557%6777 	5?3336N3338&67778&89998&89998&899999r   N)r5   r6   r7   pathlib_posix_flavourr   rD   rP   r8   r   r   r:   r:   C   s:        $G
; 
; 
;: : : : :r   r:   c                   (    e Zd Zej        Zd Zd ZdS )NTFlavourTestc                 0   | j         } |dgdddgf            |dgdddgf            |dgdddgf            |dgddddgf            |d	gddddgf            |d
gddddgf            |dgdddgf            |dgdddgf            |dgddddgf            |g dddg df            |g dddg df            |g dddddgf            |g dddg df            |g dddddgf            |dgdddgf            |d gddddgf            |d d!gdddd"gf            |d#gd$dd%gf            |d&gd$dd%dgf            |g d'ddg d(f            |g d)ddg df            |g d*d+dg d,f           d S )-Nc:r$   c:/\c:\r   r?   r%   c:/ar.   //a/b\\a\b\\a\b\//a/b///a/b/cr+   )r%   zZ:br+   Z:)r`   r'   r+   )r%   zZ:/br+   )Z:\r'   r+   )r%   z//b/cr*   z\\b\cz\\b\c\r*   )r%   z	Z://b//c/d/)ra   r'   r+   r*   )r%   z//b/c//r*   z//?/c:/z\\?\c:z\\?\c:\z//?/c:/ar1   r'   z//?/UNC/b/cz\\?\UNC\b\cz\\?\UNC\b\c\z//?/UNC/b/c/dr0   )rX   r'   r+   )zZ:/ar1   r+   )z//?/Z:/ar1   r+   z\\?\Z:)z\\?\Z:\r'   r+   rB   rC   s     r   rD   zNTFlavourTest.test_parse_partsj   s   'tfrD6(:;;;ugtfX(>???seTD6(:;;;ugrD#;(?@@@vhtfc](CDDDtfTD#;(?@@@wiTL>(JKKKxjTL>(JKKKykTL#;N(OPPPr3C3C3C(DEEE   t5G5G5G(HIII!!!TL#;N(OPPP&&&t5L5L5L(MNNN###TL#;N(OPPPykd]O(LMMMzld]C<P(QRRRz4 d]C<P(QRRR}o);TDXCY(Z[[[);TDXZ]C^(_```T3C3C3C(DEEE!!!t5G5G5G(HIII%%%d<U<U<U(VWWWWWr   c                    | j         j        }|                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d           |                      |d	          d
           |                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d
           |                      |d          d           d S )Nr$   rF   r%   rG   a\b)r$   r$   rd   rA   )r$   rX   r%   rL   )r$   rX   rd   zc:a\b)rV   r$   rd   c:\a\b)rV   rX   rd   z\\az\\\a/b)r$   rX   r(   zc:\\a)rV   rX   r%   zc:\\\a/b)rV   rX   r(   r\   )r\   rX   r$   r]   	\\a\b\c\d)r\   rX   c\dz\\\a\brM   rO   s     r   rP   zNTFlavourTest.test_splitroot   s   L"2---3///6$45555?3338&89998&8999:(<===7_555;):;;;9'8999=))+>???:(>???<*@AAA+,,.HIII 	<*<===7_55555r   N)r5   r6   r7   rQ   _windows_flavourr   rD   rP   r8   r   r   rT   rT   g   s>        &G X  X  XD6 6 6 6 6r   rT   c                       e Zd Zg dg ddZd Zd Zd Zd Zd Zd	 Z	d
 Z
d Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd  Z d! Z!d" Z"d# Z#d$ Z$d%S )&_BasePurePathTest)
r%   r'   )r&   r'   )r%   b/)r&   rl   )r)   )za//b)za//b//)r$   r%   r'   )r%   r$   r'   )r%   r'   r$   ))r%   /b/cr*   )r%   z///b//crb   )r.   rm   r*   )r   r'   r$   c/d)r   r$   zb/c/d)r$   /b/c/d)r(   ro   c                     |                      d          }|j        | _        | j        j        | _        | j        j        | _        d S Nr%   )cls_flavourr   r   r   r   ps     r   setUpz_BasePurePathTest.setUp   s6    HHSMMz<#l)r   c           	         | j         } |d          }|                     ||            |ddd            |ddd            |d            |d            |t          d                     |                      | |d                     |d                     |                      | |d          d           |d                     |                      | |d           |d                     |d                     |                      | |d           |d           |d                     |t          d                               d S )Nr%   r'   r+   r.   a/b/c/a/b/cr(   )rr   assertIsInstancer	   r   r   Pru   s      r   test_constructor_commonz)_BasePurePathTest.test_constructor_common   sr   HAcFFa###	#sC	$S	'


	(	(7

11S66AAcFF+++11S663522211S6611S66**AAeHH55511S6611S6611S6622AAhw6G6G4H4HIIIIIr   c                      G d dt                     | j        } |fd|D              }|                     | ||            |j        D ]*}|                     t          |          t                      +d S )Nc                       e Zd ZdS ):_BasePurePathTest._check_str_subclass.<locals>.StrSubclassN)r5   r6   r7   r8   r   r   StrSubclassr      s        Dr   r   c              3   .   K   | ]} |          V  d S Nr8   )r   r   r   s     r   	<genexpr>z8_BasePurePathTest._check_str_subclass.<locals>.<genexpr>   s+      --1A------r   )strrr   r   partsassertIstype)r   argsr|   ru   partr   s        @r   _check_str_subclassz%_BasePurePathTest._check_str_subclass   s    	 	 	 	 	# 	 	 	HA-------.AAtH%%%G 	+ 	+DMM$t**c****	+ 	+r   c                     |                      d           |                      d           |                      d           |                      d           |                      d           d S )Nr$   r,   r%   za/b.txtz/a/b.txtr   r   s    r   test_str_subclass_commonz*_BasePurePathTest.test_str_subclass_common   sl      $$$  %%%  %%%  +++  ,,,,,r   c                 >   | j         } |d          }|                    d          }|                     | |d                     |                     t	          |          t	          |                     |                    dd          }|                     | |d                     |                     |d                    }|                     | |d                     |                    d          }|                     | |d                     d S )Nr(   r+   rx   r*   a/b/c/dr2   )rr   joinpathr   r   r   r   r|   ru   pps       r   test_join_commonz"_BasePurePathTest.test_join_common   s    HAeHHZZ__QQwZZ(((d2hhQ(((ZZS!!QQy\\***ZZ#QQwZZ(((ZZQQtWW%%%%%r   c                 X   | j         } |d          }|dz  }|                     | |d                     |                     t          |          t          |                     |dz  }|                     | |d                     |dz  dz  }|                     | |d                     d|z  dz  }|                     | |d                     | |d          z  }|                     | |d                     |dz  }|                     | |d                     d S )	Nr(   r+   rx   rn   r   r*   zc/a/b/dr2   )rr   r   r   r   r   s       r   test_div_commonz!_BasePurePathTest.test_div_common   s6   HAeHHWQQwZZ(((d2hhQ(((YQQy\\***Ws]QQy\\***1Ws]QQy\\***3ZQQwZZ(((WQQtWW%%%%%r   c                      | j         | }|                     t          |          |                    d| j                             d S Nr   )rr   r   r   r   r   )r   r   r   ru   s       r   
_check_strz_BasePurePathTest._check_str  sC    DHdOQ!1!1#tx!@!@AAAAAr   c                 j    dD ]}|                      ||f           |                      dd           d S )Nr%   r(   rx   r   r-   ry   r,   )r$   )r   )r   pathstrs     r   test_str_commonz!_BasePurePathTest.test_str_common  sD    C 	1 	1GOOGgZ0000U#####r   c                     | j         }dD ]3}|                      ||                                          |           4d S )Nr   )rr   r   as_posix)r   r|   r   s      r   test_as_posix_commonz&_BasePurePathTest.test_as_posix_common  sO    HC 	= 	=GQQwZZ0022G<<<<	= 	=r   c                     t          j        | j                  }| j        }|                     t           |d                    d|z   dz              d S )Nr(      a   b)osfsencoder   rr   r   bytes)r   r   r|   s      r   test_as_bytes_commonz&_BasePurePathTest.test_as_bytes_common  sM    k$(##Hqqxx$*t*;<<<<<r   c                 P   | j         }|                     t                    5   |d                                           d d d            n# 1 swxY w Y   |                     t                    5   |                                             d d d            d S # 1 swxY w Y   d S rq   )rr   assertRaises
ValueErroras_urir   r|   s     r   test_as_uri_commonz$_BasePurePathTest.test_as_uri_common  s   Hz** 	 	AcFFMMOOO	 	 	 	 	 	 	 	 	 	 	 	 	 	 	z** 	 	ACCJJLLL	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s#   AAA1BB"Bc                    dD ]J}|                      |          }|j        j        }t          |          }|                     |                    |dz             |           |                     |                    d          |           |t          |          dz   d         }|                     t          |          |
                                           t          |t          j                  }|                     |j        |j                   |                     ||           |                     t          |          |           Ld S )Nr   ()   )rr   	__class__r5   repr
assertTrue
startswithendswithlenr   evalr   rQ   __dict__r   )r   r   ru   clsnamerinnerqs          r   test_repr_commonz"_BasePurePathTest.test_repr_common   s    C 	) 	)G!!Ak*GQAOOALL377;;;OOAJJsOOQ///c'llQ&+,ET%[[!**,,777Q())AMM!+q{333Q"""T!WWa((((	) 	)r   c                     | j         }|                      |d           |d                     |                      |d           |dd                     |                      |d           |d                     |                      |d           |d                     |                      |d           |                       |                      |d           |d                     |                      |             |d                     |                      |            d           |                      |            i            |                      |            t                     d S )Nr(   r%   r'   r-   r   r$   )rr   r   assertNotEqualintr   s     r   test_eq_commonz _BasePurePathTest.test_eq_common0  sk   H511U88,,,511S#;;///AAeHHaaff---AAeHHaaii000AAeHHaacc***AAfIIqqvv...AACC3(((AACC$$$AACC$$$AACC%%%%%r   c                    | j         }|                     t           |d          j        d           |                     t           |d          j        d           |                      |d                              d                     |                      |d                              d                     |                      |d                              d                     |                      |d                              d                     |                      |d                              d                     |                      |d	                              d                     |                      |d
                              d                     |                      |d                              d                     |                      |d                              d                     |                      |d                              d                     |                      |d                              d                     |                      |d                              d                     |                      |d
                              d                     |                      |d                              d                     |                      |d                              d                     |                      |d                              d                     |                      |d                              d                     |                      |d                              d                     |                      |d                              d                     |                      |d                              d                     |                      |d                              d                     |                      |d                              d                     |                      |d                              d                     |                      |d                              d                     |                      |d                              d                     |                      |d                              d                     |                      |d                              d                     d S )Nr%   r$   r,   b.pya/b.py/a/b.pyza.pyzb/pyz/a.pyzb.py/cz*.pyzb.pyczb./pyzab/c.pyza*/*.pyz
/d/ab/c.pyz	/dab/c.pyz	ab/c.py/d/b.py/*.pyz/a/*.pyz/ab.pyz	/a/b/c.pyz/**/*.pyz
/a/**/*.py)rr   r   r   matchr   assertFalser   s     r   test_match_commonz#_BasePurePathTest.test_match_common=  s   H*aafflB777*aafflC888&		//000())&11222)**6223336001116001117))&112228**622333&		//000())&11222)**6223337))&112227))&112228**622333)**955666,--i88999633444;--i88999;--i88999'

((112226112228**7334449++G44555)**9556668**955666;--i88999;--j99:::+,,\::;;;;;r   c                 P     fd} j         } |d          } |d          } |d          } |d          } |||            |||            |||            |||            |||            j         } |d          } |d          } |d          } |d	          } |||            |||            |||            |||            |||                                t                    5   |            i k      d d d            d S # 1 swxY w Y   d S )
Nc                 `                         | |                               ||            d S r   )
assertLessassertGreaterr%   r'   r   s     r   r   z:_BasePurePathTest.test_ordering_common.<locals>.assertLesse  s3    OOAq!!!q!$$$$$r   r%   r(   abcr'   r.   r-   z/abcr1   )rr   r   	TypeError)r   r   r|   r%   r'   r+   r*   s   `      r   test_ordering_commonz&_BasePurePathTest.test_ordering_commonc  s   	% 	% 	% 	% 	% HAcFFAeHHAeHHAcFF
1a
1a
1a
1a
1aHAdGGAfIIAfIIAdGG
1a
1a
1a
1a
1ay)) 	 	ACC"HH	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   ?DD"Dc                     | j         }| j        } |d          }|j        }|                     |d           |                     ||j                    |d          }|j        }|                     ||ddf           d S )Nr(   rk   r-   r%   r'   )r   rr   r   r   r   )r   r   r|   ru   r   s        r   test_parts_commonz#_BasePurePathTest.test_parts_common  s    hHAeHH
+++eQW%%%AfIIc300000r   c                     | j         } |d          }|                     |                                d           |                     t          j        |          d           d S )Nr(   )r(   )rr   r   
__fspath__r   fspathr{   s      r   test_fspath_commonz$_BasePurePathTest.test_fspath_common  sT    HAeHH111	!h/////r   c           	           j                                         D ]2\  }}|                    d j                  }|                     j        d          }||k    r'| fd|D             z   }|                    |f                                |          }|D ]}  j        | }                     ||d                    |                                          t          |          t          |                                          t          |          |                                |
                                |           4d S )Nr   c                 F    g | ]}t          fd |D                       S )c              3   N   K   | ]}|                     d j                  V   dS )r   N)r   r   )r   r   r   s     r   r   zA_BasePurePathTest.test_equivalences.<locals>.<listcomp>.<genexpr>  s3      DD$$,,sDH55DDDDDDr   )tuple)r   tr   s     r   r   z7_BasePurePathTest.test_equivalences.<locals>.<listcomp>  sF     # # # DDDD!DDDDD# # #r   zfailed with args {})equivalencesitemsr   r   appendrr   r   formathashr   r   )r   ktuplescanonposixpcanonr   ru   s   `       r   test_equivalencesz#_BasePurePathTest.test_equivalences  s^   *0022 	6 	6IAvIIc48,,EIIdh,,E~~ # # # ### # #  ui(((XXe__F 6 6DHaL  F,A,H,H,K,KLLL  a$v,,777  Q///  u55556	6 	6r   c                    | j         } |d          }|                     |j         |d                     |                     |j        j         |d                     |                     |j        j        j         |                       |                     |j        j        j        j         |                        |d          }|                     |j         |d                     |                     |j        j         |d                     |                     |j        j        j         |d                     |                     |j        j        j        j         |d                     d S )Nrx   r(   r%   ry   r-   r.   r   rr   r   parentr{   s      r   test_parent_commonz$_BasePurePathTest.test_parent_common  sC   HAgJJ11U88,,,!!C&&111/555/6<<<AhKK11V99---!!D''222/3888/6#?????r   c                 \   | j         } |d          }|j        }|                     t          |          d           |                     |d          |d                     |                     |d          |d                     |                     |d          |d                     |                     |d	          |d                     |                     |d
          |d                     |                     |d          |d                     |                     |dd          |d          f           |                     |d d          |d           |d          f           |                     |d d	          |d           |d          f           |                     |dd           |d           |d          f           |                     |d d d          |d           |d          f           |                     |d d d	          |d           |d           |d          f           |                     t	          |           |d           |d           |d          g           |                     t                    5  |d          d d d            n# 1 swxY w Y   |                     t                    5  |d          d d d            n# 1 swxY w Y   |                     t                    5  ||d<   d d d            n# 1 swxY w Y    |d          }|j        }|                     t          |          d           |                     |d          |d                     |                     |d          |d                     |                     |d          |d                     |                     |d	          |d                     |                     |d
          |d                     |                     |d          |d                     |                     |dd          |d          f           |                     |d d          |d           |d          f           |                     |d d	          |d           |d          f           |                     |dd           |d           |d          f           |                     |d d d          |d           |d          f           |                     |d d d	          |d           |d           |d          f           |                     t	          |           |d           |d           |d          g           |                     t                    5  |d          d d d            n# 1 swxY w Y   |                     t                    5  |d          d d d            d S # 1 swxY w Y   d S )Nrx      r   r(   r   r%      r,   r   ry   r-   r.   r   )rr   parentsr   r   listr   
IndexErrorr   r   r|   ru   pars       r   test_parents_commonz%_BasePurePathTest.test_parents_common  s,   HAgJJiS1%%%Q5***Q3(((Q3(((R!!C&&)))R!!C&&)))R!!E((+++QqSAAeHH;///RaR11U88QQsVV"4555SbSAAeHHaaff#5666QRR11S6611S66"2333SSqSAAeHHaaff#5666TTrTQQsVVQQsVVQQuXX$>???cQQuXXqqvvqqvv$>???z** 	 	GG	 	 	 	 	 	 	 	 	 	 	 	 	 	 	z** 	 	FF	 	 	 	 	 	 	 	 	 	 	 	 	 	 	y)) 	 	CF	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 AhKKiS1%%%Q6+++Q4)))Q3(((R!!C&&)))R!!D''***R!!F)),,,QqSAAfII<000RaR11V99aagg"6777SbSAAfIIqqww#7888QRR11T77AAcFF"3444SSqSAAfIIqqvv#6777TTrTQQsVVQQtWWaaii$@AAAcQQvYY$3$@AAAz** 	 	GG	 	 	 	 	 	 	 	 	 	 	 	 	 	 	z** 	 	FF	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	sZ   $	J99J= J=	K33K7:K7L**L.1L.	W&&W*-W*	X!!X%(X%c                     | j         }|                      |d          j        d           |                      |d          j        d           |                      |d          j        d           d S )Nr(   r$   r-   rr   r   driver   s     r   test_drive_commonz#_BasePurePathTest.test_drive_common  so    H5,,,6"---2b)))))r   c                 B   | j         }| j        }|                      |d          j        d           |                      |d          j        d           |                      |d          j        |           |                      |d          j        |           d S Nr$   r(   r   r-   )rr   r   r   rootr   r|   r   s      r   test_root_commonz"_BasePurePathTest.test_root_common  s    Hh2R(((5+++3c***6-----r   c                 B   | j         }| j        }|                      |d          j        d           |                      |d          j        d           |                      |d          j        |           |                      |d          j        |           d S r  )rr   r   r   anchorr  s      r   test_anchor_commonz$_BasePurePathTest.test_anchor_common  s    Hh2r***5"---3,,,6)3/////r   c                 T   | j         }|                      |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 S )Nr$   r,   r   r(   r'   r-   /a/b/.r   r   r   rr   r   namer   s     r   test_name_commonz"_BasePurePathTest.test_name_common  s   H2R(((3b)))3b)))5,,,6---8)3///8)62229*F33333r   c                    | j         }|                      |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          j        d           |                      |d          j        d           d S )Nr$   r,   ..r   r(   r-   r	  r   .pyr   a/.hgrc/a/.hgrca/.hg.rc.rc	/a/.hg.rc
a/b.tar.gz.gz/a/b.tar.gza/Some name. Ending with a dot. /a/Some name. Ending with a dot.rr   r   suffixr   s     r   test_suffix_commonz$_BasePurePathTest.test_suffix_common  sC   H2r***3+++4,,,3+++5"---6)2...8+R0008+U3339,e4449,b111:-r222:-u555;.666</777=))0%888<==DbIII=>>ErJJJJJr   c                    | j         }|                      |d          j        g            |                      |d          j        g            |                      |d          j        g            |                      |d          j        g            |                      |d          j        g            |                      |d          j        g            |                      |d          j        dg           |                      |d	          j        dg           |                      |d
          j        g            |                      |d          j        g            |                      |d          j        dg           |                      |d          j        dg           |                      |d          j        ddg           |                      |d          j        ddg           |                      |d          j        g            |                      |d          j        g            d S )Nr$   r,   r   r(   r-   r	  r   r  r   r  r  r  r  r  r  .tarr  r  r  r  rr   r   suffixesr   s     r   test_suffixes_commonz&_BasePurePathTest.test_suffixes_common  s4   H2,,,3"---3"---5*B///6+R0008-r2228-w7779.8889.333:/444:/%999;05':::<1FE?CCC=))2VUODDD<==FKKK=>>GLLLLLr   c                    | j         }|                      |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 S )Nr$   r,   r  r   r(   r'   r   r  .hgrcr  .hgr  b.tarr  Some name. Ending with a dot.rr   r   stemr   s     r   test_stem_commonz"_BasePurePathTest.test_stem_common+  sb   H2R(((3b)))4t,,,3b)))5,,,8)3///9*G444:+U333<-w777<==B8	: 	: 	: 	: 	:r   c                 $   | j         }|                      |d                              d           |d                     |                      |d                              d           |d                     |                      |d                              d           |d                     |                      |d                              d           |d                     |                      |d                              d           |d                     |                      |d	                              d           |d                     |                     t           |d
          j        d           |                     t           |d          j        d           |                     t           |d          j        d           |                     t           |d          j        d
           |                     t           |d          j        d           |                     t           |d          j        d           |                     t           |d          j        d           d S )Nr(   d.xmlza/d.xmlr-   z/a/d.xmlr   r   a/Dot ending./a/Dot ending.r$   r,   r   r2   c/rn   rr   r   	with_namer   r   r   s     r   test_with_name_commonz'_BasePurePathTest.test_with_name_common9  s@   H5++G44aa	llCCC6,,W55qq}}EEE8..w779FFF9//88!!J--HHH?++55g>>)MMM+,,66w??:OOO*aaeeow???*aaff&6@@@*aaff&6@@@*aahh&8"===*aahh&8$???*aahh&8$???*aahh&8%@@@@@r   c                    | j         }|                      |d                              d           |d                     |                      |d                              d           |d                     |                      |d                              d           |d                     |                      |d                              d           |d	                     |                      |d
                              d           |d                     |                      |d                              d           |d                     |                      |d                              d           |d                     |                     t           |d          j        d           |                     t           |d          j        d           |                     t           |d          j        d           |                     t           |d          j        d           |                     t           |d          j        d           |                     t           |d          j        d           |                     t           |d          j        d           d S )Nr(   r*   za/dr-   z/a/dr   za/d.pyr   z/a/d.pyr  z/a/d.gzr,  r-  r$   r,   r   r2   r.  rn   rr   r   	with_stemr   r   r   s     r   test_with_stem_commonz'_BasePurePathTest.test_with_stem_commonI  sv   H5++C00!!E((;;;6,,S1111V99===8..s33QQx[[AAA9//44aa	llCCC=))33C88!!I,,GGG?++55c::AAeHHEEE+,,66s;;QQvYYGGG*aaeeos;;;*aaff&6<<<*aaff&6<<<*aahh&8"===*aahh&8$???*aahh&8$???*aahh&8%@@@@@r   c                    | j         }|                      |d                              d           |d                     |                      |d                              d           |d                     |                      |d                              d           |d                     |                      |d                              d           |d                     |                      |d                              d           |d                     |                      |d                              d           |d                     |                     t           |d          j        d           |                     t           |d	          j        d           |                     t           |d
          j        d           |                     t           |d          j        d           |                     t           |d          j        d
           |                     t           |d          j        d	           |                     t           |d          j        d           |                     t           |d          j        d           |                     t           |d          j        d           |                     t           |d          j        d           |                     t           |d          j        d           |                     t           |d          j        | j        j        df           d S )Nr(   r  za/b.gzr-   z/a/b.gzr   r   r$   r,   r   gz/.gzrn   z.c/.dz./.dz.d/.r*   )rr   r   with_suffixr   r   r   r   r   s     r   test_with_suffix_commonz)_BasePurePathTest.test_with_suffix_commonZ  s    H5--e44aakkBBB6..u55qq||DDD800778EEE911%88!!I,,GGG80044aahh???6..r22AAfII>>>*aaee&7???*aaff&8%@@@*aaff&8%@@@*aahh&:DAAA*aahh&:C@@@*aahh&:C@@@*aahh&:FCCC*aahh&:EBBB*aahh&:GDDD*aahh&:FCCC*aahh&:FCCC*aahh&:<+S1	3 	3 	3 	3 	3r   c                 4
   | j         } |d          }|                     t          |j                   |                     t          |j        d           |                     |                     |                       |d                     |                     |                    d           |d                     |                     |                     |d                     |d                     |                     |                    d           |d                     |                     |                    d           |d                     |                     |                     |d                     |                       |                     |                    d           |                       |                     |                    dd           |                       |                     t
          |j         |d                     |                     t
          |j         |d                     |                     t
          |j         |d	                     |                     t
          |j         |d
                      |d          }|                     |                     |d                     |d                     |                     |                    d           |d                     |                     |                     |d
                     |d                     |                     |                    d
           |d                     |                     |                    d           |d                     |                     |                     |d                     |                       |                     |                    d           |                       |                     t
          |j         |d                     |                     t
          |j         |d                     |                     t
          |j         |d                     |                     t
          |j         |                       |                     t
          |j        d           |                     t
          |j         |d                     d S )Nr(   r   r$   r%   r'   r&   r+   rx   a/cr.   r-   r   r/   r2   ry   /a/c)rr   r   r   relative_tor   r   r{   s      r   test_relative_to_commonz)_BasePurePathTest.test_relative_to_commons  sA   HAeHH)Q]333)Q]D999qqss++QQuXX666r**AAeHH555qqvv..#777s++QQsVV444t,,aaff555qqxx00!!##666u--qqss333sC00!!##666*amQQsVV<<<*amQQwZZ@@@*amQQuXX>>>*amQQtWW===AfIIqqvv..%999s++QQuXX666qqww//3888t,,aaff555u--qqvv666qqyy111133777v..444*amQQtWW===*amQQx[[AAA*amQQvYY???*amQQSS999*amR888*amQQsVV<<<<<r   c                 N	   | j         } |d          }|                     t          |j                   |                     t          |j        d           |                     |                     |                                 |                     |                    d                     |                     |                     |d                               |                     |                    d                     |                     |                     |d                               |                     |                    d                     |                     |                    dd                     |                     |                     |d                               |                     |                     |d                               |                     |                     |d	                               |                     |                     |d
                                |d          }|                     |                     |d                               |                     |                    d                     |                     |                     |d
                               |                     |                    d
                     |                     |                    d                     |                     |                     |d                               |                     |                    d                     |                     |                     |d                               |                     |                     |d                               |                     |                     |d                               |                     |                     |                                 |                     |                    d                     |                     |                     |d                               d S )Nr(   r   r$   r%   r&   r'   r+   rx   r<  r.   r-   r   r/   r2   ry   r=  )rr   r   r   is_relative_tor   r   r{   s      r   test_is_relative_to_commonz,_BasePurePathTest.test_is_relative_to_common  s   HAeHH)Q%5666)Q%5t<<<((--...((,,---((300111((..///((522333((//000((c22333))!!C&&11222))!!G**55666))!!E((33444))!!D''22333AfII((300111((--...((411222((..///((//000((633444((00111))!!D''22333))!!H++66777))!!F))44555))!!##..///))"--...))!!C&&1122222r   c                    | j         } |d          }t          dt          j        dz             D ]}t          j        ||          }t          j        |          }|                     |j        |j                   |                     ||           |                     t          |          t          |                     |                     t          |          t          |                     d S )Nr-   r   r   )rr   rangepickleHIGHEST_PROTOCOLdumpsloadsr   r   r   r   r   )r   r|   ru   protodumpedr   s         r   test_pickling_commonz&_BasePurePathTest.test_pickling_common  s    HAfII1f59:: 	. 	.E\!U++Ff%%BMM",444R###T"XXtAww///SWWc!ff----	. 	.r   N)%r5   r6   r7   r   rv   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)  r1  r5  r:  r?  rB  rK  r8   r   r   rj   rj      sF       
     L* * *J J J
+ 
+ 
+- - -& & && & &$B B B$ $ $= = == = =
  ) ) ) & & &$< $< $<L  81 1 10 0 06 6 6$@ @ @- - -^* * *. . .0 0 0	4 	4 	4K K K(M M M&: : :A A A A A A"3 3 32!= != !=F 3  3  3D	. 	. 	. 	. 	.r   rj   c                   R    e Zd Zej        Zd Zd Zd Zd Z	d Z
d Zd Zd Zd	 Zd
S )PurePosixPathTestc                     | j         }|                      |d          j        d           |                      |d          j        d           |                      |d          j        d           d S )Nr-   r   rI   r[   r=   rr   r   r  r   s     r   	test_rootzPurePosixPathTest.test_root  sp    H6---8)3///7$/////r   c                    | j         }|                      |d           |d                     |                      |d           |d                     |                      |d           |d                     d S )Nr(   A/br.   r>   r<   )rr   r   r   r   s     r   test_eqzPurePosixPathTest.test_eq  s    HAAeHHaahh///4!!F)),,,AAdGGQQuXX.....r   c                 :   | j         }|                      |d                                          d           |                      |d                                          d           |                      |d                                          d           d S )Nr   zfile:///z/a/b.czfile:///a/b.cz/a/b%#czfile:///a/b%25%23c)rr   r   r   r   s     r   test_as_urizPurePosixPathTest.test_as_uri  s    H3*5558++--???9,,..0DEEEEEr   c           	      4   ddl m} | j        }	 t          j        d           n%# t
          $ r |                     d           Y nw xY w|                      |d                                          d |t          j        d                    z              d S )Nr   )quote_from_bytes   éz1\xe9 cannot be encoded to the filesystem encodingu   /a/bézfile:///a/b)	urllib.parserW  rr   r   r   UnicodeEncodeErrorskipTestr   r   )r   rW  r|   s      r   test_as_uri_non_asciiz'PurePosixPathTest.test_as_uri_non_ascii  s    111111H	PK! 	P 	P 	PMMNOOOOO	P:--//&)9)9"+f:M:M)N)NN	P 	P 	P 	P 	Ps   $ AAc                 v    | j         }|                      |d                              d                     d S )NzA.pyza.PY)rr   r   r   r   s     r   
test_matchzPurePosixPathTest.test_match  s7    H60011111r   c                    | j         }|                      |                                                       |                      |d                                                     |                      |d                                                     |                      |d                                                     |                      |d                                                     |                      |d                                                     |                      |d                                                     |                      |d                                                     d S )Nr%   r)   r   r.   rH   r<   r[   rr   r   is_absoluter   r   s     r   test_is_absolutez"PurePosixPathTest.test_is_absolute  sA   H**+++3++--...6..00111#**,,---$++--...'

..00111%,,..///'

..0011111r   c                    | j         }|                     d |d                                                     |                     d |d                                                     |                     d |d                                                     |                     d |d                                                     d S )NFr$   r   /foo/barz/dev/con/PRN/NULrr   r   is_reservedr   s     r   test_is_reservedz"PurePosixPathTest.test_is_reserved  s    HeQQrUU..00111eQQsVV//11222eQQz]]6688999eQQ122>>@@AAAAAr   c                    | j         } |d          }|                    d          }|                     | |d                      |d                              d          }|                     | |d                      |d                              d          }|                     | |d                     d S Nr<   r'   r[   r.   z//cr2   rr   r   r   r   s       r   	test_joinzPurePosixPathTest.test_join  s    HAeHHZZ__QQwZZ(((QtWWe$$QQuXX&&&QuXXt$$QQtWW%%%%%r   c                 &   | j         } |d          }|dz  }|                     | |d                      |d          dz  }|                     | |d                      |d          dz  }|                     | |d                     d S ri  rr   r   r   s       r   test_divzPurePosixPathTest.test_div  s    HAeHHWQQwZZ(((QtWWu_QQuXX&&&QuXX_QQtWW%%%%%r   N)r5   r6   r7   rQ   PurePosixPathrr   rP  rS  rU  r\  r^  rb  rg  rk  rn  r8   r   r   rM  rM    s        

C0 0 0/ / /F F FP P P2 2 2	2 	2 	2B B B& & &	& 	& 	& 	& 	&r   rM  c                   &   e Zd Zej        Zej                                        Ze	                    g dg ddgddgd           d Z
d Zd	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z d Z!d Z"d S )!PureWindowsPathTest))rV   r%   )rV   r&   )r   rV   r%   ))rW   r%   )rV   r   r%   )rV   r.   )z/zrW   r%   )z//x/yrW   r%   )r[   )r[   r+   )r^   r+   )r?   rZ   r^   r_   c                 6   |                      d          }|                     t          |          d           |                      d          }|                     t          |          d           |                      d          }|                     t          |          d           |                      d          }|                     t          |          d           |                      d	          }|                     t          |          d
           d S )Nrx   za\b\czc:/a/b/czc:\a\b\cr[   r]   r_   z\\a\b\c	//a/b/c/drf   )rr   r   r   rt   s     r   test_strzPureWindowsPathTest.test_str   s    HHWQ+++HHZ  Q///HHWQ...HHYQ///HH[!!Q!122222r   c                    |                      d           |                      d           |                      d           |                      d           |                      d           |                      d           |                      d           |                      d           |                      d	           d S )
NrV   r?   z	c:a\b.txtrY   r@   z
c:\a\b.txtz\\some\sharez\\some\share\az\\some\share\a\b.txtr   r   s    r   test_str_subclassz%PureWindowsPathTest.test_str_subclass,  s      &&&  '''  ...  (((  )))  000  !2333  !5666  !<=====r   c                    | j         }|                      |d           |d                     |                      |d           |ddd                     |                      |d           |d                     |                      |d           |d                     |                      |d           |d                     |                      |d           |d	                     |                      |d
           |d                     |                      |d           |d                     d S )Nc:a/brV   r%   r'   zd:a/brJ   r-   za/BrR  C:a/Bc:A/b//Some/SHARE/a/Bz//somE/share/A/b)rr   r   r   r   s     r   rS  zPureWindowsPathTest.test_eq7  sK   H7QQwZZ0007QQtS#%6%6777AAgJJ'

333AAgJJ(444AAfIIqq{{333511U88,,,7QQwZZ000-..2D0E0EFFFFFr   c                    | j         }|                     t                    5   |d                                           d d d            n# 1 swxY w Y   |                     t                    5   |d                                           d d d            n# 1 swxY w Y   |                      |d                                          d           |                      |d                                          d           |                      |d                                          d           |                      |d	                                          d
           |                      |d                                          d           |                      |d                                          d           |                      |d                                          d           d S )Nr-   rx  rW   zfile:///c:/zc:/a/b.czfile:///c:/a/b.cz	c:/a/b%#czfile:///c:/a/b%25%23cu   c:/a/bézfile:///c:/a/b%C3%A9z//some/share/zfile://some/share/z//some/share/a/b.czfile://some/share/a/b.cu   //some/share/a/b%#céz"file://some/share/a/b%25%23c%C3%A9)rr   r   r   r   r   r   s     r   rU  zPureWindowsPathTest.test_as_uriC  sW   Hz** 	 	AfII	 	 	 	 	 	 	 	 	 	 	 	 	 	 	z** 	  	 AgJJ	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 5**M::::--//1CDDD;..002IJJJ<//113IJJJ?++22446JKKK/0077992	4 	4 	4455<<>>=	? 	? 	? 	? 	?s#   AAA1BB"Bc                    | j         }|                      |d                              d                     |                      |d                              d                     |                      |d                              d                     |                      |d                              d                     |                      |d                              d                     |                      |d                              d                     |                      |d                              d                     |                      |d                              d                     |                      |d                              d                     |                      |d                              d                     |                      |d                              d                     |                      |d	                              d                     |                      |d	                              d
                     |                      |d                              d
                     |                      |d                              d
                     |                      |d                              d                     |                      |d                              d                     |                      |d                              d                     d S )Nzc:/b.pyr   zc:*.pyzc:/*.pyzd:/b.pyr   zc:b.pyr   z//some/share/a.pyz//some/share/*.pyz//other/share/a.pyz//some/share/a/b.pyzB.pyzb.PYz	c:/a/B.Pyz	C:/A/*.pYz//Some/Share/B.Pyz//somE/sharE/*.pY)rr   r   r   r   r   s     r   r   z%PureWindowsPathTest.test_match_commonS  s   H)**733444)**844555)**9556669++I667776112226223336334448**7334448**9556667))(334447)))44555-..44W==>>>-..445HIIJJJ/00667JKKLLL011778KLLMMM&		//000+,,[99:::-..445HIIJJJJJr   c                 p     fd} j         } |d          } |d          } |||                                ||k                                     ||k                |d          } |d          } |||                                ||k                                     ||k               d S )Nc                 `                         | |                               ||            d S r   )assertLessEqualassertGreaterEqualr   s     r   assertOrderedEqualzDPureWindowsPathTest.test_ordering_common.<locals>.assertOrderedEqualm  s5      A&&&##Aq)))))r   rz  ry  z//some/Share/A/br{  )rr   r   )r   r  r|   ru   r   s   `    r   r   z(PureWindowsPathTest.test_ordering_commonk  s    	* 	* 	* 	* 	* HAgJJAgJJ1a   QQA !!A !!1a   QQr   c                    | j         } |d          }|j        }|                     |d            |d          }|j        }|                     |d            |d          }|j        }|                     |d           d S )Nrx  )rV   r%   r'   rJ   )rY   r%   r'   rs  )r]   r+   r*   )rr   r   r   )r   r|   ru   r   s       r   
test_partszPureWindowsPathTest.test_parts|  s    HAgJJ 0111AhKK 2333AkNN 899999r   c                    | j         } |d          }|                     |j         |d                     |                     |j        j         |d                     |                     |j        j        j         |d                     |                     |j        j        j        j         |d                      |d          }|                     |j         |d                     |                     |j        j         |d                     |                     |j        j        j         |d                     |                     |j        j        j        j         |d                      |d	          }|                     |j         |d
                     |                     |j        j         |d                     |                     |j        j        j         |d                     d S )Nzz:a/b/czz:a/bz:az:zz:/a/b/czz:/a/bz:/az:/rs  r_   r[   r   r{   s      r   test_parentzPureWindowsPathTest.test_parent  s   HAiLL11W::...!!E((333/4999/6$@@@AjMM11X;;///!!F))444/5:::/6%AAAAkNN11Y<<000!!G**555/7<<<<<r   c                    | j         } |d          }|j        }|                     t          |          d           |                     |d          |d                     |                     |d          |d                     |                     |dd          |d          f           |                     |d d          |d          f           |                     |d d          |d           |d          f           |                     |dd           |d          f           |                     |d d d          |d          f           |                     |d d d          |d           |d          f           |                     t	          |           |d           |d          g           |                     t                    5  |d          d d d            n# 1 swxY w Y    |d          }|j        }|                     t          |          d           |                     |d          |d	                     |                     |d          |d
                     |                     |dd          |d	          f           |                     |dd          |d	          f           |                     |d d          |d	           |d
          f           |                     |dd           |d
          f           |                     |d d d          |d	          f           |                     |d d d          |d
           |d	          f           |                     t	          |           |d	           |d
          g           |                     t                    5  |d          d d d            n# 1 swxY w Y    |d          }|j        }|                     t          |          d           |                     |d          |d                     |                     |d          |d                     |                     |dd          |d          f           |                     |dd          |d          f           |                     |d d          |d           |d          f           |                     |dd           |d          f           |                     |d d d          |d          f           |                     |d d d          |d           |d          f           |                     t	          |           |d           |d          g           |                     t                    5  |d          d d d            d S # 1 swxY w Y   d S )Nzz:a/b/r   r   r  r   r  r   zz:/a/b/r  r  rs  r_   r[   )rr   r   r   r   r   r   r   r   s       r   test_parentsz PureWindowsPathTest.test_parents  s{   HAhKKiS1%%%Q5***Q4)))QqSAAeHH;///SbSAAeHH;///RaR11U88QQtWW"5666QRR11T77*---SSqSAAeHH;///TTrTQQtWWaahh$7888cQQuXXqqww$7888z** 	 	FF	 	 	 	 	 	 	 	 	 	 	 	 	 	 	AiLLiS1%%%Q6+++Q5***QqSAAfII<000QrTQQvYYL111RaR11V99aahh"7888QRR11U88+...SSqSAAfII<000TTrTQQuXXqqyy$:;;;cQQvYY%$9:::z** 	 	FF	 	 	 	 	 	 	 	 	 	 	 	 	 	 	AkNNiS1%%%Q9...Q7,,,QqSAAiLL?333QrTQQy\\O444RaR11Y<<7"<===QRR11W::-000SSqSAAiLL?333TTrTQQwZZ9$>???cQQy\\11W::$>???z** 	 	FF	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s6   	G33G7:G7	O))O-0O-
	W  W$'W$c                    | j         }|                      |d          j        d           |                      |d          j        d           |                      |d          j        d           |                      |d          j        d           |                      |d          j        d           |                      |d          j        d           |                      |d          j        d           d S )	NrV   rx  rW   c:/a/b/r[   r\   r^   rs  r   r   s     r   
test_drivezPureWindowsPathTest.test_drive  s    H4---7)40005...9+T2227):6668*J777;-z:::::r   c                    | j         }|                      |d          j        d           |                      |d          j        d           |                      |d          j        d           |                      |d          j        d           |                      |d          j        d           |                      |d          j        d           |                      |d	          j        d           d S )
NrV   r$   rx  rW   rX   r  r[   r^   rs  rO  r   s     r   rP  zPureWindowsPathTest.test_root  s    H4r***7"---5---9*D1117$///8)4000;,d33333r   c                    | j         }|                      |d          j        d           |                      |d          j        d           |                      |d          j        d           |                      |d          j        d           |                      |d          j        d           |                      |d          j        d           |                      |d	          j        d           d S )
NrV   rx  rW   rY   r  r[   r]   r^   rs  )rr   r   r  r   s     r   test_anchorzPureWindowsPathTest.test_anchor  s    H4...7*D1115&1119,f5557*L9998+\:::;.=====r   c                 T   | j         }|                      |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 S )NrV   r$   rW   rx  r'   rJ   c:a/b.pyr   	c:/a/b.py//My.py/Share.php//My.py/Share.php/a/br
  r   s     r   	test_namezPureWindowsPathTest.test_name  s   H4r***5+++7#...8)3///:+V444;,f555.//4b9992338#>>>>>r   c                    | j         }|                      |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          j        d           d S )NrV   r$   rW   rx  rJ   r  r  r  	c:a/.hgrc
c:/a/.hgrc
c:a/.hg.rcr  c:/a/.hg.rcc:a/b.tar.gzr  c:/a/b.tar.gz!c:a/Some name. Ending with a dot."c:/a/Some name. Ending with a dot.r  r  r  r   s     r   test_suffixzPureWindowsPathTest.test_suffix  s/   H4,,,5"---7*B///8+R000:-u555;.666;.333</444</777=))0%888>**15999?++2E:::>??FKKK?@@GLLL.//6;;;233:B?????r   c                    | j         }|                      |d          j        g            |                      |d          j        g            |                      |d          j        g            |                      |d          j        g            |                      |d          j        dg           |                      |d          j        dg           |                      |d          j        g            |                      |d	          j        g            |                      |d
          j        dg           |                      |d          j        dg           |                      |d          j        ddg           |                      |d          j        ddg           |                      |d          j        g            |                      |d          j        g            |                      |d          j        g            |                      |d          j        g            d S )NrV   rW   rx  rJ   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   s     r   test_suffixesz!PureWindowsPathTest.test_suffixes  sA   H4)2...5*B///7,b1118-r222:/%999;05':::;0"555<12666<1E7;;;=))2UG<<<>**3fe_EEE?++4vuoFFF.//8"===233<bAAA>??H"MMM?@@I2NNNNNr   c                    | j         }|                      |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 S )NrV   r$   zc:.zc:..r  rW   rx  r'   r  r  r#  r  r$  r  r%  r  r&  r'  r   s     r   	test_stemzPureWindowsPathTest.test_stem  sd   H4r***5+++6...5+++7#...:+S111;,g666<-u555>**/999>??D8	: 	: 	: 	: 	:r   c                 8   | j         }|                      |d                              d           |d                     |                      |d                              d           |d                     |                      |d                              d           |d                     |                      |d                              d           |d                     |                     t           |d          j        d           |                     t           |d	          j        d           |                     t           |d
          j        d           |                     t           |d          j        d           |                     t           |d          j        d           |                     t           |d          j        d           |                     t           |d          j        d
           d S )Nrx  r+  z	c:a/d.xmlrJ   z
c:/a/d.xmlc:a/Dot ending.c:/a/Dot ending.rV   rW   
//My/Shared:d:ed:/er/  r   s     r   test_with_namez"PureWindowsPathTest.test_with_name%  s   H7--g66+GGG8..w77<III,--77@@!!K..QQQ-..88AA11\??SSS*aagg&7AAA*aahh&8'BBB*aaoo&?III*aajj&:DAAA*aajj&:EBBB*aajj&:FCCC*aajj&:LIIIIIr   c                 8   | j         }|                      |d                              d           |d                     |                      |d                              d           |d                     |                      |d                              d           |d                     |                      |d                              d           |d                     |                     t           |d          j        d           |                     t           |d	          j        d           |                     t           |d
          j        d           |                     t           |d          j        d           |                     t           |d          j        d           |                     t           |d          j        d           |                     t           |d          j        d
           d S )Nrx  r*   zc:a/drJ   zc:/a/dr  r  rV   rW   r  r  r  r  r3  r   s     r   test_with_stemz"PureWindowsPathTest.test_with_stem3  s   H7--c22AAgJJ???8..s33QQx[[AAA,--77<<aajjIII-..88==qq{{KKK*aagg&7===*aahh&8#>>>*aaoo&?EEE*aajj&:DAAA*aajj&:EBBB*aajj&:FCCC*aajj&:LIIIIIr   c                    | j         }|                      |d                              d           |d                     |                      |d                              d           |d                     |                      |d                              d           |d                     |                      |d                              d           |d                     |                     t           |d          j        d           |                     t           |d	          j        d           |                     t           |d
          j        d           |                     t           |d          j        d           |                     t           |d          j        d           |                     t           |d          j        d
           |                     t           |d          j        d           |                     t           |d          j        d           |                     t           |d          j        d           |                     t           |d          j        d           |                     t           |d          j        d           |                     t           |d          j        d           |                     t           |d          j        d           |                     t           |d          j        d           |                     t           |d          j        d           d S )Nrx  r  zc:a/b.gzrJ   z	c:/a/b.gzr  r  r$   r,   r   r  r7  rX   rV   r8  z\.gzzc:.gzrn   rg   z.c/dz.c\d)rr   r   r9  r   r   r   s     r   test_with_suffixz$PureWindowsPathTest.test_with_suffixA  s   H7//66*FFF80077;HHH:2259911Z==III;33E::AAkNNKKK*aaee&7???*aaff&8%@@@*aaff&8%@@@*aaoo&A5III*aajj&<dCCC*aajj&<cBBB*aajj&<dCCC*aajj&<dCCC*aajj&<fEEE*aajj&<gFFF*aajj&<gFFF*aajj&<eDDD*aajj&<fEEE*aajj&<fEEE*aajj&<gFFFFFr   c           	      l   | j         } |d          }|                     |                     |d                     |d                     |                     |                    d           |d                     |                     |                     |d                     |d                     |                     |                    d           |d                     |                     |                    d           |d                     |                     |                     |d                     |                       |                     |                    d           |                       |                     t          |j         |                       |                     t          |j        d           |                     t          |j         |d	                     |                     t          |j         |d
                     |                     t          |j         |d                     |                     t          |j         |d                     |                     t          |j         |d                     |                     t          |j         |d                     |                     t          |j         |d                      |d          }|                     |                     |d                     |d                     |                     |                    d           |d                     |                     t          |                     |d                              d           |                     t          |                    d                    d           |                     |                     |d                     |d                     |                     |                    d           |d                     |                     |                     |d                     |d                     |                     |                    d           |d                     |                     |                    d           |d                     |                     |                     |d                     |                       |                     |                    d           |                       |                     t          |j         |d                     |                     t          |j         |d                     |                     t          |j         |d                     |                     t          |j         |d                     |                     t          |j         |d	                     |                     t          |j         |d                     |                     t          |j         |d
                     |                     t          |j         |d                     |                     t          |j         |d                      |d          }|                     |                     |d                     |d                     |                     |                    d           |d                     |                     |                    d           |d                     |                     |                     |d                      |d                     |                     |                    d            |d                     |                     |                    d!           |d                     |                     |                     |d"                     |                       |                     |                    d"           |                       |                     t          |j         |d#                     |                     t          |j         |d$                     |                     t          |j         |d%                     |                     t          |j         |d&                     d S )'N	C:Foo/BarrV   zFoo/Barc:foOBarc:foO/	c:foO/baRr$   r  r   Foo/FooC:/FooC:Foo/Bar/Baz	C:Foo/Baz
C:/Foo/Barz/Foo/Barz\Foo\BarrW   c:/foOc:/foO/
c:/foO/baRC:/BazC:/Foo/Bar/Baz
C:/Foo/BazC:Food:///C/Foo//Server/Share/Foo/Bar//sErver/sHare//sErver/sHare///sErver/sHare/Foo//sErver/sHare/Foo///sErver/sHare/Foo/Bar/Server/Share/Fooc:/Server/Share/Foo//z/Share/Foo//Server/z/Foo)rr   r   r>  r   r   r   r{   s      r   test_relative_toz$PureWindowsPathTest.test_relative_toY  s   HAkNNqqww//9>>>t,,aa	ll;;;qqzz22AAeHH===w//5:::x00!!E((;;;qq~~66<<<{33QQSS999*amQQSS999*amR888*amQQtWW===*amQQsVV<<<*amQQuXX>>>*amQQvYY???*amQQx[[AAA*amQQ5G5GHHH*amQQ{^^DDDAlOOqqww//:???t,,aa
mm<<<Q]]11T773344lCCCQ]]40011<@@@qqxx00!!I,,???u--qq||<<<qq{{33QQuXX>>>x00!!E((;;;y1111U88<<<qq77===|44aacc:::*amQQx[[AAA*amQQ7G5H5HIII*amQQ|__EEE*amQQwZZ@@@*amQQtWW===*amQQuXX>>>*amQQsVV<<<*amQQvYY???*amQQy\\BBBA&''qq)9':':;;QQy\\JJJ'788!!I,,GGG'89911Y<<HHHqq)='>'>??5JJJ';<<aahhGGG'<==qqxxHHHqq)A'B'BCCQQSSIII'?@@!!##FFF*amQQ7J5K5KLLL*amQQ7L5M5MNNN*amQQ5G5GHHH*amQQ7G5H5HIIIIIr   c                    | j         } |d          }|                     |                     |d                               |                     |                    d                     |                     |                     |d                               |                     |                    d                     |                     |                    d                     |                     |                     |d                               |                     |                    d                     |                     |                     |                                 |                     |                    d                     |                     |                     |d                               |                     |                     |d                               |                     |                     |d	                               |                     |                     |d
                               |                     |                     |d                               |                     |                     |d                               |                     |                     |d                                |d          }|                     |                    d                     |                     |                     |d                               |                     |                     |d                               |                     |                    d                     |                     |                     |d                               |                     |                    d                     |                     |                     |d                               |                     |                     |d                               |                     |                     |d                               |                     |                     |d                               |                     |                     |d                               |                     |                     |d                               |                     |                     |d                               |                     |                     |d
                               |                     |                     |d                                |d          }|                     |                     |d                               |                     |                    d                     |                     |                    d                     |                     |                     |d                               |                     |                    d                     |                     |                    d                     |                     |                     |d                               |                     |                    d                     |                     |                     |d                               |                     |                     |d                                |                     |                     |d!                               |                     |                     |d"                               d S )#Nr  rV   r  r  r  r$   r  r   r  r  r  r  r  r  rW   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  )rr   r   rA  r   r{   s      r   test_is_relative_toz'PureWindowsPathTest.test_is_relative_to  s   HAkNN((411222((..///((744555((11222((22333((;88999((55666))!!##..///))"--...))!!D''22333))!!C&&11222))!!E((33444))!!F))44555))!!H++66777))!!O*<*<==>>>))!!K..99:::AlOO((..///((522333((855666((33444((<99:::((66777))!!H++66777))!!,<*=*=>>???))!!L//::;;;))!!G**55666))!!D''22333))!!E((33444))!!C&&11222))!!F))44555))!!I,,77888A&''((+;)<)<==>>>(()9::;;;(():;;<<<((+?)@)@AABBB(()=>>???(()>??@@@((+C)D)DEEFFF(()ABBCCC))!!,?*@*@AABBB))!!,A*B*BCCDDD))!!O*<*<==>>>))!!,<*=*=>>?????r   c                    | j         }|                      |                                                       |                      |d                                                     |                      |d                                                     |                      |d                                                     |                      |d                                                     |                      |d                                                     |                      |d                                                     |                      |d                                                     |                      |d                                                     |                      |d	                                                     |                      |d
                                                     |                      |d                                                     |                      |d                                                     |                      |d                                                     |                      |d                                                     |                      |d                                                     d S )Nr%   r)   r   r.   rH   rV   r?   zc:a/b/rW   rZ   r  r[   r^   r_   rs  r`  r   s     r   rb  z$PureWindowsPathTest.test_is_absolute  s}   H**+++3++--...6..001113++--...4,,..///7//112224,,..///5--//00080022333%,,..///&		--//000)0022333'

..00111(//11222)0022333+224455555r   c                    | j         } |d          }|                    d          }|                     | |d                     |                    d          }|                     | |d                     |                    d          }|                     | |d                     |                    d          }|                     | |d                     |                    d          }|                     | |d                     |                    d	          }|                     | |d                     |                    d
          }|                     | |d                     d S )NC:/a/bx/y
C:/a/b/x/y/x/yC:/x/yD:x/yD:/x/y//host/share/x/yc:x/yc:/x/yrj  r   s       r   rk  zPureWindowsPathTest.test_join  sm   HAhKKZZQQ|__---ZZQQx[[))) ZZ  QQwZZ(((ZZ!!QQx[[)))ZZ*++QQ122333 ZZ  QQ|__---ZZ!!QQx[[)))))r   c                 .   | j         } |d          }|                     |dz   |d                     |                     |dz  dz   |d                     |                     |dz   |d                     |                     |dz  dz   |d                     |                     |d	z   |d	                     |                     |d
z  dz   |d	                     |                     |dz   |d                     |                     |d
z  dz   |d                     |                     |dz   |d                     |                     |dz   |d                     |                     |dz   |d                     d S )Nr  r  r  r   yr  r  z/xr  zD:r  r  r  r  rm  r{   s      r   rn  zPureWindowsPathTest.test_div  s   HAhKKUAAlOO444S3,888VQQx[[111TC8555 	Waajj111TE)11W::666Xqq{{333TF*AAhKK888//3E1F1FGGG 	Waaoo666Xqq{{33333r   c                 D	   | j         }|                     d |d                                                     |                     d |d                                                     |                     d |d                                                     |                     d |d                                                     |                     d |d                                                     |                     d |d                                                     |                     d |d	                                                     |                     d |d
                                                     |                     d |d                                                     |                     d |d                                                     |                     d |d                                                     |                     d |d                                                     |                     d |d                                                     |                     d |d                                                     |                     d |d                                                     |                     d |d                                                     |                     d |d                                                     |                     d |d                                                     |                     d |d                                                     |                     d |d                                                     |                     d |d                                                     |                     d |d                                                     |                     d |d                                                     |                     d |d                                                     d S )NFr$   r   rd  z//my/share/nul/con/auxTnulauxprnconzconin$zconout$COM1LPT9u   com¹u   com²u   lpt³zNUL.txtzPRN  z	AUX  .txtzCOM1:barzLPT9   :barzbar.com9zbar.lpt9zc:/baz/con/NULzc:/NUL/con/bazre  r   s     r   rg  z$PureWindowsPathTest.test_is_reserved  s   HeQQrUU..00111eQQsVV//11222eQQz]]6688999eQQ788DDFFGGGdAAeHH0022333dAAeHH0022333dAAeHH0022333dAAeHH0022333dAAhKK3355666dAAiLL4466777dAAfII1133444dAAfII1133444dAAiLL4466777dAAiLL4466777dAAiLL4466777 	dAAiLL4466777dAAgJJ2244555dAAkNN6688999dAAjMM5577888dAAm,,88::;;; 	eQQz]]6688999eQQz]]6688999dAA.//;;==>>>eQQ/00<<>>?????r   N)#r5   r6   r7   rQ   PureWindowsPathrr   rj   r   copyupdatert  rv  rS  rU  r   r   r  r  r  r  rP  r  r  r  r  r  r  r  r  r  r  rb  rk  rn  rg  r8   r   r   rq  rq    s       

!C$16688L>>>   .O
 
 
 
 

3 
3 
3	> 	> 	>
G 
G 
G? ? ? K K K0     "
: 
: 
:= = =$, , ,\; ; ;4 4 4> > >	? 	? 	?@ @ @&O O O&: : :J J JJ J JG G G08J 8J 8Jt3@ 3@ 3@j6 6 6** * *,4 4 4(!@ !@ !@ !@ !@r   rq  c                   .    e Zd Zej        Zd Zd Zd ZdS )PurePathTestc                     |                      d          }|                     t          |          t          j        dk    rt
          j        nt
          j                   d S Nr%   nt)rr   r   r   r   r  rQ   r  ro  rt   s     r   test_concrete_classz PurePathTest.test_concrete_class-  sV    HHSMMd1gg')w$G##G<Q	S 	S 	S 	S 	Sr   c                     t          j        d          }t          j        d          }|                     ||           d S rq   )rQ   ro  r  r   r   ru   r   s      r   test_different_flavours_unequalz,PurePathTest.test_different_flavours_unequal2  s>    !#&&#C((Aq!!!!!r   c                    t          j        d          }t          j        d          }|                     t                    5  ||k      d d d            n# 1 swxY w Y   |                     t                    5  ||k     d d d            n# 1 swxY w Y   |                     t                    5  ||k     d d d            n# 1 swxY w Y   |                     t                    5  ||k     d d d            d S # 1 swxY w Y   d S rq   )rQ   ro  r  r   r   r  s      r   !test_different_flavours_unorderedz.PurePathTest.test_different_flavours_unordered7  s   !#&&#C((y)) 	 	EE	 	 	 	 	 	 	 	 	 	 	 	 	 	 	y)) 	 	FF	 	 	 	 	 	 	 	 	 	 	 	 	 	 	y)) 	 	EE	 	 	 	 	 	 	 	 	 	 	 	 	 	 	y)) 	 	FF	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	sH   AAA;BBB3CC
C
+C??DDN)	r5   r6   r7   rQ   PurePathrr   r  r  r  r8   r   r   r  r  *  sL        

CS S S
" " "

 
 
 
 
r   r  c                  :    t          j        j        t          g| R  S r   )r   pathjoinBASEr   s    r   <lambda>r  J  s    "',t(a((( r   c                  :    t          j        j        t          g| R  S r   )r   r  r  r   r  s    r   r  r  K  s    bgl6.A... r   r  z)test requires a Windows-compatible systemz'test requires a POSIX-compatible systemc                       e Zd Zej        ZdS )PosixPathAsPureTestN)r5   r6   r7   rQ   	PosixPathrr   r8   r   r   r  r  R  s        

CCCr   r  c                   (    e Zd Zej        Zd Zd ZdS )WindowsPathAsPureTestc                     | j         }|                     t                    5   |d                                           d d d            d S # 1 swxY w Y   d S NrW   )rr   r   NotImplementedErrorownerr   s     r   
test_ownerz WindowsPathAsPureTest.test_ownerZ      H233 	 	AeHHNN	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	   AAAc                     | j         }|                     t                    5   |d                                           d d d            d S # 1 swxY w Y   d S r  )rr   r   r  groupr   s     r   
test_groupz WindowsPathAsPureTest.test_group_  r
  r  N)r5   r6   r7   rQ   WindowsPathrr   r	  r  r8   r   r   r  r  V  s:        

C  
    r   r  c                      e Zd ZdZd Zej        dk    rd Znd Zd Zd Z	d Z
d	 Zd
 Zd Zd Z ej        edu d          d             Zd Zd Z ej        ed          d             Zd Zd Zd Zd Zd Zd Zej        d             Zd Z d Z!d Z"ej        d             Z#d  Z$d! Z%ej        d"             Z&ej        d#             Z'dgd%Z(e(xZ)Z*ej        d&             Z+ej        d'             Z,d( Z-d) Z.ej/        d*             Z0e1ej/        d+                         Z2ej/        d,             Z3ej        d-             Z4d. Z5ej        d/             Z6d0 Z7 ej8        ed1          d2             Z9 ej8        e:d3          d4             Z;d5 Z<d6 Z=d7 Z> ej8         e?ed8          d9          d:             Z@ ej8         e?ed8          d9          d;             ZA ej         e?ed8          d<          d=             ZBd> ZCd? ZDej        d@             ZEdA ZFdB ZGdC ZHdD ZIdE ZJdF ZK ej        eLdG          dH             ZMeNdI             ZOdJ ZPdK ZQdL ZRej        dM             ZSdN ZTdO ZUe1dP             ZVdQ ZWdR ZX ej8         e?edS          dT           ej        eYjZ        dUk    dV          dW                         Z[dX Z\ ej8         e?e]dY          dZ           ej        eLd[           ej        ed\          d]                                     Z^d^ Z_d_ Z`d` Zada Zbdb Zcdc Zdej        dd             Zeej        de             Zfej        df             ZgdS )h_BasePathTestz?Tests for the FS-accessing functionalities of the Path classes.c                 ,   d }|                      |           t          j        t                     t          j        t	          d                     t          j        t	          d                     t          j        t	          d                     t          j        t	          dd                     t          j        t	          d                     t          t	          d          d          5 }|                    d	           d d d            n# 1 swxY w Y   t          t	          dd
          d          5 }|                    d           d d d            n# 1 swxY w Y   t          t	          dd          d          5 }|                    d           d d d            n# 1 swxY w Y   t          t	          dd          d          5 }|                    d           d d d            n# 1 swxY w Y   t          t	          ddd          d          5 }|                    d           d d d            n# 1 swxY w Y   t          j        t	          d          d           t          j	                    rt          j
        dt	          d                     t          j
        dt	          d                     |                     dt	          d                     |                     t          j                            dd          t	          dd                     |                     t          j                            dd          t	          dd                     t          j
        dt	          d                     d S d S )Nc                  |    t          j        t          d          d           t          j        t
                     d S )NdirE  )r   chmodr  r   rmtreer  r8   r   r   cleanupz$_BasePathTest.setUp.<locals>.cleanup}  s1    HT&\\5)))T"""""r   dirAdirBdirCdirDr  fileAwbs   this is file A
fileBs   this is file B
fileCs   this is file C
z	novel.txts   this is a novel
fileDs   this is file D
r   linkAnon-existing
brokenLinklinkBr  linkClinkDbrokenLinkLoop)
addCleanupr   mkdirr  r  openwriter  r   can_symlinksymlinkdirlinkr  )r   r  r    s      r   rv   z_BasePathTest.setUp|  s   	# 	# 	# 	   

f
f
f
ff%%&&&
f$w--&& 	)!GG'(((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)$vw''.. 	)!GG'(((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)$vw''.. 	)!GG'(((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)$v{++T22 	*aGG()))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	*$vvw//66 	)!GG'(((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)
fq!!! "" 		BJwW...J~tL'9'9:::LLg///LLdF33T&'5J5JKKKLLdF33T&'5J5JKKKJ'$/?*@*@AAAAA		B 		BsZ   5DDD E""E&)E&F--F14F1G88G<?G<"IIIr  c                 4    t          j        ||d           d S )NTtarget_is_directoryr   r.  r   srcdests      r   r/  z_BasePathTest.dirlink  s    JsDd;;;;;;r   c                 0    t          j        ||           d S r   r3  r4  s      r   r/  z_BasePathTest.dirlink  s    JsD!!!!!r   c                     |                      t          j                            t	          |          t	          |                    |d|d           d S )Nz and z don't point to the same file)r   r   r  samefiler   r   path_apath_bs      r   
assertSamez_BasePathTest.assertSame  sT    ((Vc&kkBB)	* 	* 	* 	* 	*r   c                     |                      t                    5 } ||i | d d d            n# 1 swxY w Y   |                     |j        j        t          j                   d S r   )r   FileNotFoundErrorr   	exceptionerrnoENOENT)r   funcr   kwargscms        r   assertFileNotFoundz _BasePathTest.assertFileNotFound  s    011 	"RD$!&!!!	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	"+U\:::::s   	044c                     |                      t          j                            |          t          j                            |                     d S r   )r   r   r  normcaser:  s      r   assertEqualNormCasez!_BasePathTest.assertEqualNormCase  s>    ))&11273C3CF3K3KLLLLLr   c                    |                      t          j                              }|                     ||           |                     t          |          t          |                     |                     t          |          t          |                     |                     |	                                           d S r   )
rr   r   getcwdr   rI  r   r   r   r   ra  r  s      r   	_test_cwdz_BasePathTest._test_cwd  s    HHRY[[!!A  QQ000d1ggtAww'''(((((r   c                 b    | j                                         }|                     |           d S r   )rr   cwdrL  rt   s     r   test_cwdz_BasePathTest.test_cwd  s)    HLLNNqr   c           
         | j         }t          j        d          5 }t          |_        |                     t           |                                                      t                     |                     t           |d                                                    t                     |                     t           |d                                                    t          j	        
                    t          d                     |                     t           |ddd                                                    t          j	        
                    t          ddd                     |                     t           |dd                                                    t          j	        
                    t          dd                     |                     t           |d                                                    t          j	        
                    t          d                     |                     t           |d	                                                    t          j	        
                    t          d	                     |                     t           |d
                                                    t          j	        
                    t          d
                     |                     t           |dd
                                                    t          j	        
                    t          dd
                     |                     t           |d
d                                                    t          j	        
                    t          d
d                     d d d            d S # 1 swxY w Y   d S )N	os.getcwdr,   r%   r'   r+   r%  r  r$  r(  r  )rr   r   patchr  return_valuer   r   absoluter   r  r  )r   r|   rK  s      r   test_absolute_commonz"_BasePathTest.test_absolute_common  s)   HZ$$ 	Z"&F S00$777S3!2!233T:::S3!2!233RW\\$5L5LMMMS3S!1!1!:!:!<!<==rw||DRUWZ\_?`?`aaa S7G!4!4!=!=!?!?@@"',,tU\^eBfBfgggS<!9!9!;!;<<bgll4Q]>^>^___S#3!4!4!=!=!?!?@@"',,tUeBfBfggg S4!1!1!3!344bgll46N6NOOOS3!6!6!8!89927<<cSW;X;XYYYS4!6!6!8!89927<<dTW;X;XYYY#	Z 	Z 	Z 	Z 	Z 	Z 	Z 	Z 	Z 	Z 	Z 	Z 	Z 	Z 	Z 	Z 	Z 	Zs   N$OOOc                    |                      t          j                            d                    }|                     ||           |                     t          |          t          |                     |                     t          |          t          |                     | 	                    |
                                           d S )N~)rr   r   r  
expanduserr   rI  r   r   r   r   ra  r  s      r   
_test_homez_BasePathTest._test_home  s    HHRW'',,--A  QQ000d1ggtAww'''(((((r   Nz(Test requires pwd module to get homedir.)reasonc                 .   t          j                    5 }|                     | j                                                   |                                 t          j                            t          d          |d<   |                     | j                                                   t          j                            t          d          |d<   |                     | j                                                   d d d            d S # 1 swxY w Y   d S )NuserprofileUSERPROFILEhomeHOME)
r   EnvironmentVarGuardrY  rr   r^  clearr   r  r  r  )r   envs     r   	test_homez_BasePathTest.test_home  s
    *,, 		-OODHMMOO,,,IIKKK!#dM!B!BCOODHMMOO,,, ',,tV44CKOODHMMOO,,,		- 		- 		- 		- 		- 		- 		- 		- 		- 		- 		- 		- 		- 		- 		- 		- 		- 		-s   C)D

DDc                 Z   t           j                            t          d          }t           j                            t          dd          }|                     |          }|                     |          }|                     |          }|                     |                    |                     |                     |                    |                     |                     |                    |                     |                     |                    |                     t           j                            t          d          }|                     |          }|                     t          |j        |           |                     t          |j        |           |                     t          |j        |           |                     t          |j        |           |                     t          |j        |           |                     t          |j        |           d S )Nr  r  r  foo)
r   r  r  r  rr   r   r9  r   r   r?  )r   
fileA_path
fileB_pathru   r   r   non_existentr   s           r   test_samefilez_BasePathTest.test_samefile  s   W\\$00
W\\$88
HHZ  XXj!!HHZ  

:..///

2'''J//000A'''w||D%00HH\""+QZ;;;+QZFFF+QZ;;;+QZFFF+QZ;;;+QZFFFFFr   c                     |                      d          }|                     |                                t          j        d                     d S )Nr$   r,   )rr   r   statr   rt   s     r   test_empty_pathz_BasePathTest.test_empty_path  s=    HHRLL273<<00000r   zWASI has no user accounts.c                    | j         } |d          }|                     |                                 |t          j                            d                                |d          }|                     |                                |            |d          }|                     |                                |            |d          }|                     |                                |            | |d                                          j                  dz  }|                     |                                |           d S )NrW  re  /~../~r$   )rr   r   rX  r   r  rT  r  r{   s      r   test_expanduser_commonz$_BasePathTest.test_expanduser_common  s   HAcFF27+=+=c+B+B)C)CDDDAeHH+++AdGG+++AfII+++Aaaeenn%&&,+++++r   c                    | j         } |t                    }|                     d|                                           |                     d|dz                                             |                     d|dz                                             |                     d|dz  dz                                             t	          j                    r|                     d|dz                                             |                     d|dz                                             |                     d|dz  dz                                             |                     d|dz  dz                                             |                     d|d	z                                             |                     d |d
                                                     |                     d |t          dz                                                        |                     d |t          dz                                                        d S )NTr  r  Fbahr"  r%  r  re  z/xyzzyu    )rr   r  r   existsr   r-  r{   s      r   test_existsz_BasePathTest.test_exists  s   HAdGGdAHHJJ'''dQZ//11222dQ[0022333ea'kE199;;<<< "" 	AMM$W 4 4 6 6777MM$W 4 4 6 6777MM$Ww!6 > > @ @AAAMM%!g+"5!=!=!?!?@@@ea%i//11222eQQx[[//11222eQQth//6688999eQQtf}--446677777r   c                 X   |                      t                    }|dz                      d          5 }|                     |t          j                   |                     |                                d           d d d            n# 1 swxY w Y   |dz                      d          5 }|                     |t          j                   |                     |                                	                                d           d d d            n# 1 swxY w Y   |dz                      dd          5 }|                     |t          j
                   |                     |                                	                                d           d d d            d S # 1 swxY w Y   d S )Nr  r   zthis is file A
rb   this is file Ar   )	buffering)rr   r  r+  rz   io
TextIOBaser   readBufferedIOBasestrip	RawIOBase)r   ru   r    s      r   test_open_commonz_BasePathTest.test_open_common!  sD   HHTNN'k$$ 	;!!!R]333QVVXX'9:::	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 'k%% 	B!!!R%6777QVVXX^^--/@AAA	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 'k22 	Ba!!!R\222QVVXX^^--/@AAA	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	Bs8   A	BBB+ADDD7AFF#&F#c                 ^   |                      t                    }|dz                      d           |                     |dz                                  d           |                     t          |dz  j        d           |                     |dz                                  d           d S )Nr  s   abcdefgsomestr)rr   r  write_bytesr   
read_bytesr   r   rt   s     r   test_read_write_bytesz#_BasePathTest.test_read_write_bytes-  s    HHTNN	
W!!*---!g+1133Z@@@)a'k%>	JJJ!g+1133Z@@@@@r   c                 l   |                      t                    }|dz                      dd           |                     |dz                      dd          d           |                     t          |dz  j        d	           |                     |dz                      d          d           d S )
Nr  u   äbcdefgzlatin-1encodingzutf-8ignore)r  errorsbcdefgs	   somebytes)rr   r  
write_textr   	read_textr   r   rt   s     r   test_read_write_textz"_BasePathTest.test_read_write_text5  s    HHTNN	
W  i @@@!g+00X 1 / /08	: 	: 	: 	)a'k%=|LLL!g+00)0DDjQQQQQr   c                    |                      t                    }|dz                      dd           |                     |dz                                  d           |dz                      dd           |                     |dz                                  d           |dz                      dd           |                     |dz                                  d	           t          t          j        d
          }|dz                      d           |                     |dz                                  d|z   dz   |z   dz              d S )Nr  zabcde
fghlk
mnopq
)newlines   abcde
fghlk
mnopqs   abcdefghlkmnopqz
s   abcde
fghlk
mnopqasciir  zabcde
fghlk
mnopqs   abcdes   fghlks   mnopq)rr   r  r  r   r  r   r   linesep)r   ru   os_linesep_bytes      r   test_write_text_with_newlinesz+_BasePathTest.test_write_text_with_newlines>  sv   HHTNN	
W  !:D III!g+11333	5 	5 	5 
W  !:D III!g+11333	5 	5 	5 
W  !:F KKK!g+11337	9 	9 	9  
W===	
W  !8999!g+1133"_4x?/QT^^	` 	` 	` 	` 	`r   c                     | j          t                    }|                                }t          |          }g d}t	          j                    r|g dz  }|                     |fd|D                        d S )N)r  r  r  r  r  )r"  r%  r$  r(  c                 2    h | ]} t           |          S r8   r  r   r   r|   s     r   	<setcomp>z-_BasePathTest.test_iterdir.<locals>.<setcomp>Z  s#     @ @ @!!D!** @ @ @r   )rr   r  iterdirsetr   r-  r   )r   ru   itpathsr   r|   s        @r   test_iterdirz_BasePathTest.test_iterdirR  s    HAdGGYY[[B<<< "" 	KJJJJH @ @ @ @h @ @ @AAAAAr   c                     | j          t          d          }t          |                                          }fddD             }|                     ||           d S )Nr%  c                 4    h | ]} t           d |          S )r%  r  r  s     r   r  z5_BasePathTest.test_iterdir_symlink.<locals>.<setcomp>b  s'    FFFQQQtWa((FFFr   )r  r'  )rr   r  r  r  r   )r   ru   r  r   r|   s       @r   test_iterdir_symlinkz"_BasePathTest.test_iterdir_symlink\  sh     HAdGAIIKK  FFFF2DFFF)))))r   c                 d   |                      t          d          }|                     t                    5 }t	          |                                           d d d            n# 1 swxY w Y   |                     |j        j        t          j	        t          j
        t          j        f           d S Nr  )rr   r  r   OSErrornextr  assertInr@  rA  ENOTDIRrB  EINVALr   ru   rE  s      r   test_iterdir_nodirz _BasePathTest.test_iterdir_nodire  s    HHT7##w'' 	2	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	bl(5=+0<+G 	H 	H 	H 	H 	Hs   "A$$A(+A(c                       fd} j          t                    }|                    d          }                     |t          j        j                    ||dg            ||                    d          g             ||                    d          ddg           t          j                    s" ||                    d          ddg           n! ||                    d          g d	           t          j                    s! ||                    d
          dg           n! ||                    d
          g d           t          j                    s! ||                    d          dg           n! ||                    d          ddg           t          j                    s# ||                    d          g d           d S  ||                    d          g d           d S )Nc                 f                         t          |           fd|D                        d S )Nc                 2    h | ]} t           |          S r8   r  r  s     r   r  zA_BasePathTest.test_glob_common.<locals>._check.<locals>.<setcomp>q  #    (H(H(H!!D!**(H(H(Hr   r   r  globr   r|   r   s     r   _checkz._BasePathTest.test_glob_common.<locals>._checkp  :    SYY(H(H(H(Hh(H(H(HIIIIIr   r  r  z
dir*/file*
dirB/fileB
dirC/fileCz*Ar  )r  r  r"  z*B/*)r  
dirB/linkDlinkB/fileBzlinkB/linkD*/fileBr  */)r  r  r  r  )r  r  r  r  r%  )	rr   r  r  rz   collectionsr   Iteratorr   r-  r   r  ru   r  r|   s   `   @r   test_glob_commonz_BasePathTest.test_glob_commono  s5   	J 	J 	J 	J 	J 	JHAdGGVVG__b+/":;;;rG9qvvg###qvvl##lL%ABBB$&& 	=F166$<<&'!23333F166$<<!;!;!;<<<$&& 	CF166&>>L>2222F166&>> $B $B $B C C C$&& 	EF166)$$|n5555F166)$$|]&CDDD$&& 	LF166$<<!A!A!ABBBBBF166$<<!J!J!JKKKKKr   c                      fd} j          t                    }|                    d          }                     |t          j        j                    ||dg            ||                    d          dg            ||                    d          g            t          j                    s! ||                    d          dg           n! ||                    d          g d            ||                    d          g d	           t          j                    s" ||                    d
          g d           n! ||                    d
          g d            ||                    d          g d            t          d          } ||                    d          g d            ||                    d          ddg            ||                    d          dg            ||                    d
          dg            ||                    d          ddg            ||                    d          dg            ||                    d          dg           d S )Nc                 f                         t          |           fd|D                        d S )Nc                 2    h | ]} t           |          S r8   r  r  s     r   r  zB_BasePathTest.test_rglob_common.<locals>._check.<locals>.<setcomp>  r  r   r  r  s     r   r  z/_BasePathTest.test_rglob_common.<locals>._check  r  r   r  r  r  z*/fileAr  )r  zdirB/linkD/fileBr  zdirA/linkC/fileBzfile*)r  r  r  dirC/dirD/fileDr  )r  r  r  	dirC/dirDr  )r  
dirA/linkCr  r  r  r  r  r%  r$   )r$   r  r  r  r  r  r  *)r  dirC/novel.txtr  r  r  r  z*/*r  z*.txtr  z*.*)	rr   r  rglobrz   r  r   r  r   r-  r  s   `   @r   test_rglob_commonz_BasePathTest.test_rglob_common  s   	J 	J 	J 	J 	J 	JHAdGGWWWb+/":;;;rG9qwww,000qwwy!!2&&&$&& 	LF1779%%~6666F1779%% (K (K (K L L Lqwww "C "C "C 	D 	D 	D$&& 	F1774== # # #     F1774== # # #    	qwwr{{MMMNNNAdFOOqwws|| > > > 	? 	? 	?qwww,0A!BCCCqwwu~~ 12333qwwt}}{m,,,qwwr{{V[1222qwww"2!3444qwwu~~ 0122222r   c                     | j         } |t                    t                              d                    }h d}|                     |fd|D                        d S )Nr  >   r  r  r  r  r  r"  r%  r$  r(  r  r  r  r  r  r  r  c                     h | ]}|z  S r8   r8   )r   r   ru   s     r   r  z8_BasePathTest.test_rglob_symlink_loop.<locals>.<setcomp>  s     7 7 71Q 7 7 7r   )rr   r  r  r  r   )r   r|   givenexpectru   s       @r   test_rglob_symlink_loopz%_BasePathTest.test_rglob_symlink_loop  st     HAdGGAGGCLL!!
 
 
 	 7 7 7 7 7 7 788888r   c                    d}| j         } |t                    dz   |gdg|z  R  }|                    d           d                    dg|z            fdt	          d	          D             }|D ]%}|                     t          |          |           &fd
t	          d	          D             }}t	          |          D ]/}|dz  }|D ]%}|                     t          |          |           &0d S )N   deepr*   Tr   r   r  c                 :    g | ]}                               S r8   )r  )r   jbasepatterns     r   r   z;_BasePathTest.test_glob_many_open_files.<locals>.<listcomp>  s%    8887##888r   d   c                 :    g | ]}                     d           S )r*   )r  )r   r  r  s     r   r   z;_BasePathTest.test_glob_many_open_files.<locals>.<listcomp>  s#    555QC555r   )rr   r  r*  r  rD  r   r  )	r   depthr|   ru   itersr  ir  r  s	          @@r   test_glob_many_open_filesz'_BasePathTest.test_glob_many_open_files  s9   HqwwAd#seEk###	((C55=))88888U3ZZ888 	* 	*BT"XXq))))5555%**555u 	. 	.ACA . .  b1----.	. 	.r   c                    | j         } |t                    }|                     t          |                    d                     |t          d          h           |                     t          |                    d                     |t          d          h           |                     t          |                    d                    t                                 d S )Nr  zdirA/../file*zdirA/../fileAz../xyzzy)rr   r  r   r  r  r{   s      r   test_glob_dotdotz_BasePathTest.test_glob_dotdot  s    HAdGGQVVD\\**aadmm,=>>>QVVO445549Q9Q7STTTQVVJ//00#%%88888r   c           
      n   | j         } |t                    dz  }|                                 |dz  }|                                 |dz  }|                                 |dz  }|dz  }|                    |dz             t
          j        fd}t          j        d|          5  | 	                    t          t          |                    d	                              d
           |                                 | 	                    t          t          |                    d	                              d           |                    d           | 	                    t          t          |                    d	                              d           d d d            d S # 1 swxY w Y   d S )Npermissionsfile1file2subdirfile3otherc                      |           5 }t          |          }d d d            n# 1 swxY w Y   |                    d            t          j        |          S )Nc                     | j         S r   )r  )entrys    r   r  zI_BasePathTest.test_glob_permissions.<locals>.my_scandir.<locals>.<lambda>  s    5: r   )key)r   sort
contextlibnullcontext)r  
scandir_itentriesreal_scandirs      r   
my_scandirz7_BasePathTest.test_glob_permissions.<locals>.my_scandir  s    d## +zz**+ + + + + + + + + + + + + + +LL55L666)'222s   )--z
os.scandirr  r      r   )rr   r  r*  touch
symlink_tor   scandirr   rR  r   r   r  r  r  )	r   r|   r  r  r  r  r  r  r  s	           @r   test_glob_permissionsz#_BasePathTest.test_glob_permissions  s    Hqww&

www')***
 z	3 	3 	3 	3 	3 Zj11 	: 	:STYYs^^!4!455q999LLNNNSTYYs^^!4!455q999LLSTYYs^^!4!455q999	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	:s   *C3F**F.1F.c                 
   |                      t                    dz  }|                                 |dz  }|                    d           |                     t          |                    d                    |g           d S )Nlong_symlinkbad_linkX  badbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadz**/*)rr   r  r*  r  r   sortedr  )r   r  r  s      r   test_glob_long_symlinkz$_BasePathTest.test_glob_long_symlink  su     xx~~.

*$K(((		& 1 122XJ?????r   Tc                 \    |                     |          }|                     ||           d S r   )resolver   )r   ru   r   strictr   s        r   _check_resolvez_BasePathTest._check_resolve
  s/    IIfH%%%%%r   c                 V
   | j         } |t          d          }|                     t                    5 }|                    d           d d d            n# 1 swxY w Y   |                     |j        j        t          j                   | 	                    t          |                    d                    t          j                            t          d                      |t          ddd          }| 	                    t          |                    d                    t          j                            t          ddd                      |t          dddd          }| 	                    t          |                    d                    t          j                            t          j                            ddd                                |t          dd	          }|                     ||            |t          d
          }|                     | |t          d                      |t          ddd	          }|                     | |t          dd	                      |t          ddd	          }|                     | |t          dd	                      |t          ddd	ddd          }|                     | |t          dd	ddd          d            |t          dddddd          }t          j        dk    r*|                     | |t          dddd          d           n(|                     | |t          ddd          d           t#          j        t'          j        dt          j                                        }|                     t"          j        |           t          j        t          j                            |          t          dd                     t          j        t          d          t          j                            |d                      |t          dddd	          }|                     | |t          dd	                      |t          dddddd          }|                     | |t          dddd          d            |t          ddddddd          }t          j        dk    r%|                     | ||ddd          d           d S |                     | |t          ddd          d           d S )Nre  Tr  Finspamr  r  r  r"  r  r  r&  r'  r  z-dirD)r  dirlinkXlinkY)rr   r  r   r  r  r   r@  rA  rB  rI  r   r   r  r  abspath_check_resolve_relativer  r   	_longpathtempfilemkdtemprK  r)  r  r.  _check_resolve_absolute)r   r|   ru   rE  r*   s        r   test_resolve_commonz!_BasePathTest.test_resolve_common  s   HAdENNw'' 	#2IITI"""	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	#+U\:::  QYYeY%<%<!=!=!#dE!:!:	< 	< 	<AdE4((  QYYeY%<%<!=!=!#dE4!H!H	J 	J 	JAdD%v..  QYYeY%<%<!=!=!#eT61R1R!S!S	U 	U 	U AdFG$$$$Q***AdG$$Q$(8(8999AdFGW--$$Q$(@(@AAAAdFGW--$$Q$(@(@AAAAdFGWeT6BB$$Q$*0)2 )238	: 	: 	:AdFGT5$??7d?? ((AAdFE4.4-6 -67<> > > >
 ((AAdE4,H,H%PPP 057Y[[!B !B !B C C	(!,,,

27<<??D$9$9:::

4<<a!9!9:::AdFGWg66$$Q$(@(@AAAAdFGWeT6BB$$Q$tV(L(L%*	, 	, 	,AdFGWdE4HH7d?? ((AAaf,E,EuMMMMM ((AAdE4,H,H%PPPPPs   AAAc                    |                      t                    }|                     dt          d                     |                     t          j                            dd          t          d                     |                     t          j                            dd          t          d                     |dz  }|                     |                    d          |           |dz  dz  }|                     t          |j        d           |                     |                    d	          |dz  dz             d S )
Nr,   012Tr  34F)
rr   r  r/  r  r   r  r   r  r   r?  )r   ru   r   r   s       r   test_resolve_dotz_BasePathTest.test_resolve_dotN  s    HHTNNS$s))$$$RW\\#s++T#YY777RW\\#s++T#YY777G$//333GcM+QYtDDD%00!c'C-@@@@@r   c                 h   |                      dd          }t          j                    }t          j        t                     	 |                     |                                |                      t          |                     t          j        |           d S # t          j        |           w xY w)Nnonexist)rr   r   rK  chdirr  r   r  )r   ru   old_cwds      r   )test_resolve_nonexist_relative_issue38671z7_BasePathTest.test_resolve_nonexist_relative_issue38671\  s    HHUG$$)++
	QYY[[$((4*;*;<<<HWBHWs   AB B1c                    |                      t                    }|                                }|                                }t          |           |                     t
                    5  |5  	 d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   t          |           t          |           |                                 |                                 |                                 |                     t
                    5  |5  	 d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S r   )	rr   r  r  r  assertWarnsDeprecationWarningrt  r  rT  )r   ru   r  it2s       r   	test_withz_BasePathTest.test_withf  s   HHTNNYY[[iikkS			011 	 	                	 	 	 	 	 	 	 	 	 	 	 	 	 	 	
 	RS				


				

011 	 	                	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	sl   ,B/A=1B=B	BB	BBBD<D$D<$D(	(D<+D(	,D<<E E c                    |                      t                    dz  }|                                j        }|dz  }|                    |           |                     |                                j        |           |dz  }|                    |           |                     |                                j        |           d S )Nr  m   )rr   r  rk  st_moder  r   )r   ru   modenew_modes       r   
test_chmodz_BasePathTest.test_chmodz  s    HHTNNW$vvxx&=	)8444%<	)844444r   c                    |                      t                    dz  }|                                }|                                j        }|dz  }|                    |d           |                     |                                j        |           |dz  }|                    |d           |                     |                                j        |           d S )Nr"  r!  Tfollow_symlinksr"  )rr   r  r  rk  r#  r  r   )r   ru   r   r$  r%  s        r   test_chmod_follow_symlinks_truez-_BasePathTest.test_chmod_follow_symlinks_true  s     HHTNNW$IIKKvvxx&=	$///)8444%<	$///)844444r   c                    |                      t                    dz  }|                                }|                     |                                |           |                    |j        dz             |                     |j        |j                   |                     |                                |           d S )Nr  r"  )rr   r  rk  r   r  r#  r)  r   r   ru   sts      r   	test_statz_BasePathTest.test_stat  s    HHTNNW$VVXX2&&&	
U"###,,,AFFHHb)))))r   c                     |                      t                    dz  }|                                }|                     ||                    d                     d S )Nr"  Fr(  )rr   r  rk  r   r,  s      r   test_stat_no_follow_symlinksz*_BasePathTest.test_stat_no_follow_symlinks  sM    HHTNNW$VVXXBu = =>>>>>r   c                     |                      t                    dz  }|                                }|                     ||                    d                     d S )Nr  Fr(  )rr   r  rk  r   r,  s      r   &test_stat_no_follow_symlinks_nosymlinkz4_BasePathTest.test_stat_no_follow_symlinks_nosymlink  sM    HHTNNW$VVXXQVVEV::;;;;;r   c                     |                      t                    dz  }|                                }|                     ||                                           d S )Nr"  )rr   r  rk  r   lstatr,  s      r   
test_lstatz_BasePathTest.test_lstat  sG    HHTNNG#VVXXB		*****r   c                     |                      t                    dz  }|                                }|                     ||                                           d S r  )rr   r  rk  r   r4  r,  s      r   test_lstat_nosymlinkz"_BasePathTest.test_lstat_nosymlink  sG    HHTNNW$VVXXQWWYY'''''r   z&the pwd module is needed for this testc                 H   |                      t                    dz  }|                                j        }	 t	          j        |          j        }n(# t          $ r |                     d|z             Y nw xY w| 	                    ||
                                           d S )Nr  z4user %d doesn't have an entry in the system database)rr   r  rk  st_uidpwdgetpwuidpw_nameKeyErrorr[  r   r  )r   ru   uidr  s       r   r	  z_BasePathTest.test_owner  s    HHTNNW$ffhho	N<$$,DD 	N 	N 	NMMFLN N N N N	N 	qwwyy)))))   A "A76A7z&the grp module is needed for this testc                 H   |                      t                    dz  }|                                j        }	 t	          j        |          j        }n(# t          $ r |                     d|z             Y nw xY w| 	                    ||
                                           d S )Nr  z5group %d doesn't have an entry in the system database)rr   r  rk  st_gidgrpgetgrgidgr_namer=  r[  r   r  )r   ru   gidr  s       r   r  z_BasePathTest.test_group  s    HHTNNW$ffhho	O<$$,DD 	O 	O 	OMMG#MO O O O O	O 	qwwyy)))))r?  c                     |                      t                    dz  }|                                 |                     |j                   |                     |j                   d S r  )rr   r  unlinkrF  rk  rt   s     r   test_unlinkz_BasePathTest.test_unlink  sU    HHTNNW$	


''')))))r   c                     |                      t                    dz  }|                     |j                   |                    d           d S )NfileAAAT)
missing_ok)rr   r  rF  rG  rt   s     r   test_unlink_missing_okz$_BasePathTest.test_unlink_missing_ok  sF    HHTNNY&)))	D!!!!!r   c                 &   |                      t                    dz  }|                                D ]}|                                 |                                 |                     |j                   |                     |j                   d S )Nr  )rr   r  r  rG  rmdirrF  rk  r  s      r   
test_rmdirz_BasePathTest.test_rmdir  s{    HHTNNV# 	 	AHHJJJJ				''')))))r   linkzos.link() is not presentc                    |                      t                    }|dz  }|                                j        }|dz  dz  }	 |                     t
                    5  |                    |           d d d            n# 1 swxY w Y   n/# t          $ r"}|                     d|z             Y d }~nd }~ww xY w| 	                    |                                j        |           | 	                    t          j                            ||          d           |                     |j                   t          d          }|                     t
                    5  |                    |           d d d            n# 1 swxY w Y   | 	                    t          j        |          j        |           |                     |j                   d S )Nr  r  fileAAzos.link(): %sTrJ  )rr   r  rk  st_sizer  r  link_toPermissionErrorr[  r   r   r  r9  r   rel_join)r   r|   ru   sizer   er   s          r   test_link_toz_BasePathTest.test_link_to  s   HHTNNKvvxxJ!	/!!"455  		!               	/ 	/ 	/MM/A-........	/)4000))!Q//666Y011 	 	IIaLLL	 	 	 	 	 	 	 	 	 	 	 	 	 	 	+T222sN   B
 A>2B
 >BB
 BB
 

B6B11B6E??FFc                    |                      t                    }|dz  }|                                j        }|dz  dz  }|                    |           |                     |                                j        |           |                     t          j        	                    ||                     |                     |
                                           |dz  dz  }t          d          }|                    |           |                     t          j        |          j        |           |                     |
                                           d S Nr  r  rR  rJ  )rr   r  rk  rS  hardlink_tor   r   r   r  r9  rt  rV  )r   r|   targetrW  rP  link2target2s          r   test_hardlink_toz_BasePathTest.test_hardlink_to  s   HHTNNW{{}}$6zH$   ,d333((66777(((F
Y&7##'"""))14888'''''r   zos.link() is presentc                     |                      t                    }|dz  }|dz  dz  }|                     t                    5  |                    |           d d d            d S # 1 swxY w Y   d S )Nr  r  rR  )rr   r  r   r  rT  r   r|   ru   r   s       r   test_link_to_not_implementedz*_BasePathTest.test_link_to_not_implemented
  s    HHTNNKJ!233 	 	IIaLLL	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   A%%A),A)c                    |                      t                    }|dz  }|                                j        }|dz  dz  }|                    |          }|                     ||           |                     |                                j        |           |                     |j                   t          d          }|                    |          }|                     ||                      |                     |                     t          j        |          j        |           |                     |j                   d S r[  )	rr   r  rk  rS  renamer   rF  rV  r   )r   r|   ru   rW  r   	renamed_pr   	renamed_qs           r   test_renamez_BasePathTest.test_rename  s   HHTNNKvvxxJ!HHQKK	A&&&)4000'''YHHQKK	DHHQKK000+T222'''''r   c                    |                      t                    }|dz  }|                                j        }|dz  dz  }|                    |          }|                     ||           |                     |                                j        |           |                     |j                   t          dd          }|                    |          }|                     ||                      |                     |                     t          j        |          j        |           |                     |j                   d S )Nr  r  rR  r  r  )	rr   r  rk  rS  r   r   rF  rV  r   )r   r|   ru   rW  r   
replaced_pr   
replaced_qs           r   test_replacez_BasePathTest.test_replace$  s   HHTNNKvvxxJ!YYq\\
Q''')4000'''VW%%YYq\\
TXXa[[111+T222'''''r   c                 B   |                      t                    }|                     |dz                                  |                      d                     |                     |dz                                  |                      d                     |                     |dz                                  |                      d                     |                     t
                    5  |dz                                   d d d            d S # 1 swxY w Y   d S )Nr"  r  r$  r#  r%  r  )rr   r  r   readlinkr   r  r   s     r   test_readlinkz_BasePathTest.test_readlink5  s=   HHTNN!g+//11488G3D3DEEE!l*4466.11	3 	3 	3!g+//11488F3C3CDDDw'' 	% 	%[""$$$	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	%s   /DDDc                 t   |                      t                    }|dz  }|                     |                                           |                                 |                     |                                           |                                }|j        }|j        }t          j
        t          |          |dz
  |dz
  f           |                                 |                                }|                     |j        |           |                     |j        |           |dz  }|                     |                                           |                    dd           |                     |                                           |                     t          |j        d           d S )NnewfileA
   newfileBi  F)r$  exist_okrt  )rr   r  r   rt  r  r   rk  st_mtimest_mtime_nsr   utimer   r  r   r  )r   r|   ru   r-  	old_mtimeold_mtime_nss         r   test_touch_commonz_BasePathTest.test_touch_common?  sa   HHTNN
N$$$				

###VVXXK	~ 	Q)b.)b.9:::				VVXX===Y777
N$$$	UU+++

###'17U;;;;;r   c                 <   |                      t                    }|dz  }|                                 |                    d          5 }|                     |                                                                d           d d d            d S # 1 swxY w Y   d S )Nr  rw  rx  )rr   r  r  r+  r   r|  r~  )r   r|   ru   r    s       r   test_touch_nochangez!_BasePathTest.test_touch_nochangeW  s    HHTNNK				VVD\\ 	BQQVVXX^^--/@AAA	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	Bs   	;BBBc                 6   |                      t                    }|dz  }|                     |                                           |                                 |                     |                                           |                     |                                           |                     t                    5 }|                                 d d d            n# 1 swxY w Y   | 	                    |j
        j        t          j                   d S )NnewdirA)rr   r  r   rt  r*  r   is_dirr   r  r   r@  rA  EEXIST)r   r|   ru   rE  s       r   
test_mkdirz_BasePathTest.test_mkdir^  s   HHTNN	M$$$				

###

###w'' 	2GGIII	 	 	 	 	 	 	 	 	 	 	 	 	 	 	+U\:::::s   C$$C(+C(c                    |                      t          dd          }|                     |                                           |                     t
                    5 }|                                 d d d            n# 1 swxY w Y   |                     |j        j	        t          j
                   |                    d           |                     |                                           |                     |                                           |                     t
                    5 }|                    d           d d d            n# 1 swxY w Y   |                     |j        j	        t          j                   t          j        |                                j                  }|                      t          dd          }|                    dd           |                     |                                           |                     |                                           t"          j        dk    rB|                     t          j        |                                j                  d	|z             |                     t          j        |j                                        j                  |           d S )
NnewdirBnewdirCTr  newdirDnewdirEim  r  im  )rr   r  r   rt  r   r  r*  r   r@  rA  rB  r   r  r  rk  S_IMODEr#  r   r  r   )r   ru   rE  r$  s       r   test_mkdir_parentsz _BasePathTest.test_mkdir_parentsi  s   HHT9i00$$$w'' 	2GGIII	 	 	 	 	 	 	 	 	 	 	 	 	 	 	+U\:::	

###

###w'' 	"2GGDG!!!	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	"+U\:::|AFFHH,--HHT9i00	t$$$

###

###7d??T\!&&((*:;;Vd]KKKahmmoo&=>>EEEEEs$   A??BB2EEEc                    |                      t          d          }|                                j        }|                     |                                           |                     |                                           |                     t                    5 }|	                                 d d d            n# 1 swxY w Y   | 
                    |j        j        t          j                   |	                    d           |                     |                                           | 
                    |                                j        |           d S )Nr  Tru  )rr   r  rk  st_ctimer   rt  r  r   FileExistsErrorr*  r   r@  rA  r  )r   ru   st_ctime_firstrE  s       r   test_mkdir_exist_okz!_BasePathTest.test_mkdir_exist_ok  s>   HHT6""*

###

###// 	2GGIII	 	 	 	 	 	 	 	 	 	 	 	 	 	 	+U\:::	

###*N;;;;;s   B>>CCc                    |                      t          d          }|                     |                                           |                     t
                    5 }|                                 d d d            n# 1 swxY w Y   |                     |j        j	        t          j
                   |dz  }|                    d           |                                j        }|                     |                                           |                     t
                    5 }|                    d           d d d            n# 1 swxY w Y   |                     |j        j	        t          j
                   |                    dd           |                     |                                           |                     |                                j        |           d S )Nr  r  Tr  r   rt  )rr   r  r   rt  r   r  r*  r   r@  rA  r  rk  r  )r   ru   rE  r  s       r   test_mkdir_exist_ok_with_parentz-_BasePathTest.test_mkdir_exist_ok_with_parent  s   HHT6""

###// 	2GGIII	 	 	 	 	 	 	 	 	 	 	 	 	 	 	+U\:::	M	*

###// 	"2GGDG!!!	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	"+U\:::	t,,,

###*N;;;;;s$   A>>BB(EEEz)FS root cannot be modified on Emscripten.c                     |                      d                                                              d           |                      d                                                              dd           d S )Nr   Tru  r  )rr   r  r*  r   s    r   test_mkdir_exist_ok_rootz&_BasePathTest.test_mkdir_exist_ok_root  sf     	%%t%444%%dT%BBBBBr   c                 4   dD ]0}|                      |dz             }|                                s n1|                     d           |                     t                    5  |dz  dz                      d           d d d            d S # 1 swxY w Y   d S )NZYXWVUTSRQPONMLKJIHGFEDCBAz:\z&cannot find a drive that doesn't existchildr  Tr  )rr   r  r[  r   r  r*  )r   r*   ru   s      r   test_mkdir_with_unknown_drivez+_BasePathTest.test_mkdir_with_unknown_drive  s    - 	D 	DAU##A88::  MMBCCCw'' 	7 	7[6!(((666	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7s   #BBBc                 V   |                      t          dd          }|                     |                                           |                     t
                    5 }|                    d           d d d            n# 1 swxY w Y   |                     |j        j	        t          j
                   |                     t
                    5 }|                    dd           d d d            n# 1 swxY w Y   |                     |j        j	        t          j
                   d S )Nr  r  Tr  r  rr   r  r   rt  r   r  r*  r   r@  rA  r  r  s      r   test_mkdir_with_child_filez(_BasePathTest.test_mkdir_with_child_file  si   HHT67++

### // 	"2GGDG!!!	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	"+U\:::// 	12GGD4G000	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1+U\:::::s$   BBBC44C8;C8c                 N   |                      t          d          }|                     |                                           |                     t
                    5 }|                                 d d d            n# 1 swxY w Y   |                     |j        j	        t          j
                   |                     t
                    5 }|                    d           d d d            n# 1 swxY w Y   |                     |j        j	        t          j
                   d S )Nr  Tru  r  r  s      r   test_mkdir_no_parents_filez(_BasePathTest.test_mkdir_no_parents_file  s^   HHT7##

### // 	2GGIII	 	 	 	 	 	 	 	 	 	 	 	 	 	 	+U\:::// 	#2GGTG"""	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	#+U\:::::s$   A>>BBC00C47C4c                    t          d          D ]P|                     t          dz            }|                     |                                           t
          j        dfd	}fdt          d          D             t                      |dz  dz  }	 t          j	        d	|          5  |                    d
d           d d d            n# 1 swxY w Y   | 
                    t          |                     n3# t          $ r& |                     t          |                     Y nw xY w|                     |                                           Rd S )N    zdirCPC%dr  c                     t          |           }                                 r! | |                               |             | |           d S r   )r   popadd)r  r$  concurrently_createdr  
real_mkdirs     r   my_mkdirzE_BasePathTest.test_mkdir_concurrent_parent_creation.<locals>.my_mkdir  s^    4yy ;;== 3JtT***(,,T222
4&&&&&r   c                 :    g | ]}t          d |z  z            S )r   )bool)r   npattern_nums     r   r   zG_BasePathTest.test_mkdir_concurrent_parent_creation.<locals>.<listcomp>  s*    FFFtK16233FFFr      dir1dir2zos.mkdirTFr  )r  )rD  rr   r  r   rt  r   r*  r  r   rR  assertNotInr   r  r  r   )r   ru   r  p12r  r  r  r  s       @@@@r   %test_mkdir_concurrent_parent_creationz3_BasePathTest.test_mkdir_concurrent_parent_creation  s    99 	( 	(KzK788AQXXZZ(((J
' 
' 
' 
' 
' 
' 
' 
' GFFFU1XXFFFG#&55 f*v%CAZ
H55 < <IIdUI;;;< < < < < < < < < < < < < < <
   S+?@@@@ # > > >c#hh(<=====> OOAHHJJ''''7	( 	(s6   "D
7CD
C	D
"C	#D

-D:9D:c                    |                      t                    }|dz  }|dz  dz  }|                    |           |                     |                                |                                           |                     |                                |                                           |dz  dz  }|                    t          |                     |                     |                                |                                           |                     |                                |                                           |                     |	                                           |dz  }|dz  dz  }|                    |d           |                     |                                |                                           |                     |                                |                                           | 
                    |	                                           | 
                    t          |                                                     d S )	Nr  r  linkAAlinkAAAr  linkAAAATr1  )rr   r  r  r   rk  r   r4  r   r   r  r   r   r  )r   r|   r]  rP  s       r   test_symlink_toz_BasePathTest.test_symlink_to  s   HHTNNW6zH$fkkmm444DJJLL&++--8886zI%F$$$fkkmm444DJJLL&++--888'''V6zJ&D999fkkmm444DJJLL&++--888&&&T\\^^,,-----r   c                 `   |                      t                    }|                     |dz                                             |                     |dz                                             |                     |dz                                             |                     |dz  dz                                             t          j                    r|                     |dz                                             |                     |dz                                             |                     |dz                                  d           |                     |d	z                                  d           |                     |d
z                                  d           d S )Nr  r  r#  rr  r"  r%  r$  Fu   dirAzdirA )rr   r  r   r  r   r   r-  r   r   s     r   test_is_dirz_BasePathTest.test_is_dir  sr   HHTNNV++--...!g+--//000!n,4466777!g+-5577888 "" 	@a'k1133444OOQ[0022333ao5577???q<'//115999q:~--//77777r   c                 ^   |                      t                    }|                     |dz                                             |                     |dz                                             |                     |dz                                             |                     |dz  dz                                             t          j                    r~|                     |dz                                             |                     |dz                                             |                     |dz                                             |                     |dz                                  d	           |                     |d
z                                  d	           d S )Nr  r  r#  rr  r"  r%  r$     fileAFfileA )rr   r  r   is_filer   r   r-  r   r   s     r   test_is_filez_BasePathTest.test_is_file	  so   HHTNNW--//000!f*--//000!n,5577888!g+-6688999 "" 	:OOQ[1133444a'k2244555ao6688999q=(1133U;;;q;//11599999r   c                 n   |                      t                    }|                      d          }|                     |dz                                             |                     |dz                                             |                     |dz                                             |                     |dz  dz                                             |                     |                                           t          j                    r*|                     |dz                                             |                     |                      d                                          d           |                     |                      d	                                          d           d S )
Nr   r  r  r#  rr  r"  u   /Fz/ )rr   r  r   is_mountr   r   r-  r   )r   r|   Rs      r   test_is_mountz_BasePathTest.test_is_mount	  sc   HHTNNHHSMM!g+//11222!f*..00111!n,6688999!g+-7799:::

%%% "" 	7a'k3355666dhhy))2244e<<<dhhw''0022E:::::r   c                 4   |                      t                    }|                     |dz                                             |                     |dz                                             |                     |dz                                             |                     |dz  dz                                             t	          j                    r~|                     |dz                                             |                     |dz                                             |                     |dz                                             |                     |dz                                  d	           |                     |d
z                                  d	           t	          j                    rX|                     |dz                                  d	           |                     |dz                                  d	           d S d S )Nr  r  r#  rr  r"  r%  r$  r  Fr  u   linkAzlinkA )	rr   r  r   
is_symlinkr   r-  r   r   r  r   s     r   test_is_symlinkz_BasePathTest.test_is_symlink&	  s   HHTNN!g+1133444!f*0022333!n,88::;;;!g+-99;;<<< "" 	<OOQ[4466777OOQ[4466777OOQ_88::;;;q=(1133U;;;q;//115999 "" 	>MM1},5577???MM1{?3355u=====	> 	>r   c                 <   |                      t                    }|                     |dz                                             |                     |dz                                             |                     |dz                                             |                     |dz  dz                                             |                     |dz                                  d           |                     |dz                                  d           d S Nr  r  r#  rr  r  Fr  )rr   r  r   is_fifor   r   s     r   test_is_fifo_falsez _BasePathTest.test_is_fifo_false6	  s    HHTNN!g+..00111!f*--//000!n,5577888!g+-6688999q=(1133U;;;q;//11599999r   mkfifozos.mkfifo() requiredvxworksz%fifo requires special path on VxWorksc                    |                      t          d          }	 t          j        t	          |                     n/# t
          $ r"}|                     d|z             Y d }~nd }~ww xY w|                     |                                           | 	                    |
                                           | 	                    |                                           |                     |                      t          d                                          d           |                     |                      t          d                                          d           d S )Nmyfifozos.mkfifo(): %su	   myfifoFzmyfifo )rr   r  r   r  r   rU  r[  r   r  r   	is_socketr  r   )r   r|   rX  s      r   test_is_fifo_truez_BasePathTest.test_is_fifo_true?	  s/    HHT8$$	1Ic!ff 	1 	1 	1MM+a/00000000	1		$$$'''%%%dhht^44<<>>FFFdhht\22::<<eDDDDDs   !? 
A+	A&&A+c                 <   |                      t                    }|                     |dz                                             |                     |dz                                             |                     |dz                                             |                     |dz  dz                                             |                     |dz                                  d           |                     |dz                                  d           d S r  )rr   r  r   r  r   r   s     r   test_is_socket_falsez"_BasePathTest.test_is_socket_falseN	  s    HHTNN!g+0022333!f*//11222!n,7799:::!g+-88::;;;q=(3355u===q;1133U;;;;;r   AF_UNIXzUnix sockets requiredz/Unix sockets are not implemented on Emscripten.zCannot create socket on WASI.c                    |                      t          d          }t          j        t          j        t          j                  }|                     |j                   	 |                    t          |                     nb# t          $ rU}t          |t                    sdt          |          v r%|                     dt          |          z              Y d }~nd }~ww xY w|                     |                                           |                     |                                           |                     |                                           |                     |                      t          d                                          d           |                     |                      t          d                                          d           d S )NmysockzAF_UNIX path too longzcannot bind Unix socket: u	   mysockFzmysock )rr   r  socketr  SOCK_STREAMr)  closebindr   r  
isinstancerU  r[  r   r  r   r  r  r   )r   r|   sockrX  s       r   test_is_socket_truez!_BasePathTest.test_is_socket_trueW	  s    HHT8$$}V^V-?@@
###	DIIc!ff 	D 	D 	D1o.. D+s1vv559CFFBCCC	D 	&&&%%%%%%dhht^44>>@@%HHHdhht\22<<>>FFFFFs    "B 
C"ACC"c                 <   |                      t                    }|                     |dz                                             |                     |dz                                             |                     |dz                                             |                     |dz  dz                                             |                     |dz                                  d           |                     |dz                                  d           d S r  )rr   r  r   is_block_devicer   r   s     r   test_is_block_device_falsez(_BasePathTest.test_is_block_device_falsen	  s    HHTNN!g+6688999!f*5577888!n,==??@@@!g+->>@@AAAq=(99;;UCCCq;77995AAAAAr   c                 <   |                      t                    }|                     |dz                                             |                     |dz                                             |                     |dz                                             |                     |dz  dz                                             |                     |dz                                  d           |                     |dz                                  d           d S r  )rr   r  r   is_char_devicer   r   s     r   test_is_char_device_falsez'_BasePathTest.test_is_char_device_falsew	  s    HHTNN!g+5577888!f*4466777!n,<<>>???!g+-==??@@@q=(88::EBBBq;6688%@@@@@r   c                 X   |                      d          }|                                s|                     d           |                     |                                           |                     |                                           |                     |                                           |                     |                      d                                          d           |                     |                      d                                          d           d S )Nz	/dev/nullz/dev/null requiredu   /dev/nullFz
/dev/null )	rr   rt  r[  r   r  r   r  r  r   r   s     r   test_is_char_device_truez&_BasePathTest.test_is_char_device_true	  s    HH[!!xxzz 	0MM.///((**+++**,,---%%%dhh011@@BBEJJJdhh//>>@@%HHHHHr   c                 B   |                      t          d          }t          dt          j        dz             D ]e}t          j        ||          }t          j        |          }|                     |                                |                                           fd S )Nr  r   r   )	rr   r  rD  rE  rF  rG  rH  r   rk  )r   ru   rI  rJ  r   s        r   rK  z"_BasePathTest.test_pickling_common	  s    HHT7##1f59:: 	2 	2E\!U++Ff%%BRWWYY1111	2 	2r   c                     | j         } |d          } |d          }|                     |j        d         |j        d                    |                     |j        d         |j        d                    d S )Nz/usr/bin/fooz/usr/local/binr   r   r   )rr   r   r   rb  s       r   test_parts_interningz"_BasePathTest.test_parts_interning	  sn    HAnAagaj!'!*---agaj!'!*-----r   c                    |                      t                    }|                     t          j                            dd          t          d                     |                     t          j                            dd          t          d                     |                     t          j                            dd          t          d                     |                     |t          d                     |dz                                  }|                     ||           |                     t          |          t                     |dz                                  }|                     ||           |                     t          |          t                     |dz                                  }|                     ||           |                     t          |          t                     |dz                                  }|                     ||           |                     t          |          t                     t          j
                    }t          j        t                     	 |                      d                                          }|                     ||           |                     t          |          t                     |                      d                                          }|                     ||           |                     t          |          t                     |                      d                                          }|                     ||           |                     t          |          t                     |                      d                                          }|                     ||           |                     t          |          t                     t          j        |           d S # t          j        |           w xY w)Nlink0link1r^  link3)rr   r  r/  r   r  r  r  r   rI  r   rK  r  )r   link0_targetr|   ru   old_paths        r   _check_complex_symlinksz%_BasePathTest._check_complex_symlinks	  sN   HHTNNRW\\'733T']]CCCRW\\'733T']]CCCRW\\'733T']]CCC\4==111 [!!##A  Q...[!!##A  Q...[!!##A  Q...[!!##A  Q... 9;;
	!!))++AQ"""$$SVVT222!!))++AQ"""$$SVVT222!!))++AQ"""$$SVVT222!!))++AQ"""$$SVVT222HXBHXs   FP, ,Qc                 :    |                      t                     d S r   )r  r  r   s    r   test_complex_symlinks_absolutez,_BasePathTest.test_complex_symlinks_absolute	  s    $$T*****r   c                 0    |                      d           d S )Nr,   )r  r   s    r   test_complex_symlinks_relativez,_BasePathTest.test_complex_symlinks_relative	  s    $$S)))))r   c                 l    |                      t          j                            dd                     d S )Nr  r  )r  r   r  r  r   s    r   &test_complex_symlinks_relative_dot_dotz4_BasePathTest.test_complex_symlinks_relative_dot_dot	  s,    $$RW\\&$%?%?@@@@@r   )T)hr5   r6   r7   __doc__rv   r   r  r/  r=  rF  rI  rL  rO  rU  rY  unittestskipIfr:  rc  ri  rl  r   rp  ru  r  r  r  r  r  r   skip_unless_symlinkr  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  skip_unless_working_chmodr&  
only_posixr*  r.  r0  r2  r5  r7  
skipUnlessr	  rB  r  rH  rL  rO  hasattrrY  r`  rc  rh  rl  ro  r{  r}  r  r  r  r  r   r  only_ntr  r  r  r  r  r  r  r  r  r  sysplatformr  r  r  r  r  r  r  rK  r  r  r  r  r  r8   r   r   r  r  e  sH       II,B B BB 
w$	< 	< 	< 	<	" 	" 	"* * *
; ; ;
M M M) ) )  Z Z Z,) ) ) X_tF  
- 
- 
-G G G(1 1 1
 X_W:;;, , <;,8 8 8"
B 
B 
BA A AR R R` ` `(B B B "* * #"*H H HL L L:%3 %3 %3N "9 9 #"9$. . ."9 9 9 ": : #":B "@ @ #"@& & & &
 9GF5":Q :Q #":Qx "A A #"A    ( (
5 
5 )(
5 (5 5 )( Z5 (* * )(* "? ? #"?
< < <
 "+ + #"+
( ( (
 XFGG* * HG* XFGG* * HG** * *" " "
* * * XV,,.HII    JI * XV,,.HII( ( JI(" X_WWR((*@AA  BA( ( ("( ( (" "% % #"%< < <0B B B	; 	; 	;F F F2
< 
< 
<< < <" X_]$OPPC C QPC
 7 7 W7
; 
; 
;
; 
; 
;( ( (< ". . #"..8 8 8: : : ; ; Z;> > > : : : XX..0FGGX_S\Y.;= =
E 
E= = HG
E< < < X335LMMX_H  X_0 G G   NMG B B BA A A	I 	I 	I2 2 2. . .' ' 'R "+ + #"+ "* * #"* "A A #"A A Ar   r  c                   .    e Zd Zej        Zd Zd Zd ZdS )PathTestc                     |                      d          }|                     t          |          t          j        dk    rt
          j        nt
          j                   d S r  )rr   r   r   r   r  rQ   r  r  rt   s     r   r  zPathTest.test_concrete_class	  sV    HHSMMd1gg#%7d??G8I	K 	K 	K 	K 	Kr   c                     t           j        dk    r'|                     t          t          j                   d S |                     t          t          j                   d S )Nr  )r   r  r   r  rQ   r  r  r   s    r   test_unsupported_flavourz!PathTest.test_unsupported_flavour	  sM    7d??173DEEEEE173FGGGGGr   c                     |                                  }|                     t          d          5  t          |                    d                     d d d            d S # 1 swxY w Y   d S )NzUnacceptable patternr$   )rr   assertRaisesRegexr   r   r  rt   s     r   test_glob_empty_patternz PathTest.test_glob_empty_pattern	  s    HHJJ##J0FGG 	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   #A  A$'A$N)	r5   r6   r7   rQ   Pathrr   r  r  r  r8   r   r   r  r  	  sN        
,CK K K
H H H    r   r  c                      e Zd Zej        Zd ZdddZ ej	        e
ped          d             Zd Z ej	        e
ped          d             Zej        d	             Zd
 Zd Z ej         eed          d           ej	        ej        dk    d          d                         Z ej	        ej        dk    d          d             ZdS )PosixPathTestc                    | j         }|                     t           |d                                                    d           |                     t           |d                                                    d           |                     t           |d                                                    d           |                     t           |d                                                    d           |                     t           |d                                                    d           |                     t           |d                                                    d           d S )Nr   r.   r-   r=   r<   r[   )rr   r   r   rT  r   s     r   test_absolutezPosixPathTest.test_absolute	  s;   HQQsVV__..//555QQtWW--//00$777QQvYY//1122F;;; 	QQtWW--//00$777QQuXX..00115999QQwZZ002233W=====r   Tr  c                     | j         | }|                     t                    5  t          |                    |                     d d d            d S # 1 swxY w Y   d S r   )rr   r   RuntimeErrorprintr  )r   r  r   r  s       r   _check_symlink_loopz!PosixPathTest._check_symlink_loop	  s    tx|,, 	( 	($,,v&&'''	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(s   #AAAz,umask is not implemented on Emscripten/WASI.c                    t          j        d          }|                     t           j        |           |                     t                    }|dz                      d          5  	 d d d            n# 1 swxY w Y   t          j        t          d                    }|                     t          j	        |j
                  d           t          j        d           |dz                      d          5  	 d d d            n# 1 swxY w Y   t          j        t          d                    }|                     t          j	        |j
                  d           d S )Nr   new_filer       other_new_file  )r   umaskr)  rr   r  r+  rk  r  r   r  r#  r   old_maskru   r-  s       r   test_open_modezPosixPathTest.test_open_mode	  s   
 8A;;(+++HHTNN*n""4(( 	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	WT*%%&&bj115999
""((.. 	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	WT*++,,bj11599999s$   'A55A9<A9:DDDc                 D   t          j                    }	 t          j        d           |                     d          }|                     t          |                                          d           t          j        |           d S # t          j        |           w xY w)Nr   r  z/spam)r   rK  r  rr   r   r   r  )r   current_directoryru   s      r   test_resolve_rootzPosixPathTest.test_resolve_root
  s    IKK	(HSMMM  AS--w777H&'''''BH&''''s   AB	 	Bc                 ,   t          j        d          }|                     t           j        |           |                     t                    }|dz                                   t          j        t          d                    }|                     t          j	        |j
                  d           t          j        d           |dz                                   t          j        t          d                    }|                     t          j	        |j
                  d           |dz                      d	           t          j        t          d                    }|                     t          j	        |j
                  d           d S )
Nr   r  r  r  r  r  masked_new_filei  )r$  )r   r  r)  rr   r  r  rk  r  r   r  r#  r  s       r   test_touch_modezPosixPathTest.test_touch_mode
  sA   
 8A;;(+++HHTNN	
Z   WT*%%&&bj115999
	
	$$&&&WT*++,,bj115999	
	%%5%111WT+,,--bj11599999r   c                    t          j        dt          d                     |                     t          d           t          j        dt          d                     |                     t          d           t          j        dt          d                     |                     t          d           |                     t          ddd           t          j        t          d	          t          d
                     |                     t          d
           t          j        t          d          t          d                     |                     t          d           t          j        t          d          t          d                     |                     t          d           |                     t          ddd           d S )NzlinkX/insider  r  zlinkZ/../linkZlinkZre  Fr  zlinkU/insidelinkUlinkVzlinkW/../linkWlinkW)r   r.  r  r  r  r   s    r   test_resolve_loopzPosixPathTest.test_resolve_loop'
  sp    	
>4==111  w///

7DMM***  w///

#T']]333  w///  we DDD

4''g777  w///

4==$w--000  w///

4())4==999  w///  we DDDDDr   c                 z   | j         } |t                    }t          |                    d                    }t	          j        t                    st                      n|}|                     ||           |                     t          |                    d                    t                                 d S )NFILEazFILEa*)rr   r  r  r  r   fs_is_case_insensitiver   r   r|   ru   r  r  s        r   	test_globzPosixPathTest.test_glob<
  s    HAdGGAFF7OO$$'>tDDO%'''QVVH--..66666r   c                 |   | j         } |t          d          }t          |                    d                    }t	          j        t                    st                      n|}|                     ||           |                     t          |                    d                    t                                 d S )Nr  FILEdzFILEd*)rr   r  r  r  r   r$  r   r%  s        r   
test_rglobzPosixPathTest.test_rglobD
  s    HAdFOOAGGG$$%%'>tDDO%'''QWWX..//77777r   getpwallz%pwd module does not expose getpwall()r  zno home directory on VxWorksc                    | j         }t          j        d           dd l} |j        t          j                              }|j        }|j        	                    d          pd} |j
                    D ]-}|j        }|j        	                    d          }||k    r|r n.|}|}d}	  |j        |          r|dz  } |j        |          n# t          $ r Y nw xY w |d          }	 |d| d          }
 |d| d          } |d	| d          } |d
| d          } |d          } |d| d          }t          j                    5 }|                    dd            |                     |	                                 ||          dz             |                     |
                                 ||          dz             |                     |                                 ||          dz             |                     |                                |           |                     |                                |           |                     |                                |           |                     t&          |j                   d|d<   |                     |	                                 |d                     |                     |
                                 ||          dz             |                     |                                 ||          dz             |                     |                                |           |                     |                                |           |                     |                                |           |                     t&          |j                   d d d            d S # 1 swxY w Y   d S )Nr:  r   r   fakeuserr  z~/DocumentsrW  z
/Documentsro  rn  r$   r_  	Documentsz/tmpz/tmp/Documents)rr   r   import_moduler:  r;  r   getuidr<  pw_dirrstripr*  getpwnamr=  r   r`  r  r   rX  r   r	  )r   r|   r:  pwdentusernameuserhome	othername	otherhomefakenamep1p2p3p4p5p6p7rb  s                    r   test_expanduserzPosixPathTest.test_expanduserL
  s$   
 H#E***


bikk**>='',,3"clnn 	! 	!FI,,S11IH$$$ I I	#,x((  C #,x((   	 	 	D	 Q}Q'8'''((Q(9((())Q*h***++Q(H((())QrUUQ'8'''((*,, 	;GGFD!!!R]]__aakkK.GHHHR]]__aakkK.GHHHR]]__aa	ll[.HIIIR]]__b111R]]__b111R]]__b111lBM::: CKR]]__aa0@.A.ABBBR]]__aakkK.GHHHR]]__aa	ll[.HIIIR]]__b111R]]__b111R]]__b111lBM:::%	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	;s%   (%C 
CCJO  O$'O$darwinz1Bad file descriptor in /dev/fd affects only macOSc                 r   	 t          t          j        d                              d                    dd          }|s|                     d           |D ]}|                                 |                                 |                                 |                                 |	                                 |
                                 |                                 |                                 d S # t          $ r0}|j        t          j        k    r|                     d            d }~ww xY w)Nz/dev/fdr  r   z.no file descriptors - issue was not reproducedz Bad file descriptor not handled.)r   rQ   r  r  r[  rt  r  r  r  r  r  r  r  r  rA  EBADFfail)r   file_descriptorsr    rX  s       r   test_handling_bad_descriptorz*PosixPathTest.test_handling_bad_descriptor
  s'   	#GL$;$;$A$A#$F$FGGK# PNOOO &  





		!!###  """		   	 	 	w%+%%		<===	s   C8C< <
D6+D11D6N)r5   r6   r7   rQ   r  rr   r  r  r  r  r   r   r  r  r  r   r  r!  r&  r)  r  r  r:  r  r  r@  rF  r8   r   r   r  r  	  s       

C	> 	> 	> 15 ( ( ( ( (
 X_ 6 : :	 :( ( ( X_ 6 : :	 : "E E #"E(7 7 78 8 8 Xj11@B BX_S\Y.35 53; 3;5 5B B3;j X_S\X-HJ J J J  r   r  c                   4    e Zd Zej        Zd Zd Zd Zd Z	dS )WindowsPathTestc           
         | j         }|                     t           |d                                                    d           |                     t           |d                                                    d           |                     t           |d                                                    d           d}|                     t           ||                                                    |           |                     t           ||dz                                                       |dz              |                     t           ||dz                                                       |dz              t	          j        d          5 }||_        |                     t           |                                                      |           |                     t           |d                                                    |           |                     t           |d                                                    t          j        	                    |d                     |                     t           |dd	d
                                                    t          j        	                    |dd	d
                     d d d            d S # 1 swxY w Y   d S )NrY   r@   re   z\\server\share\r%   rd   rQ  r,   r'   r+   )
rr   r   r   rT  r   rR  rS  r   r  r  )r   r|   sharerK  s       r   r  zWindowsPathTest.test_absolute
  s   H 	QQvYY//1122F;;;QQwZZ002233W===QQz]]335566
CCC &QQuXX..00115999QQus{^^446677EEEQQuv~..7799::EFNKKK Z$$ 	A"'FS00%888S3!2!233U;;;S3!2!233RW\\%5M5MNNNS3S!1!1!:!:!<!<==W\\%c3??A A A	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	As   D?K**K.1K.c           
         | j         } |t                    }|                     t          |                    d                     |t          d          h           |                     t          |                    d                     |t          d          h           |                     t          |                    d                     |t          d          h           |                     t          t          t          |                    d                              | dh           |                     t          t          t          |                    d                              | dh           d S )Nr#  r  z*a\r  zF*az\FILEaz\fileA)rr   r  r   r  r  mapr   r{   s      r   r&  zWindowsPathTest.test_glob
  s3   HAdGGQVVG__--41A1A/CDDDQVVF^^,,$.ABBBQVVE]]++qqw/?/?-ABBBSaffWoo6677Q---IIISaffUmm44551GGGGGr   c           
         | j         } |t          d          }|                     t          |                    d                     |t          d          h           |                     t          |                    d                     |t          d          h           |                     t          t          t          |                    d                              | dh           d S )Nr  r(  r  z*\r  z\dirD\FILEd)rr   r  r   r  r  rL  r   r{   s      r   r)  zWindowsPathTest.test_rglob
  s    HAdFOOQWWW--..!!D:K2L2L0NOOOQWWU^^,,$0D0D.FGGGSaggg&6&67788a;N;N;N:OPPPPPr   c           
      `   	  j         t          j                    5                     dd                                dd                                dd                                dd            dd<    d           d           d	           d
           d           d          	                     t
          j                                        t
          j                                        t
          j                                                                                                                                                                        	                                	           	 f	d}dd<    |             dd<   dd<    |                                 dd                                dd            dd<    |             dd<    |             d d d            d S # 1 swxY w Y   d S )Nr_  r]  HOMEPATH	HOMEDRIVEaliceUSERNAMEz~/My Documentsz~alice/My Documentsz~bob/My Documentsz/~/My Documentszd:~/My Documentsr$   c                    	                      dd                                                                  d                                         t          j                   dd<                                                         d                                                                           d                                                                                                                                                                                                                  d S )NrR  zC:/Users/alice/My DocumentsrQ  zC:/Users/bob/My Documents)r  r   rX  r   r	  )	r|   rb  r9  r:  r;  r<  r=  r>  r   s	   r   r3   z.WindowsPathTest.test_expanduser.<locals>.check
  s1   
D)))  !"#@!A!AC C C!!,>>>")J  !"#@!A!AC C C  !"#>!?!?A A A  "555  "555  "55555r   zC:\Users\alicezC:\zUsers\alicezC:\Users\eve)rr   r   r`  r  r   r	  rX  r   )
r   r3   r|   rb  r9  r:  r;  r<  r=  r>  s
   ` @@@@@@@@r   r@  zWindowsPathTest.test_expanduser
  s   H*,, 1	GGFD!!!GGM4(((GGJ%%%GGK&&&%C
O #$$B())B&''B$%%B%&&B2BlBM:::lBM:::lBM:::R]]__b111R]]__b111R]]__b1116 6 6 6 6 6 6 6 6 6 6 6 6 1C
OEGGG%C,C
OEGGGGGK&&&GGJ%%%!3CEGGG +CKEGGGc1	 1	 1	 1	 1	 1	 1	 1	 1	 1	 1	 1	 1	 1	 1	 1	 1	 1	s   G2H##H'*H'N)
r5   r6   r7   rQ   r  rr   r  r&  r)  r@  r8   r   r   rH  rH  
  sa        

CA A A2H H HQ Q Q3 3 3 3 3r   rH  c                   8    e Zd ZdZ G d d          Zd Zd ZdS )CompatiblePathTestz|
    Test that a type can be made compatible with PurePath
    derivatives by implementing division operator overloads.
    c                   $    e Zd ZdZd Zd Zd ZdS )CompatiblePathTest.CompatPathz
        Minimum viable class to test PurePath compatibility.
        Simply uses the division operator to join a given
        string and the string value of another object with
        a forward slash.
        c                     || _         d S r   )string)r   rY  s     r   __init__z&CompatiblePathTest.CompatPath.__init__  s     DKKKr   c                 F     t          |           | j         d|           S r   r   rY  r   r  s     r   __truediv__z)CompatiblePathTest.CompatPath.__truediv__  s(    4::66u66777r   c                 F     t          |           | d| j                   S r   r\  r]  s     r   __rtruediv__z*CompatiblePathTest.CompatPath.__rtruediv__  s(    4::6666777r   N)r5   r6   r7   r  rZ  r^  r`  r8   r   r   
CompatPathrW    sK        	 		! 	! 	!	8 	8 	8	8 	8 	8 	8 	8r   ra  c                 Z   t          j        d          |                     d          z  }|                     || j                   |                     |j        d           |                     t                    5  t          j        d          dz   d d d            d S # 1 swxY w Y   d S )Ntestrightz
test/rightrr  )rQ   r  ra  rz   r   rY  r   r   r   results     r   test_truedivzCompatiblePathTest.test_truediv  s    !&))DOOG,D,DDfdo666555y)) 	* 	*V$$r))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	*   ;B  B$'B$c                 Z   |                      d          t          j        d          z  }|                     || j                    |                     |j        d           |                     t                    5  dt          j        d          z   d d d            d S # 1 swxY w Y   d S )Nleftrc  z	left/testrr  )ra  rQ   r  rz   r   rY  r   r   re  s     r   test_rtruedivz CompatiblePathTest.test_rtruediv  s    ((7+;F+C+CCfdo666444y)) 	* 	*!&))))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	*rh  N)r5   r6   r7   r  ra  rg  rk  r8   r   r   rU  rU     sd         
8 8 8 8 8 8 8 8 * * ** * * * *r   rU  __main__)4r  collections.abcr  rz  r   r  rA  rQ   rE  r  rk  r
  r  r   test.supportr   r   r   r   test.support.os_helperr   r	   rB  r:  ImportErrorobjectr   TestCaser:   rT   rj   rM  rq  r  r  realpathr  r  rV  r  r  r  r  r  r  r  r  r  rH  rU  r5   mainr8   r   r   <module>ru     s           				 				 



              & & & & & & / / / / / / / / " " " " " " 3 3 3 3 3 3 3 3OOOOOOOO   C###&; &; &; &; &;v &; &; &;R!: !: !: !: !:'): !: !: !:H;6 ;6 ;6 ;6 ;6$h&7 ;6 ;6 ;6DX. X. X. X. X. X. X. X.vI& I& I& I& I&)8+< I& I& I&XX@ X@ X@ X@ X@+X-> X@ X@ X@t    $h&7   > 
w((..
(/"'T/EG GX_RW_FH H
     +    	    /   	iA iA iA iA iAF iA iA iAX#    }h/   ( t t t t tM8#4 t t tn 	_ _ _ _ _mX%6 _ _ 	_D&* &* &* &* &** &* &* &*R zHMOOOOO s   A 	A)(A)