
    daf9'                        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 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 G d d	e      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jB                  jE                  e      Z#d Z$d Z% ejL                  ejN                  dk7  d      Z( ejL                  ejN                  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j:                        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ej:                        Z1 G d' d(e,ej:                        Z2 G d) d*ej:                        Z3e4d+k(  r ejj                          yy# e$ r dxZZY w xY w),    N)mock)import_helper)set_recursion_limit)is_emscriptenis_wasi)	os_helper)TESTFNFakePathc                   $     e Zd Z fdZd Z xZS )_BasePurePathSubclassc                ,    t        |   |  || _        y N)super__init__
session_id)selfr   pathsegments	__class__s      ,/root/Python-3.12.4/Lib/test/test_pathlib.pyr   z_BasePurePathSubclass.__init__    s    ,'$    c                 8     t        |       |d| j                  iS )Nr   )typer   )r   r   s     r   with_segmentsz#_BasePurePathSubclass.with_segments$   s    tDz<DDOODDr   )__name__
__module____qualname__r   r   __classcell__)r   s   @r   r   r      s    %Er   r   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% Z%d& Z&d' Z'd( Z(d) Z)d* Z*y+),_BasePurePathTest)
ab)a/r"   )r!   b/)r#   r$   a/b/)za//b)za//b//) r!   r"   )r!   r'   r"   )r!   r"   r'   ))r!   /b/cd)/ar(   r)   )/r"   r'   c/d)r+   r'   zb/c/d)r'   /b/c/d)a/br-   c                     | j                  d      }|j                  | _        | j                  j                  | _        | j                  j                  | _        y Nr!   )cls_flavourflavoursepaltsepr   ps     r   setUpz_BasePurePathTest.setUp:   s<    HHSMzz<<##ll))r   c           	      `   | j                   } |d      }| j                  ||        |ddd        |ddd        |d        |d        |t        d             | j                   | |d             |d             | j                   | |d      d       |d             | j                   | |d       |d             |d             | j                   | |d       |d       |d             |t        d                   | j                   | |d             |d             y )	Nr!   r"   cr*   a/b/c/a/b/cr.   ./a:b)r1   assertIsInstancer
   assertEqualr   Pr7   s      r   test_constructor_commonz)_BasePurePathTest.test_constructor_common@   s    HHcFa#	#sC	$S	'
	(	(7
1S6AcF+1S63521S61S6*AeH51S61S61S62Ahw6G4HI1W:'
3r   c                 F   | j                   }d}| j                  t        |      5   |d       d d d        | j                  t        |      5   |dd       d d d        | j                  t        |      5   |dd       d d d        | j                  t              5   |d      j	                  d       d d d        | j                  t              5   |d      dz   d d d        | j                  t              5  d |d      z   d d d        | j                  t              5   |d      j                  d       d d d        | j                  t              5   |d      j                  d       d d d        | j                  t              5   |d      j                  d       d d d        | j                  t              5   |d      j                  d       d d d        | j                  t              5   |d      j                  d       d d d        y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   qxY w# 1 sw Y   UxY w# 1 sw Y   -xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   y xY w)Nz^argument should be a str or an os\.PathLike object where __fspath__ returns a str, not 'bytes'   ar"   r!      b)
r1   assertRaisesRegex	TypeErrorassertRaisesjoinpathmatchrelative_to	with_name	with_stemwith_suffix)r   rA   messages      r   
test_bytesz_BasePurePathTest.test_bytesO   s6   HHB##Iw7 	dG	##Iw7 	dCL	##Iw7 	c4L	y) 	"cFOOD!	"y) 	cFTM	y) 	1S6M	y) 	cFLL	y) 	%cFt$	%y) 	#cFT"	#y) 	#cFT"	#y) 	%cFt$	% 	%)	 		 		 		" 	"	 		 		 		% 	%	# 	#	# 	#	% 	%s   	H
H$4
H1H>I9I"I%I2I?J6JH!$H.1H;>III"%I/2I<?JJJ c                      G d dt               | j                  } |fd|D         }| j                  | ||        |j                  D ]!  }| j	                  t        |      t                # y )Nc                       e Zd Zy):_BasePurePathTest._check_str_subclass.<locals>.StrSubclassNr   r   r    r   r   StrSubclassrS   n       r   rV   c              3   .   K   | ]  } |        y wr   rU   ).0xrV   s     r   	<genexpr>z8_BasePurePathTest._check_str_subclass.<locals>.<genexpr>q   s     -1A-s   )strr1   r?   partsassertIsr   )r   argsrA   r7   partrV   s        @r   _check_str_subclassz%_BasePurePathTest._check_str_subclassj   sa    	# 	HH--.AtH%GG 	+DMM$t*c*	+r   c                     | j                  d       | j                  d       | j                  d       | j                  d       | j                  d       y )Nr'   .r!   za/b.txtz/a/b.txtra   r   s    r   test_str_subclass_commonz*_BasePurePathTest.test_str_subclass_commonv   sH      $  %  %  +  ,r   c                 t    G d dt         | j                        } |ddd      }| j                  d|dz  j                         | j                  dd|z  j                         | j                  d|j	                  d      j                         | j                  d|j                  d      j                         | j                  d|j                  d      j                         | j                  d|j                  d      j                         | j                  d|j                  d      j                         | j                  d|j                  d      j                         | j                  d|j                  j                         |j                  D ]  }| j                  d|j                           y )Nc                       e Zd Zy)6_BasePurePathTest.test_with_segments_common.<locals>.PNrT   rU   r   r   rA   ri   ~   rW   r   rA   foobar*   r   z.foo)r   r1   r?   r   rI   rL   rM   rN   r   rK   parentparents)r   rA   r7   rn   s       r   test_with_segments_commonz+_BasePurePathTest.test_with_segments_common}   sT   	%txx 	eUr*a%i334eai334QZZ.99:Q[[/::;Q[[/::;Q]]62==>Q__U3>>?Q]]51<<=QXX001ii 	4FR!2!23	4r   c                 f     | j                   | }|j                  |j                  |j                  fS r   )r1   driverootr]   )r   r]   paths      r   _get_drive_root_partsz'_BasePurePathTest._get_drive_root_parts   s+    txxzz499djj00r   c           	      z   | j                   j                  }| j                  |D cg c]  }|j                  d|       c}      }| j	                  ||       | j                   j
                  x}rB| j                  |D cg c]  }|j                  d|       c}      }| j	                  ||       y y c c}w c c}w Nr+   )r3   r4   ru   replacer?   r5   )r   argexpectedr4   rZ   actualr5   s          r   _check_drive_root_partsz)_BasePurePathTest._check_drive_root_parts   s    ll++#,NQQYYsC-@,NO*\\(((6(//QT0UA31G0UVFVX. ) -O 1Vs   B3?B8c                    | j                   }| 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ddd	        |dddd        |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f       y )NrU   r'   )r!   )r#   r    r.   r%   )r!   zb/cr)   )r!   r"   r:   r)   )r!   zb//cr)   )r!   zb/c/r)   )rc   )rc   rc   r"   )r"   )r!   rc   r"   )r!   rc   rc   )/a/br!   r"   )r*   r"   )/a/r"   r!   /br:   r:   )r!   r   /c)r|   r3   r4   )r   checkr4   s      r   test_drive_root_parts_commonz._BasePurePathTest.test_drive_root_parts_common   s<   ,,llbBB/fBF3gBF3jBJ7hBJ7iBJ7B,@A B,@A B,@AfBB/oBF3oBJ7oBF3iBc3_=kBc3_=lBc3_=Bc3_=Bc3Z8r   c                    | j                   } |d      }|j                  d      }| j                  | |d             | j                  t	        |      t	        |             |j                  dd      }| j                  | |d             |j                   |d            }| j                  | |d             |j                  d      }| j                  | |d             y )Nr.   r:   r;   r)   a/b/c/dr   )r1   rI   r?   r^   r   r   rA   r7   pps       r   test_join_commonz"_BasePurePathTest.test_join_common   s    HHeHZZ_QwZ(d2hQ(ZZS!Qy\*ZZ#QwZ(ZZQtW%r   c                    | j                   } |d      }|dz  }| j                  | |d             | j                  t        |      t        |             |dz  }| j                  | |d             |dz  dz  }| j                  | |d             d|z  dz  }| j                  | |d             | |d      z  }| j                  | |d             |dz  }| j                  | |d             y )	Nr.   r:   r;   r,   r   r)   zc/a/b/dr   )r1   r?   r^   r   r   s       r   test_div_commonz!_BasePurePathTest.test_div_common   s    HHeHWQwZ(d2hQ(YQy\*Ws]Qy\*1Ws]Qy\*3ZQwZ(WQtW%r   c                      | j                   | }| j                  t        |      |j                  d| j                               y rw   )r1   r?   r\   rx   r4   )r   rz   r_   r7   s       r   
_check_strz_BasePurePathTest._check_str   s6    DHHdOQ!1!1#txx!@Ar   c                 \    dD ]  }| j                  ||f        | j                  dd       y )Nr!   r.   r;   r+   r   r<   rc   )r'   )r   )r   pathstrs     r   test_str_commonz!_BasePurePathTest.test_str_common   s1    C 	1GOOGgZ0	1 	U#r   c                 v    | j                   }dD ](  }| j                   ||      j                         |       * y )Nr   )r1   r?   as_posix)r   rA   r   s      r   test_as_posix_commonz&_BasePurePathTest.test_as_posix_common   s7    HHC 	=GQwZ002G<	=r   c                     t        j                  | j                        }| j                  }| j	                  t         |d            d|z   dz          y )Nr.   rD   rE   )osfsencoder4   r1   r?   bytes)r   r4   rA   s      r   test_as_bytes_commonz&_BasePurePathTest.test_as_bytes_common   s>    kk$((#HHqx$*t*;<r   c                    | j                   }| j                  t              5   |d      j                          d d d        | j                  t              5   |       j                          d d d        y # 1 sw Y   =xY w# 1 sw Y   y xY wr0   )r1   rH   
ValueErroras_urir   rA   s     r   test_as_uri_commonz$_BasePurePathTest.test_as_uri_common   sn    HHz* 	cFMMO	z* 	CJJL	 		 		 	s   A5B5A>B
c                    dD ]  }| j                  |      5  | j                  |      }|j                  j                  }t	        |      }| j                  |j                  |dz         |       | j                  |j                  d      |       |t        |      dz   d }| j                  t        |      |j                                d d d         y # 1 sw Y   xY w)Nr   r   ()   )subTestr1   r   r   repr
assertTrue
startswithendswithlenr?   evalr   )r   r   r7   clsnamerinners         r   test_repr_commonz"_BasePurePathTest.test_repr_common   s    C 		<Gg. <HHW%++..GWs] ;Q?

33#g,*R0  eajjl;< <		<< <s   B2CC	c                 r   dD ]  }| j                  |      5  | j                  |      }t        |      }t        |t        j
                        }| j                  |j                  |j                         | j                  ||       | j                  t        |      |       d d d         y # 1 sw Y   xY w)Nr   r   )	r   r1   r   r   pathlib__dict__r^   r   r?   )r   r   r7   r   qs        r   test_repr_roundtripsz&_BasePurePathTest.test_repr_roundtrips   s    C 	-Gg. -HHW%GG,,-akk1;;7  A&  a!,- -	-- -s   B
B--B6	c                 P   | j                   }| j                   |d       |d             | j                   |d       |dd             | j                   |d       |d             | j                   |d       |d             | j                   |d       |              | j                   |d       |d             | j                   |        |d             | j                   |       d       | j                   |       i        | j                   |       t               y )Nr.   r!   r"   r   r+   r'   )r1   r?   assertNotEqualintr   s     r   test_eq_commonz _BasePurePathTest.test_eq_common	  s    HH51U8,51S#;/AeHaf-AeHai0AeHac*AfIqv.AC3(AC$AC$AC%r   c                 
   | j                   }| j                  t         |d      j                  d       | j                  t         |d      j                  d       | j	                   |d      j                  d             | j	                   |d      j                  d             | j	                   |d      j                  d             | j                   |d      j                  d             | j                   |d      j                  d             | j                   |d	      j                  d             | j                   |d
      j                  d             | j	                   |d      j                  d             | j	                   |d      j                  d             | j	                   |d      j                  d             | j                   |d      j                  d             | j                   |d      j                  d             | j                   |d
      j                  d             | j	                   |d      j                  d             | j	                   |d      j                  d             | j                   |d      j                  d             | j                   |d      j                  d             | j                   |d      j                  d             | j	                   |d      j                  d             | j                   |d      j                  d             | j                   |d      j                  d             | j                   |d      j                  d             | j	                   |d      j                  d             | j                   |d      j                  d             | j                   |d      j                  d             | j                   |d      j                  d             | j	                   |d      j                  d             | j                   |d      j                  dd             | j	                   |d      j                  dd             | j                   |d      j                  d d             | j	                   |d      j                  d!d             | j                   |       j                  d"             | j	                   |       j                  d#             | j                   |       j                  d$             y )%Nr!   r'   rc   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A.pya.PYTcase_sensitiveF	c:/a/B.Py	C:/A/*.pYz	/A/*/*.Py*****/*)r1   rH   r   rJ   r   assertFalser   s     r   test_match_commonz#_BasePurePathTest.test_match_common  s   HH*afllB7*afllC8&	/0())&12)**6236016017))&128**623&	/0())&12)**6237))&127))&128**623)**956,--i89634;--i89;--i89'
((126128**7349++G45)**9568**956;--i89;--j9:+,,\:;6EF&	uEF;--k$-OP+,,[,OP3(		$(6*+r   c                      fd} j                   } |d      } |d      } |d      } |d      } |||        |||        |||        |||        |||        j                   } |d      } |d      } |d      } |d	      } |||        |||        |||        |||        |||        j                  t              5   |       i k   d d d        y # 1 sw Y   y xY w)
Nc                 N    j                  | |       j                  ||        y r   )
assertLessassertGreaterr!   r"   r   s     r   r   z:_BasePurePathTest.test_ordering_common.<locals>.assertLessG  s!    OOAq!q!$r   r!   r.   abcr"   r*   r   z/abcr   )r1   rH   rG   )r   r   rA   r!   r"   r:   r)   s   `      r   test_ordering_commonz&_BasePurePathTest.test_ordering_commonE  s    	% HHcFeHeHcF1a1a1a1a1aHHdGfIfIdG1a1a1a1a1ay) 	C"H	 	 	s   C""C+c                     | j                   }| j                  } |d      }|j                  }| j                  |d        |d      }|j                  }| j                  ||ddf       y )Nr.   r    r   r!   r"   )r4   r1   r]   r?   )r   r4   rA   r7   r]   s        r   test_parts_commonz#_BasePurePathTest.test_parts_commona  s^    hhHHeH
+fIc30r   c                     | j                   } |d      }| j                  |j                         d       | j                  t        j                  |      d       y )Nr.   r~   )r1   r   
__fspath__r   fspathr@   s      r   test_fspath_commonz$_BasePurePathTest.test_fspath_commonm  s>    HHeH1		!h/r   c           	           j                   j                         D ]"  \  }}|j                  d j                        }|j                   j                  d      }||k7  r7||D cg c]  }t	         fd|D               c}z   }|j                  |f        j                  |      }|D ]  }  j                  | } j                  ||dj                  |              j                  t        |      t        |              j                  t        |      |        j                  |j                         |        % y c c}w )Nr+   c              3   V   K   | ]   }|j                  d j                         " yw)r+   N)rx   r4   )rY   r`   r   s     r   r[   z6_BasePurePathTest.test_equivalences.<locals>.<genexpr>y  s      D$$,,sDHH5Ds   &)zfailed with args {})equivalencesitemsrx   r4   tupleappendr1   r?   formathashr\   r   )r   ktuplescanonposixtpcanonr7   s   `       r   test_equivalencesz#_BasePurePathTest.test_equivalencess  s   **002 	6IAvIIc488,EIIdhh,E~## D!DD#  ui(XXe_F 6DHHaL  F,A,H,H,KL  a$v,7  Q/  u56	6#s   %Ec                 H   | j                   } |d      }| j                  |j                   |d             | j                  |j                  j                   |d             | j                  |j                  j                  j                   |              | j                  |j                  j                  j                  j                   |               |d      }| j                  |j                   |d             | j                  |j                  j                   |d             | j                  |j                  j                  j                   |d             | j                  |j                  j                  j                  j                   |d             y )Nr;   r.   r!   r<   r   r*   r+   r1   r?   rn   r@   s      r   test_parent_commonz$_BasePurePathTest.test_parent_common  s   HHgJ1U8,!C&1//5//66<hK1V9-!D'2//38//66#?r   c                 \	   | j                   } |d      }|j                  }| j                  t        |      d       | j                  |d    |d             | j                  |d    |d             | j                  |d    |d             | j                  |d	    |d             | j                  |d
    |d             | j                  |d    |d             | j                  |dd  |d      f       | j                  |d d  |d       |d      f       | j                  |d d	  |d       |d      f       | j                  |dd   |d       |d      f       | j                  |d d d    |d       |d      f       | j                  |d d d	    |d       |d       |d      f       | j                  t	        |       |d       |d       |d      g       | j                  t              5  |d    d d d        | j                  t              5  |d    d d d        | j                  t              5  ||d<   d d d         |d      }|j                  }| j                  t        |      d       | j                  |d    |d             | j                  |d    |d             | j                  |d    |d             | j                  |d	    |d             | j                  |d
    |d             | j                  |d    |d             | j                  |dd  |d      f       | j                  |d d  |d       |d      f       | j                  |d d	  |d       |d      f       | j                  |dd   |d       |d      f       | j                  |d d d    |d       |d      f       | j                  |d d d	    |d       |d       |d      f       | j                  t	        |       |d       |d       |d      g       | j                  t              5  |d    d d d        | j                  t              5  |d    d d d        y # 1 sw Y   pxY w# 1 sw Y   ZxY w# 1 sw Y   DxY w# 1 sw Y   TxY w# 1 sw Y   y xY w)Nr;      r   r.   r   r!      rc   r   r<   r   r*   r+   )r1   ro   r?   r   listrH   
IndexErrorrG   r   rA   r7   pars       r   test_parents_commonz%_BasePurePathTest.test_parents_common  sJ   HHgJiiS1%Q5*Q3(Q3(R!C&)R!C&)R!E(+QqAeH;/Ra1U8QsV"45SbAeHaf#56QR1S61S6"23SqSAeHaf#56TrTQsVQsVQuX$>?cQuXqvqv$>?z* 	G	z* 	F	y) 	CF	 hKiiS1%Q6+Q4)Q3(R!C&)R!D'*R!F),QqAfI<0Ra1V9ag"67SbAfIqw#78QR1T7AcF"34SqSAfIqv#67TrTQsVQtWai$@AcQvY$3$@Az* 	G	z* 	F	 	3	 		 		 	&	 		 	s<   ;Q/Q<R	=R R"/Q9<R	RR"R+c                     | j                   }| j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       y )Nr.   r'   r   r1   r?   rr   r   s     r   test_drive_commonz#_BasePurePathTest.test_drive_common  sS    HH5,6"-2b)r   c                 D   | j                   }| j                  }| j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  |       | j                   |d      j                  |       y Nr'   r.   r+   r   )r1   r4   r?   rs   r   rA   r4   s      r   test_root_commonz"_BasePurePathTest.test_root_common  st    HHhh2R(5+3c*6-r   c                 D   | j                   }| j                  }| j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  |       | j                   |d      j                  |       y r   )r1   r4   r?   anchorr   s      r   test_anchor_commonz$_BasePurePathTest.test_anchor_common  sv    HHhh2r*5"-3,6))3/r   c                 <   | j                   }| j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d	       | j                   |d
      j                  d	       y )Nr'   rc   r+   r.   r"   r   /a/b/.r   r   r   r1   r?   namer   s     r   test_name_commonz"_BasePurePathTest.test_name_common  s    HH2R(3b)3b)5,6-8))3/8))629**F3r   c                    | j                   }| j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d	       | j                   |d
      j                  d	       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       y )Nr'   rc   ..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.r1   r?   suffixr   s     r   test_suffix_commonz$_BasePurePathTest.test_suffix_common  s   HH2r*3+4,3+5"-6))2.8++R08++U39,,e49,,b1:--r2:--u5;..6<//7=)00%8<=DDbI=>EErJr   c                 l   | j                   }| j                   |d      j                  g        | j                   |d      j                  g        | j                   |d      j                  g        | j                   |d      j                  g        | j                   |d      j                  g        | j                   |d      j                  g        | j                   |d      j                  dg       | j                   |d	      j                  dg       | j                   |d
      j                  g        | j                   |d      j                  g        | j                   |d      j                  dg       | j                   |d      j                  dg       | j                   |d      j                  ddg       | j                   |d      j                  ddg       | j                   |d      j                  g        | j                   |d      j                  g        y )Nr'   rc   r+   r.   r   r   r   r  r   r  r  r	  r
  r  r  .tarr  r  r  r  r1   r?   suffixesr   s     r   test_suffixes_commonz&_BasePurePathTest.test_suffixes_common  s   HH2,3"-3"-5**B/6++R08--r28--w79..89..3://4://%9;005':<11FE?C=)22VUOD<=FFK=>GGLr   c                    | j                   }| j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d	       | j                   |d
      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       y )Nr'   rc   r  r+   r.   r"   r   r  .hgrcr	  .hgr  b.tarr  Some name. Ending with a dot.r1   r?   stemr   s     r   test_stem_commonz"_BasePurePathTest.test_stem_common  s
   HH2R(3b)4t,3b)5,8))3/9**G4:++U3<--w7<=BB8	:r   c                    | j                   }| j                   |d      j                  d       |d             | j                   |d      j                  d       |d             | j                   |d      j                  d       |d             | j                   |d      j                  d       |d             | j                   |d      j                  d       |d             | j                   |d	      j                  d       |d             | j                  t         |d
      j                  d       | j                  t         |d      j                  d       | j                  t         |d      j                  d       | j                  t         |d      j                  d
       | j                  t         |d      j                  d       | j                  t         |d      j                  d       | j                  t         |d      j                  d       | j                  t         |d      j                  d       y )Nr.   d.xmlza/d.xmlr   z/a/d.xmlr   r   a/Dot ending./a/Dot ending.r'   rc   r+   r   c/r,   )r1   r?   rL   rH   r   r   s     r   test_with_name_commonz'_BasePurePathTest.test_with_name_common  s   HH5++G4a	lC6,,W5q}E8..w79F9//8!J-H?+55g>)M+,66w?:O*aeoow?*af&6&6@*af&6&6@*ah&8&8"=*ah&8&8#>*ah&8&8$?*ah&8&8$?*ah&8&8%@r   c                    | j                   }| j                   |d      j                  d       |d             | j                   |d      j                  d       |d             | j                   |d      j                  d       |d             | j                   |d      j                  d       |d	             | j                   |d
      j                  d       |d             | j                   |d      j                  d       |d             | j                   |d      j                  d       |d             | j                  t         |d      j                  d       | j                  t         |d      j                  d       | j                  t         |d      j                  d       | j                  t         |d      j                  d       | j                  t         |d      j                  d       | j                  t         |d      j                  d       | j                  t         |d      j                  d       | j                  t         |d      j                  d       y )Nr.   r)   za/dr   z/a/dr   za/d.pyr   z/a/d.pyr  z/a/d.gzr#  r$  r'   rc   r+   r   r%  r,   )r1   r?   rM   rH   r   r   s     r   test_with_stem_commonz'_BasePurePathTest.test_with_stem_common*  s   HH5++C0!E(;6,,S11V9=8..s3Qx[A9//4a	lC=)33C8!I,G?+55c:AeHE+,66s;QvYG*aeoos;*af&6&6<*af&6&6<*ah&8&8"=*ah&8&8#>*ah&8&8$?*ah&8&8$?*ah&8&8%@r   c                    | j                   }| j                   |d      j                  d       |d             | j                   |d      j                  d       |d             | j                   |d      j                  d       |d             | j                   |d      j                  d       |d             | j                   |d      j                  d       |d             | j                   |d      j                  d       |d             | j                  t         |d      j                  d       | j                  t         |d	      j                  d       | j                  t         |d
      j                  d       | j                  t         |d      j                  d       | j                  t         |d      j                  d
       | j                  t         |d      j                  d	       | j                  t         |d      j                  d       | j                  t         |d      j                  d       | j                  t         |d      j                  d       | j                  t         |d      j                  d       | j                  t         |d      j                  d       | j                  t         |d      j                  | j
                  j                  df       y )Nr.   r  za/b.gzr   z/a/b.gzr   r   r'   rc   r+   gz/.gzr,   z.c/.dz./.dz.d/.r)   )r1   r?   rN   rH   r   r3   r4   r   s     r   test_with_suffix_commonz)_BasePurePathTest.test_with_suffix_common<  s?   HH5--e4akB6..u5q|D80078E911%8!I,G8004ah?6..r2AfI>*ae&7&7?*af&8&8%@*af&8&8%@*ah&:&:DA*ah&:&:C@*ah&:&:C@*ah&:&:FC*ah&:&:EB*ah&:&:GD*ah&:&:FC*ah&:&:FC*ah&:&:<<++S1	3r   c                    | j                   } |d      }| j                  t        |j                         | j                  t        |j                  d       | j	                  |j                   |              |d             | j	                  |j                  d       |d             | j	                  |j                   |d             |d             | j	                  |j                  d       |d             | j	                  |j                  d       |d             | j	                  |j                   |d             |              | j	                  |j                  d       |              | j	                  |j                   |       d       |d             | j	                  |j                  dd       |d             | j	                  |j                   |d      d       |d             | j	                  |j                  dd       |d             | j	                  |j                  dd       |d             | j	                  |j                   |d      d       |              | j	                  |j                  dd       |              | j	                  |j                   |d	      d       |d
             | j	                  |j                  d	d       |d
             | j	                  |j                   |d      d       |d             | j	                  |j                  dd       |d             | j	                  |j                   |d      d       |d             | j	                  |j                  dd       |d             | j                  t              5  |j                  dd       |j                  ddd       d d d        | j                  t        |j                   |d             | j                  t        |j                   |d             | j                  t        |j                   |d	             | j                  t        |j                   |d             | j                  t        |j                   |d             | j                  t        |j                   |d             | j                  t        |j                   |d             | j                  t        |j                   |d      d       | j                  t        |j                   |d      d       | j                  t        |j                   |d      d       | j                  t        |j                   |d      d       | j                  t        |j                   |d      d        |d      }| j	                  |j                   |d             |d             | j	                  |j                  d       |d             | j	                  |j                   |d             |d             | j	                  |j                  d       |d             | j	                  |j                  d       |d             | j	                  |j                   |d             |              | j	                  |j                  d       |              | j	                  |j                   |d      d       |d             | j	                  |j                  dd       |d             | j	                  |j                   |d      d       |d             | j	                  |j                  dd       |d             | j	                  |j                  dd       |d             | j	                  |j                   |d      d       |              | j	                  |j                  dd       |              | j	                  |j                   |d      d       |d
             | j	                  |j                  dd       |d
             | j	                  |j                   |d      d       |d             | j	                  |j                  dd       |d             | j	                  |j                   |d      d       |d             | j	                  |j                  dd       |d             | j                  t        |j                   |d             | j                  t        |j                   |d             | j                  t        |j                   |d             | j                  t        |j                   |              | j                  t        |j                  d       | j                  t        |j                   |d             | j                  t        |j                   |d             | j                  t        |j                   |d             | j                  t        |j                   |d             | j                  t        |j                   |d      d       | j                  t        |j                   |d      d       | j                  t        |j                   |d      d       | j                  t        |j                   |d      d       | j                  t        |j                   |d      d       y # 1 sw Y   nxY w)Nr.   rD   r'   r!   r"   r#   Twalk_upa/cz../br;   r  r:   z../a/br*   z../aza/..z/a/..r+   r   r   /a/cr<   r   )r1   rH   rG   rK   r?   assertWarnsDeprecationWarningr   r@   s      r   test_relative_to_commonz)_BasePurePathTest.test_relative_to_commonU  s   HHeH)Q]]3)Q]]D9qs+QuX6r*AeH5qv.#7s+QsV4t,af5qx0!#6u-qs3qsD91U8Dr48!E(Cqvt<afEsD91S6BtT:AcFCqx>Dud;QSAqx>&	Jud;QvYGqz4@!D'Jw=qwGqvt<akJsD91X;G01 	2MM#s#MM#sDM1	2 	*ammQsV<*ammQwZ@*ammQuX>*ammQtW=*ammQvY?*ammQvY?*ammQwZ@*ammQsVTJ*ammQtWdK*ammQvYM*ammQvYM*ammQwZNfIqv.%9s+QuX6qw/38t,af5u-qv6qy1137v.4qvt<ahGsD91U8Dqw=qvFtT:AcFCud;QsVDqy$?Evt<acBqy$?6Kvt<aiHq{DA1T7Kx>$Hqw=q{KtT:AhKH*ammQtW=*ammQx[A*ammQvY?*ammQS9*ammR8*ammQsV<*ammQvY?*ammQvY?*ammQwZ@*ammQrUDI*ammQsVTJ*ammQvYM*ammQvYM*ammQwZNg	2 	2s   'mmc                    | j                   } |d      }| j                  t        |j                         | j                  t        |j                  d       | j	                  |j                   |                    | j	                  |j                  d             | j	                  |j                   |d                   | j	                  |j                  d             | j	                  |j                   |d                   | j	                  |j                  d             | j                  t              5  |j                  dd       d d d        | j                  |j                   |d                   | j                  |j                   |d                   | j                  |j                   |d	                   | j                  |j                   |d
                    |d      }| j	                  |j                   |d                   | j	                  |j                  d             | j	                  |j                   |d
                   | j	                  |j                  d
             | j	                  |j                  d             | j	                  |j                   |d                   | j	                  |j                  d             | j                  |j                   |d                   | j                  |j                   |d                   | j                  |j                   |d                   | j                  |j                   |                    | j                  |j                  d             | j                  |j                   |d                   y # 1 sw Y   zxY w)Nr.   rD   r'   r!   r#   r"   r:   r;   r0  r*   r   r+   r   r   r<   r1  )r1   rH   rG   is_relative_tor   r2  r3  r   r@   s      r   test_is_relative_to_commonz,_BasePurePathTest.test_is_relative_to_common  s   HHeH)Q%5%56)Q%5%5t<((-.((,-((301((./((523((/001 	'S#&	' 	))!C&12))!G*56))!E(34))!D'23fI((301((-.((412((./((/0((634((01))!D'23))!H+67))!F)45))!#./))"-.))!C&12+	' 	's   <OOc                    | j                   } |d      }t        dt        j                  dz         D ]  }t        j                  ||      }t        j
                  |      }| j                  |j                  |j                         | j                  ||       | j                  t        |      t        |             | j                  t        |      t        |              y )Nr   r   r   )r1   rangepickleHIGHEST_PROTOCOLdumpsloadsr^   r   r?   r   r\   )r   rA   r7   protodumpedr   s         r   test_pickling_commonz&_BasePurePathTest.test_pickling_common  s    HHfI1f559: 	.E\\!U+Ff%BMM",,4R#T"XtAw/SWc!f-	.r   N)+r   r   r   r   r8   rB   rP   ra   rf   rp   ru   r|   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r   r&  r(  r,  r4  r7  r@  rU   r   r   r   r   (   s    
L*4%6
+-4 1/98&&$B$==

<	-&-,^8
106$@-^*.0	4K(M&:A"A$32MO^!3F	.r   r   c                   f    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
 Zd Zy)PurePosixPathTestc                     | 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       y )N)//ar"   r'   //)rE  r!   r"   )///ar"   r+   )r+   r!   r"   )z////ar"   c:a)c:\a)z\ar|   r   r   s     r   test_drive_root_partsz'PurePosixPathTest.test_drive_root_parts  sd    ,, 	lD2BCmCAnCAhB9jB
;hB9r   c                     | j                   }| j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       y )Nr   r+   z///a/b//a/brE  r1   r?   rs   r   s     r   	test_rootzPurePosixPathTest.test_root  sU    HH6-8))3/7$/r   c                     | j                   }| j                   |d       |d             | j                   |d       |d             | j                   |d       |d             y )Nr.   A/br*   rF  rD  )r1   r   r?   r   s     r   test_eqzPurePosixPathTest.test_eq  sS    HHAeHah/4!F),AdGQuX.r   c                     | j                   }| j                   |d      j                         d       | j                   |d      j                         d       | j                   |d      j                         d       y )Nr+   zfile:///z/a/b.czfile:///a/b.cz/a/b%#czfile:///a/b%25%23c)r1   r?   r   r   s     r   test_as_urizPurePosixPathTest.test_as_uri  s`    HH3*58++-?9,,.0DEr   c           	         ddl m} | j                  }	 t        j                  d       | j                   |d      j                         d |t        j                  d            z          y # t
        $ r | j                  d       Y _w xY w)Nr   )quote_from_bytes   éz1\xe9 cannot be encoded to the filesystem encodingu   /a/bézfile:///a/b)	urllib.parserW  r1   r   r   UnicodeEncodeErrorskipTestr?   r   )r   rW  rA   s      r   test_as_uri_non_asciiz'PurePosixPathTest.test_as_uri_non_ascii  sw    1HH	PKK 	:--/&)9"++f:M)NN	P " 	PMMNO	Ps   A, ,B	B	c                 h    | j                   }| j                   |d      j                  d             y )Nr   r   )r1   r   rJ   r   s     r   
test_matchzPurePosixPathTest.test_match  s&    HH601r   c                 j   | j                   }| j                   |       j                                | j                   |d      j                                | j                   |d      j                                | j                   |d      j                                | j                   |d      j                                | j                   |d      j                                | j                   |d      j                                | j                   |d      j                                y )Nr!   r&   r+   r*   /a/b/rD  rN  r1   r   is_absoluter   r   s     r   test_is_absolutez"PurePosixPathTest.test_is_absolute  s    HH*+3++-.6..01#**,-$++-.'
..01%,,./'
..01r   c                 L   | j                   }| j                  d |d      j                                | j                  d |d      j                                | j                  d |d      j                                | j                  d |d      j                                y )NFr'   r+   /foo/barz/dev/con/PRN/NULr1   r^   is_reservedr   s     r   test_is_reservedz"PurePosixPathTest.test_is_reserved  sy    HHeQrU..01eQsV//12eQz]6689eQ12>>@Ar   c                 :   | j                   } |d      }|j                  d      }| j                  | |d              |d      j                  d      }| j                  | |d              |d      j                  d      }| j                  | |d             y NrD  r"   rN  r*   z//cr   r1   rI   r?   r   s       r   	test_joinzPurePosixPathTest.test_join  s    HHeHZZ_QwZ(tWe$QuX&uXt$QtW%r   c                     | j                   } |d      }|dz  }| j                  | |d              |d      dz  }| j                  | |d              |d      dz  }| j                  | |d             y rj  r1   r?   r   s       r   test_divzPurePosixPathTest.test_div  ss    HHeHWQwZ(tWu_QuX&uX_QtW%r   c                     | j                   } |ddd      } |t        j                  d            }| j                  ||       y )Nc:r!   r"   c:\a\b)r1   r   PureWindowsPathr?   r   s       r   test_parse_windows_pathz)PurePosixPathTest.test_parse_windows_path*  s>    HHdCw&&z23Br   N)r   r   r   r   PurePosixPathr1   rL  rP  rS  rU  r\  r^  rc  rh  rl  ro  rt  rU   r   r   rB  rB    sG    


C
:0/FP2	2B&	& r   rB  c                   2   e Zd Zej                  Zej                  j                         Zej                  dg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! Z#y")#PureWindowsPathTest)r=   )rq  r!   )rq  r#   )rc   rq  r!   ))c:/r!   )rq  r+   r!   )rq  r*   )z/zry  r!   )z//x/yry  r!   rN  )rN  r:   )//a/b/r:   )r=   rH  c:/ar{  //a/b/cc                    | 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"        |d#d$dd%        |d&ddd'        |d(d$dd%        |d)d*dd+        |d,d-dd.        |d/d-dd0        |d1d-dd2        |d3d4dd5        |d6d7dd8        |d9d:dd;        |d<d=dd>        |d?d@ddA        |dBdCddD        |dEdFddG        |dHdFddG        |dIdFddJ        |dKdLddM        |dNdOddP        |dQdRddS        |dTdUddV        |dWdXddY        |dZddd[        |d\ddd"        |d]d^dd_        |d`ddda        |dbdddc        |ddddde        |dfdddf        |dgdhddi        |djdhddk        |dldmddn        |dodmddp       y )qN)rq  rq  r'   )ry  \)c:\)r+   )r  rG  rx  )r|  )r  r!   )r*   )r  r!   )rE  \\)r  )rD  \\a)r  )z//a/\\a\)r  rz  \\a\b)\\a\b\)r{  )r}  )r  r:   )r!   zZ:br:   Z:)r  r"   r:   )r!   zZ:/br:   )Z:\r"   r:   )r!   z//b/cr)   z\\b\c)z\\b\c\r)   )r!   z	Z://b//c/zd/)r  r"   r:   r)   )r!   z//b/c//r)   )z//./c:\\.\c:)r  )z//?/c:/z\\?\c:)\\?\c:\)//?/c:/a)r  r!   )r  r   )r  r"   )z//?\\?)r  )z//?/\\?\)r  )z//?/UNC\\?\UNC)r  )z//?/UNC/\\?\UNC\)r  )z	//?/UNC/b	\\?\UNC\b)r  )z
//?/UNC/b/
\\?\UNC\b\)r  )z//?/UNC/b/cz\\?\UNC\b\c)\\?\UNC\b\c\)z//?/UNC/b/c/)z//?/UNC/b/c/d)r  r)   )z//./BootPartition/z\\.\BootPartition)z\\.\BootPartition\)z//?/BootPartition/z\\?\BootPartition)z\\?\BootPartition\)z//./PhysicalDrive0\\.\PhysicalDrive0)r  )z//?/Volume{}/z\\?\Volume{})z\\?\Volume{}\)z//./nul\\.\nul)r  r   )r  r"   r:   )zZ:/ar   r:   )z//?/Z:/ar   r:   z\\?\Z:)z\\?\Z:\r"   r:   )c:/a/bc:x/y)r  r!   r"   rZ   y)r  c:/x/y)r  rZ   r  )z./c:s)c:s)zcc:s)zC:c:sC:)r  r  )zC:/c:s)C:\r  )zD:a./c:bD:)r  r!   c:b)zD:/ar  )zD:\r!   r  rJ  rK  s     r   rL  z)PureWindowsPathTest.test_drive_root_partsB  s   ,,gb':hdI>fD':hb+>idMBgD+>gI>hZ@i	2|Dj
D/Jk
D/Jl
D:MNb2BC d4FG!
D:MN&d4KL#
D:MNkRHlT;KLmT;OP T;OPhZ@i	2|Dlb/Jm<MNn=OPo(92?ST(:DBYZ(:DBYZ (:DB]^%)?Gbc%)?Gbc%)@"F`a ):DBXYlr?KD2BC!d4FG%T;TU 	!d4PQ"d4FGjB9iB	:jb-@kdODb2DEd4HIr   c                    | j                  d      }| j                  t        |      d       | j                  d      }| j                  t        |      d       | j                  d      }| j                  t        |      d       | j                  d      }| j                  t        |      d       | j                  d	      }| j                  t        |      d
       y )Nr;   za\b\czc:/a/b/czc:\a\b\crN  r  r}  z\\a\b\c	//a/b/c/dz	\\a\b\c\d)r1   r?   r\   r6   s     r   test_strzPureWindowsPathTest.test_str  s    HHWQ+HHZ Q/HHWQ.HHYQ/HH[!Q!12r   c                 X   | j                  d       | j                  d       | j                  d       | j                  d       | j                  d       | j                  d       | j                  d       | j                  d       | j                  d	       | j                  d
       y )Nz.\a:brq  rH  z	c:a\b.txtr  rI  z
c:\a\b.txtz\\some\sharez\\some\share\az\\some\share\a\b.txtrd   re   s    r   test_str_subclassz%PureWindowsPathTest.test_str_subclass  s      *  &  '  .  (  )  0  !23  !56  !<=r   c                 <   | j                   }| j                   |d       |d             | j                   |d       |ddd             | j                   |d       |d             | j                   |d       |d             | j                   |d       |d             | j                   |d       |d	             | j                   |d
       |d             | j                   |d       |d             | j                   |d       |d             y )Nc:a/brq  r!   r"   zd:a/br  r   za/BrR  C:a/Bc:A/b//Some/SHARE/a/Bz//somE/share/A/bu   İu   i̇)r1   r?   r   r   s     r   rS  zPureWindowsPathTest.test_eq  s    HH7QwZ07QtS#%67AgJ'
3AgJ(4AfIq{351U8,7QwZ0-.2D0EF8a	l3r   c                 4   | j                   }| j                  t              5   |d      j                          d d d        | j                  t              5   |d      j                          d d d        | j	                   |d      j                         d       | j	                   |d      j                         d       | j	                   |d      j                         d       | j	                   |d	      j                         d
       | j	                   |d      j                         d       | j	                   |d      j                         d       | j	                   |d      j                         d       y # 1 sw Y   IxY w# 1 sw Y   "xY w)Nr   r  ry  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)r1   rH   r   r   r?   r   s     r   rU  zPureWindowsPathTest.test_as_uri  sI   HHz* 	fI	z* 	 gJ	 5*M::--/1CD;..02IJ<//13IJ?+2246JK/07792	445<<>=	?	 		  	 s   F F F
Fc                    | j                   }| j                   |d      j                  d             | j                   |d      j                  d             | j                   |d      j                  d             | j                   |d      j                  d             | j                   |d      j                  d             | j                   |d      j                  d             | j                   |d      j                  d             | j                   |d      j                  d             | j                   |d	      j                  d             | j                   |d	      j                  d             | j                   |d
      j                  d             | j                   |d
      j                  d             | j                   |d      j                  d             | j                   |d      j                  d             | j                   |d      j                  d             | j                   |d      j                  d             | j                   |d      j                  d             | j                   |d      j                  d             | j                   |d      j                  d             | j                   |d
      j                  d             y )Nzc:/b.pyz*:/*.pyzc:/*.pyzd:/b.pyr   r   zc:*.pyzc:b.pyr   z//some/share/a.pyz
//*/*/*.pyz//some/share/*.pyz//other/share/a.pyz//some/share/a/b.pyzB.pyzb.PYr   r   z//Some/Share/B.Pyz//somE/sharE/*.pY)r1   r   rJ   r   r   s     r   r^  zPureWindowsPathTest.test_match  sI   HH)**956)**9569++I676126236348**7348**9567))(347)))45-.44\BC-.445HIJ/0667JKL01778KLM&	/0+,,[9:-.445HIJ9++G459++H56./55g>?r   c                 ,     fd} j                   } |d      } |d      } |||        j                  ||k          j                  ||kD          |d      } |d      } |||        j                  ||k          j                  ||kD         y )Nc                 N    j                  | |       j                  ||        y r   )assertLessEqualassertGreaterEqualr   s     r   assertOrderedEqualzDPureWindowsPathTest.test_ordering_common.<locals>.assertOrderedEqual  s#      A&##Aq)r   r  r  z//some/Share/A/br  )r1   r   )r   r  rA   r7   r   s   `    r   r   z(PureWindowsPathTest.test_ordering_common  s    	* HHgJgJ1a QQ ! !1a QQr   c                     | j                   } |d      }|j                  }| j                  |d        |d      }|j                  }| j                  |d        |d      }|j                  }| j                  |d       y )Nr  )rq  r!   r"   r  )r  r!   r"   r  )r  r:   r)   )r1   r]   r?   )r   rA   r7   r]   s       r   
test_partszPureWindowsPathTest.test_parts  st    HHgJ 01hK 23kN 89r   c                 d   | j                   } |d      }| j                  |j                   |d             | j                  |j                  j                   |d             | j                  |j                  j                  j                   |d             | j                  |j                  j                  j                  j                   |d              |d      }| j                  |j                   |d             | j                  |j                  j                   |d             | j                  |j                  j                  j                   |d             | j                  |j                  j                  j                  j                   |d              |d	      }| j                  |j                   |d
             | j                  |j                  j                   |d             | j                  |j                  j                  j                   |d             y )Nzz:a/b/czz:a/bz:az:zz:/a/b/czz:/a/bz:/az:/r  r}  rN  r   r@   s      r   test_parentzPureWindowsPathTest.test_parent  sx   HHiL1W:.!E(3//49//66$@jM1X;/!F)4//5://66%AkN1Y<0!G*5//7<r   c                    | j                   } |d      }|j                  }| j                  t        |      d       | j                  |d    |d             | j                  |d    |d             | j                  |dd  |d      f       | j                  |d d  |d      f       | j                  |d d  |d       |d      f       | j                  |dd   |d      f       | j                  |d d d    |d      f       | j                  |d d d    |d       |d      f       | j                  t	        |       |d       |d      g       | j                  t              5  |d    d d d         |d      }|j                  }| j                  t        |      d       | j                  |d    |d	             | j                  |d    |d
             | j                  |dd  |d	      f       | j                  |dd  |d	      f       | j                  |d d  |d	       |d
      f       | j                  |dd   |d
      f       | j                  |d d d    |d	      f       | j                  |d d d    |d
       |d	      f       | j                  t	        |       |d	       |d
      g       | j                  t              5  |d    d d d         |d      }|j                  }| j                  t        |      d       | j                  |d    |d             | j                  |d    |d             | j                  |dd  |d      f       | j                  |dd  |d      f       | j                  |d d  |d       |d      f       | j                  |dd   |d      f       | j                  |d d d    |d      f       | j                  |d d d    |d       |d      f       | j                  t	        |       |d       |d      g       | j                  t              5  |d    d d d        y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   y xY w)Nzz:a/b/r   r   r  r   r  r   zz:/a/b/r  r  r  r}  rN  )r1   ro   r?   r   r   rH   r   r   s       r   test_parentsz PureWindowsPathTest.test_parents  s!   HHhKiiS1%Q5*Q4)QqAeH;/SbAeH;/Ra1U8QtW"56QR1T7*-SqSAeH;/TrTQtWah$78cQuXqw$78z* 	F	iLiiS1%Q6+Q5*QqAfI<0QrQvYL1Ra1V9ah"78QR1U8+.SqSAfI<0TrTQuXqy$:;cQvY%$9:z* 	F	kNiiS1%Q9.Q7,QqAiL?3QrQy\O4Ra1Y<7"<=QR1W:-0SqSAiL?3TrTQwZ9$>?cQy\1W:$>?z* 	F	 	9	 		 		 	s$   ,QQ"Q/Q"Q,/Q8c                 <   | j                   }| j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d	      j                  d
       y )Nrq  r  ry  c:/a/b/rN  r  r{  r  z./c:ar'   r   r   s     r   
test_drivezPureWindowsPathTest.test_drive-  s    HH4-7))405.9++T27)):68**J7;--z:7))2.r   c                    | j                   }| j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d	      j                  d       y )
Nrq  r'   r  ry  r  r  rN  r{  r  rO  r   s     r   rP  zPureWindowsPathTest.test_root8  s    HH4r*7"-5-9**D17$/8))40;,,d3r   c                    | j                   }| j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d	      j                  d       y )
Nrq  r  ry  r  r  rN  r  r{  r  )r1   r?   r   r   s     r   test_anchorzPureWindowsPathTest.test_anchorB  s    HH4.7**D15&19,,f57**L98++\:;..=r   c                 <   | j                   }| j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d	      j                  d       | j                   |d
      j                  d       | j                   |d      j                  d       y )Nrq  r'   ry  r  r"   r  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_nameL  s    HH4r*5+7#.8))3/:++V4;,,f5./44b92388#>r   c                 \   | j                   }| j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d	      j                  d       | j                   |d
      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       y )Nrq  r'   ry  r  r  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_suffixW  s   HH4,5"-7**B/8++R0:--u5;..6;..3<//4<//7=)00%8>*1159?+22E:>?FFK?@GGL./66;23::B?r   c                 l   | j                   }| j                   |d      j                  g        | j                   |d      j                  g        | j                   |d      j                  g        | j                   |d      j                  g        | j                   |d      j                  dg       | j                   |d      j                  dg       | j                   |d      j                  g        | j                   |d	      j                  g        | j                   |d
      j                  dg       | j                   |d      j                  dg       | j                   |d      j                  ddg       | j                   |d      j                  ddg       | j                   |d      j                  g        | j                   |d      j                  g        | j                   |d      j                  g        | j                   |d      j                  g        y )Nrq  ry  r  r  r  r  r  r  r  r  r
  r  r  r  r  r  r  r  r  r  r  r   s     r   test_suffixesz!PureWindowsPathTest.test_suffixesj  s   HH4))2.5**B/7,,b18--r2://%9;005':;00"5<1126<11E7;=)22UG<>*33fe_E?+44vuoF./88"=23<<bA>?HH"M?@II2Nr   c                    | j                   }| j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d	      j                  d       | j                   |d
      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       | j                   |d      j                  d       y )Nrq  r'   zc:.zc:..r  ry  r  r"   r  r  r  r  r  r  r  r  r  r  r   s     r   	test_stemzPureWindowsPathTest.test_stem}  s   HH4r*5+6.5+7#.:++S1;,,g6<--u5>*//9>?DD8	:r   c                 ~   | j                   }| j                   |d      j                  d       |d             | j                   |d      j                  d       |d             | j                   |d      j                  d       |d             | j                   |d      j                  d       |d             | j                  t         |d      j                  d       | j                  t         |d	      j                  d       | j                  t         |d
      j                  d       | j                  t         |d      j                  d            d       | j                  t         |d      j                  d            d       | j                   |d      j                  d       |d             | j                   |d      j                  d       |d             | j                  t         |d      j                  d       | j                  t         |d      j                  d
       y )Nr  r"  z	c:a/d.xmlr  z
c:/a/d.xmlc:a/Dot ending.c:/a/Dot ending.rq  ry  
//My/Sharer!   d:.\d:d:e.\d:ec:a/d:c:a/d:ed:/e)r1   r?   rL   rH   r   r\   r   s     r   test_with_namez"PureWindowsPathTest.test_with_name  s   HH7--g6+G8..w7<I,-77@!K.Q-.88A1\?S*ag&7&7A*ah&8&8'B*ao&?&?IQsV--d34g>QsV--e45x@7--d3Qx[A7--e4a	lC*aj&:&:FC*aj&:&:LIr   c                 ~   | j                   }| j                   |d      j                  d       |d             | j                   |d      j                  d       |d             | j                   |d      j                  d       |d             | j                   |d      j                  d       |d             | j                  t         |d      j                  d       | j                  t         |d	      j                  d       | j                  t         |d
      j                  d       | j                  t         |d      j                  d            d       | j                  t         |d      j                  d            d       | j                   |d      j                  d       |d             | j                   |d      j                  d       |d             | j                  t         |d      j                  d       | j                  t         |d      j                  d
       y )Nr  r)   zc:a/dr  zc:/a/dr  r  rq  ry  r  r!   r  r  r  r  r  r  r  )r1   r?   rM   rH   r   r\   r   s     r   test_with_stemz"PureWindowsPathTest.test_with_stem  s   HH7--c2AgJ?8..s3Qx[A,-77<ajI-.88=q{K*ag&7&7=*ah&8&8#>*ao&?&?EQsV--d34g>QsV--e45x@7--d3Qx[A7--e4a	lC*aj&:&:FC*aj&:&:LIr   c                    | j                   }| j                   |d      j                  d       |d             | j                   |d      j                  d       |d             | j                   |d      j                  d       |d             | j                   |d      j                  d       |d             | j                  t         |d      j                  d       | j                  t         |d	      j                  d       | j                  t         |d
      j                  d       | j                  t         |d      j                  d       | j                  t         |d      j                  d       | j                  t         |d      j                  d
       | j                  t         |d      j                  d       | j                  t         |d      j                  d       | j                  t         |d      j                  d       | j                  t         |d      j                  d       | j                  t         |d      j                  d       | j                  t         |d      j                  d       | j                  t         |d      j                  d       | j                  t         |d      j                  d       | j                  t         |d      j                  d       y )Nr  r  zc:a/b.gzr  z	c:/a/b.gzr  r  r'   rc   r+   r  r*  r  rq  r+  z\.gzzc:.gzr,   zc\dz.c/dz.c\d)r1   r?   rN   rH   r   r   s     r   test_with_suffixz$PureWindowsPathTest.test_with_suffix  s;   HH7//6*F8007;H:22591Z=I;33E:AkNK*ae&7&7?*af&8&8%@*af&8&8%@*ao&A&A5I*aj&<&<dC*aj&<&<cB*aj&<&<dC*aj&<&<dC*aj&<&<fE*aj&<&<gF*aj&<&<gF*aj&<&<eD*aj&<&<fE*aj&<&<fE*aj&<&<gFr   c                    | j                   } |d      }| j                  |j                   |d             |d             | j                  |j                  d       |d             | j                  |j                   |d             |d             | j                  |j                  d       |d             | j                  |j                  d       |d             | j                  |j                   |d             |              | j                  |j                  d       |              | j                  |j                   |d      d	       |d             | j                  |j                  dd	       |d             | j                  |j                   |d      d	       |d             | j                  |j                  dd	       |d             | j                  |j                  dd	       |d             | j                  |j                   |d      d	       |              | j                  |j                  dd	       |              | j                  |j                   |d
      d	       |d             | j                  |j                   |d      d	       |d             | j                  |j                   |d      d	       |d             | j                  t        |j                   |              | j                  t        |j                  d       | j                  t        |j                   |d             | j                  t        |j                   |d             | j                  t        |j                   |d             | j                  t        |j                   |d             | j                  t        |j                   |d             | j                  t        |j                   |d
             | j                  t        |j                   |d             | j                  t        |j                   |       d	       | j                  t        |j                  dd	       | j                  t        |j                   |d      d	       | j                  t        |j                   |d      d	       | j                  t        |j                   |d      d	       | j                  t        |j                   |d      d	       | j                  t        |j                   |d      d	        |d      }| j                  |j                   |d             |d             | j                  |j                  d       |d             | j                  |j                   |d             |d             | j                  |j                  d       |d             | j                  |j                  d       |d             | j                  |j                   |d             |              | j                  |j                  d       |              | j                  |j                   |d      d	       |d             | j                  |j                  dd	       |d             | j                  |j                   |d      d	       |d             | j                  |j                  dd	       |d             | j                  |j                  dd	       |d             | j                  |j                   |d      d	       |              | j                  |j                  dd	       |              | j                  |j                  dd	       |d             | j                  |j                  dd	       |d             | j                  |j                  dd	       |d             | j                  t        |j                  d       | j                  t        |j                   |d             | j                  t        |j                   |d             | j                  t        |j                   |d             | j                  t        |j                   |d             | j                  t        |j                   |d             | j                  t        |j                   |d             | j                  t        |j                   |d              | j                  t        |j                   |d             | j                  t        |j                   |d             | j                  t        |j                   |d!             | j                  t        |j                  dd	       | j                  t        |j                   |d      d	       | j                  t        |j                   |d      d	       | j                  t        |j                   |d      d	       | j                  t        |j                   |d       d	       | j                  t        |j                   |d      d	       | j                  t        |j                   |d      d	       | j                  t        |j                   |d!      d	        |d"      }| j                  |j                   |d#             |d             | j                  |j                  d#       |d             | j                  |j                  d$       |d             | j                  |j                   |d%             |d             | j                  |j                  d%       |d             | j                  |j                  d&       |d             | j                  |j                   |d'             |              | j                  |j                  d'       |              | j                  |j                   |d#      d	       |d             | j                  |j                  d#d	       |d             | j                  |j                  d$d	       |d             | j                  |j                   |d%      d	       |d             | j                  |j                  d%d	       |d             | j                  |j                  d&d	       |d             | j                  |j                   |d'      d	       |              | j                  |j                  d'd	       |              | j                  |j                   |d(      d	       |d             | j                  |j                  d(d	       |d             | j                  t        |j                   |d)             | j                  t        |j                   |d*             | j                  t        |j                   |d+             | j                  t        |j                   |d,             | j                  t        |j                   |d)      d	       | j                  t        |j                   |d*      d	       | j                  t        |j                   |d+      d	       | j                  t        |j                   |d,      d	       y )-N	C:Foo/Barrq  zFoo/Barc:foOBarc:foO/	c:foO/baRTr.  C:Foo/Bar/Bazr  	C:Foo/Bazz../Barz	C:Baz/Barz../../Foo/Barr'   r  r+   Foo/FooC:/Foo
C:/Foo/Barry  c:/foOc:/foO/
c:/foO/baRC:/Bazz
../Foo/Bar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/Barz//sErver/sHare/bar/Server/Share/Fooc:/Server/Share/Foo//z/Share/Foo//Server/z/Foo)r1   r?   rK   rH   r   r@   s      r   test_relative_toz$PureWindowsPathTest.test_relative_to  s   HHkNqw/9>t,a	l;qz2AeH=w/5:x0!E(;q~6<{3QS9qw=q|LtT:AiLIqz4@!E(Kw=qxHx>%Iq~tDacJ{DA13Gq'94H!D'Rq~tDakRq~tDaFXY*ammQS9*ammR8*ammQtW=*ammQsV<*ammQuX>*ammQvY?*ammQx[A*ammQ5GH*ammQ{^D*ammQS$G*ammRF*ammQtWdK*ammQsVTJ*ammQuXtL*ammQvYM*ammQx[$OlOqx0!I,?u-q|<q{3QuX>x0!E(;y11U8<q7=|4ac:qx>)Mud;Qy\Jq{DA1U8Lx>%Iy$?5JqEqsK|TBACHx>,P'7F$P|TBAhKP*ammT:*ammQtW=*ammQx[A*ammQ7G5HI*ammQ|_E*ammQwZ@*ammQtW=*ammQuX>*ammQsV<*ammQvY?*ammQy\B*ammT4H*ammQtWdK*ammQwZN*ammQtWdK*ammQuXtL*ammQsVTJ*ammQvYM*ammQy\4P&'q)9':;Qy\J'78!I,G'891Y<Hq)='>?5J';<ahG'<=qxHq)A'BCQSI'?@!#Fq)9':DI1Y<X'7F)U'8$G9Vq)='>MqQVxX';TJAeHU'<dKQuXVq)A'BDQSTSVW'?NPQPSTq)='>MqQ]_';TJAlO\*ammQ7J5KL*ammQ7L5MN*ammQ5GH*ammQ7G5HI*ammQ7J5KUYZ*ammQ7L5MW[\*ammQ5GQUV*ammQ7G5HRVWr   c                 r   | j                   } |d      }| j                  |j                   |d                   | j                  |j                  d             | j                  |j                   |d                   | j                  |j                  d             | j                  |j                  d             | j                  |j                   |d                   | j                  |j                  d             | j                  |j                   |                    | j                  |j                  d             | j                  |j                   |d                   | j                  |j                   |d                   | j                  |j                   |d	                   | j                  |j                   |d
                   | j                  |j                   |d                   | j                  |j                   |d                   | j                  |j                   |d                    |d      }| j                  |j                   |d                   | j                  |j                   |d                   | j                  |j                  d             | j                  |j                   |d                   | j                  |j                  d             | j                  |j                  d             | j                  |j                   |d                   | j                  |j                   |d                   | j                  |j                   |d                   | j                  |j                   |d                   | j                  |j                   |d                   | j                  |j                   |d                   | j                  |j                   |d                   | j                  |j                   |d
                   | j                  |j                   |d                    |d      }| j                  |j                   |d                   | j                  |j                  d             | j                  |j                  d             | j                  |j                   |d                   | j                  |j                  d             | j                  |j                  d             | j                  |j                   |d                   | j                  |j                  d             | j                  |j                   |d                   | j                  |j                   |d                    | j                  |j                   |d!                   | j                  |j                   |d"                   y )#Nr  rq  r  r  r  r'   r  r+   r  r  r  r  r  r  ry  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  )r1   r   r6  r   r@   s      r   test_is_relative_toz'PureWindowsPathTest.test_is_relative_to,  s   HHkN((412((./((745((12((23((;89((56))!#./))"-.))!D'23))!C&12))!E(34))!F)45))!H+67))!O*<=>))!K.9:lO((523((856((34((<9:((67))$/0))!H+67))!,<*=>?))!L/:;))!G*56))!D'23))!E(34))!C&12))!F)45))!I,78&'((+;)<=>(()9:;(():;<((+?)@AB(()=>?(()>?@((+C)DEF(()ABC))!,?*@AB))!,A*BCD))!O*<=>))!,<*=>?r   c                    | j                   }| j                   |       j                                | j                   |d      j                                | j                   |d      j                                | j                   |d      j                                | j                   |d      j                                | j                   |d      j                                | j                   |d      j                                | j                   |d      j                                | j                   |d      j                                | j                   |d	      j                                | j                   |d
      j                                | j                   |d      j                                | j                   |d      j                                | j                   |d      j                                | j                   |d      j                                | j                   |d      j                                y )Nr!   r&   r+   r*   r`  rq  rH  zc:a/b/ry  r|  r  rN  r{  r}  r  ra  r   s     r   rc  z$PureWindowsPathTest.test_is_absolutea  s   HH*+3++-.6..013++-.4,,./7//124,,./5--/080023%,,./&	--/0)0023'
..01(//12)0023+2245r   c                    | j                   } |d      }|j                  d      }| j                  | |d             |j                  d      }| j                  | |d             |j                  d      }| j                  | |d             |j                  d      }| j                  | |d             |j                  d      }| j                  | |d             |j                  d	      }| j                  | |d             |j                  d
      }| j                  | |d             |j                   |d            }| j                  | |d             |j                   |d            }| j                  | |d             |j                   |d            }| j                  | |d              |d      j                  d      }| j                  | |d              |d      j                  d      }| j                  | |d              |d      j                  d      }| j                  | |d             y )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/yr  r  ./d:s
C:/a/b/d:s./dd:sC:/a/b/dd:sE:d:srE  serverz//serversharez//server/sharez//./BootPartitionWindowsz//./BootPartition/Windowsrk  r   s       r   rl  zPureWindowsPathTest.test_joinv  s   HHhKZZQ|_-ZZQx[) ZZ QwZ(ZZ!Qx[)ZZ*+Q123 ZZ Q|_-ZZ!Qx[) ZZ'
#Q|_-ZZ($Q}-.ZZ'
#QwZ(tWh'Qz]+z]##G,Q/01"#,,Y7Q:;<r   c                 \   | j                   } |d      }| j                  |dz   |d             | j                  |dz  dz   |d             | j                  |dz   |d             | j                  |dz  dz   |d             | j                  |d	z   |d	             | j                  |d
z  dz   |d	             | j                  |dz   |d             | j                  |d
z  dz   |d             | j                  |dz   |d             | j                  |dz   |d             | j                  |dz   |d             | j                  | |d      z   |d             | j                  | |d      z   |d             | j                  | |d      z   |d             y )Nr  r  r	  rZ   r  r
  r  z/xr  r  r  r  r  r  r  r  r  r  r  rn  r@   s      r   ro  zPureWindowsPathTest.test_div  s   HHhKUAlO4S3,8VQx[1TC85 	Waj1TE)1W:6Xq{3TF*AhK8//3E1FG 	Wao6Xq{3 	QwZ<9Qx[!M*:;QwZ74r   c                 <   | j                   }| j                  d |d      j                                | j                  d |d      j                                | j                  d |d      j                                | j                  d |d      j                                | j                  d |d      j                                | j                  d |d      j                                | j                  d |d	      j                                | j                  d |d
      j                                | j                  d |d      j                                | j                  d |d      j                                | j                  d |d      j                                | j                  d |d      j                                | j                  d |d      j                                | j                  d |d      j                                | j                  d |d      j                                | j                  d |d      j                                | j                  d |d      j                                | j                  d |d      j                                | j                  d |d      j                                | j                  d |d      j                                | j                  d |d      j                                | j                  d |d      j                                | j                  d |d      j                                | j                  d |d      j                                y )NFr'   r+   re  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/bazrf  r   s     r   rh  z$PureWindowsPathTest.test_is_reserved  s   HHeQrU..01eQsV//12eQz]6689eQ78DDFGdAeH0023dAeH0023dAeH0023dAeH0023dAhK3356dAiL4467dAfI1134dAfI1134dAiL4467dAiL4467dAiL4467 	dAiL4467dAgJ2245dAkN6689dAjM5578dAm,88:; 	eQz]6689eQz]6689dA./;;=>eQ/0<<>?r   N)$r   r   r   r   rs  r1   r   r   copyupdaterL  r  r  rS  rU  r^  r   r  r  r  r  rP  r  r  r  r  r  r  r  r  r  r  rc  rl  ro  rh  rU   r   r   rw  rw  1  s    

!
!C$11668L> .O <J|
3
>4? @6 "
:=$,\	/4>	?@&O&:J J G0gXR3@j6*#=J52!@r   rw  c                   6    e Zd Zej                  Zd Zd Zd Zy)PurePathTestc                     | j                  d      }| j                  t        |      t        j                  dk(  rt
        j                         y t
        j                         y Nr!   nt)r1   r^   r   r   r  r   rs  ru  r6   s     r   test_concrete_classz PurePathTest.test_concrete_class  sD    HHSMd1g')ww$G##	S<C<Q<Q	Sr   c                 |    t        j                  d      }t        j                  d      }| j                  ||       y r0   )r   ru  rs  r   r   r7   r   s      r   test_different_flavours_unequalz,PurePathTest.test_different_flavours_unequal  s2    !!#&##C(Aq!r   c                    t        j                  d      }t        j                  d      }| j                  t              5  ||k   d d d        | j                  t              5  ||k   d d d        | j                  t              5  ||kD   d d d        | j                  t              5  ||k\   d d d        y # 1 sw Y   sxY w# 1 sw Y   \xY w# 1 sw Y   ExY w# 1 sw Y   y xY wr0   )r   ru  rs  rH   rG   r(  s      r   !test_different_flavours_unorderedz.PurePathTest.test_different_flavours_unordered  s    !!#&##C(y) 	E	y) 	F	y) 	E	y) 	F	 		 		 		 		 	s0    B8#CC)C8CCCC%N)	r   r   r   r   PurePathr1   r&  r)  r+  rU   r   r   r"  r"    s    


CS
"

r   r"  c                  J    t        j                  j                  t        g|  S r   )r   rt   joinBASErZ   s    r   <lambda>r1    s    "'',,t(a( r   c                  J    t        j                  j                  t        g|  S r   )r   rt   r.  r	   r0  s    r   r1  r1    s    bggll6.A. r   r%  z)test requires a Windows-compatible systemz'test requires a POSIX-compatible systemc                   $    e Zd Zej                  Zy)PosixPathAsPureTestN)r   r   r   r   	PosixPathr1   rU   r   r   r4  r4    s    


Cr   r4  c                   0    e Zd Zej                  Zd Zd Zy)WindowsPathAsPureTestc                     | j                   }| j                  t              5   |d      j                          d d d        y # 1 sw Y   y xY wNry  )r1   rH   NotImplementedErrorownerr   s     r   
test_ownerz WindowsPathAsPureTest.test_owner  =    HH23 	eHNN	 	 	   AAc                     | j                   }| j                  t              5   |d      j                          d d d        y # 1 sw Y   y xY wr9  )r1   rH   r:  groupr   s     r   
test_groupz WindowsPathAsPureTest.test_group  r=  r>  N)r   r   r   r   WindowsPathr1   r<  rA  rU   r   r   r7  r7    s    


C
r   r7  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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#d  Z$ej>                  d!        Z%d" Z&d# Z'ej>                  d$        Z(ej>                  d%        Z)d& Z*djd'Z+e+xZ,Z-ej>                  d(        Z.ej>                  d)        Z/d* Z0d+ Z1ejd                  d,        Z3e4ejd                  d-               Z5ejd                  d.        Z6ej>                  d/        Z7d0 Z8ej>                  d1        Z9d2 Z: ejv                  ed3      d4        Z< ejv                  e=d5      d6        Z>d7 Z?d8 Z@d9 ZA ejv                   eBed:      d;      d<        ZC ej                    eBed:      d=      d>        ZDd? ZEd@ ZFej>                  dA        ZGdB ZHdC ZIdD ZJdE ZKdF ZLdG ZM ej                   eNdH      dI        ZOePdJ        ZQdK ZRdL ZSdM ZTej>                  dN        ZUdO ZVdP ZWdQ ZXdR ZYdS ZZdT Z[ ejv                   eBedU      dV       ej                   e\j                  dWk(  dX      dY               Z^dZ Z_ ejv                   eBe`d[      d\       ej                   eNd]       ej                   ed^      d_                      Zad` Zbda Zcdb Zddc Zedd Zfde Zgej>                  df        Zhej>                  dg        Ziej>                  dh        Zjdi Zky)k_BasePathTestz?Tests for the FS-accessing functionalities of the Path classes.c                 .   d }| j                  |       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 }|j                  d	       d d d        t        t	        dd
      d      5 }|j                  d       d d d        t        t	        dd      d      5 }|j                  d       d d d        t        t	        dd      d      5 }|j                  d       d d d        t        t	        ddd      d      5 }|j                  d       d d d        t        j                  t	        d      d       t        j                         rt        j                  dt	        d             t        j                  dt	        d             | j                  dt	        d             | j                  t        j                  j	                  dd      t	        dd             | j                  t        j                  j	                  dd      t	        dd             t        j                  dt	        d             y y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   _xY w)Nc                  t    t        j                  t        d      d       t        j                  t
               y )NdirE  )r   chmodr.  r   rmtreer/  rU   r   r   cleanupz$_BasePathTest.setUp.<locals>.cleanup*  s"    HHT&\5)T"r   dirAdirBdirCdirDrG  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writerI  r   can_symlinksymlinkdirlinkrt   )r   rK  fs      r   r8   z_BasePathTest.setUp)  s2   	# 	 

f
f
f
ff%&
f$w-& 	)!GG'(	)$vw'. 	)!GG'(	)$vw'. 	)!GG'(	)$v{+T2 	*aGG()	*$vvw/6 	)!GG'(	)
fq!  "JJwW.JJ~tL'9:LLg/LLdF3T&'5JKLLdF3T&'5JKJJ'$/?*@A #	) 	)	) 	)	) 	)	* 	*	) 	)s<   K
K#:K0*K=L
K #K-0K:=L
Lr%  c                 4    t        j                  ||d       y )NTtarget_is_directoryr   ra  r   srcdests      r   rb  z_BasePathTest.dirlinkL  s    JJsDd;r   c                 0    t        j                  ||       y r   rg  rh  s      r   rb  z_BasePathTest.dirlinkO  s    JJsD!r   c                     | j                  t        j                  j                  t	        |      t	        |            |d|d       y )Nz and z don't point to the same file)r   r   rt   samefiler\   r   path_apath_bs      r   
assertSamez_BasePathTest.assertSameR  s3    ((Vc&kB)	*r   c                     | j                  t              5 } ||i | d d d        | j                  j                  j                  t        j
                         y # 1 sw Y   >xY wr   )rH   FileNotFoundErrorr?   	exceptionerrnoENOENT)r   funcr_   kwargscms        r   assertFileNotFoundz _BasePathTest.assertFileNotFoundW  sS    01 	"R$!&!	"++U\\:	" 	"s   	AA%c                     | j                  t        j                  j                  |      t        j                  j                  |             y r   )r?   r   rt   normcasern  s      r   assertEqualNormCasez!_BasePathTest.assertEqualNormCase\  s0    ))&12773C3CF3KLr   c                 <   | j                  t        j                               }| j                  ||       | j	                  t        |      t        |             | j                  t        |      t        |             | j                  |j                                y r   )
r1   r   getcwdr?   r}  r\   r^   r   r   rb  r(  s      r   	_test_cwdz_BasePathTest._test_cwd_  sf    HHRYY[!A  QQ0d1gtAw'(r   c                 Z    | j                   j                         }| j                  |       y r   )r1   cwdr  r6   s     r   test_cwdz_BasePathTest.test_cwdf  s    HHLLNqr   c           
      t   | j                   }t        j                  d      5 }t        |_        | j                  t         |       j                               t               | j                  t         |d      j                               t               | j                  t         |d      j                               t        j                  j                  t        d             | j                  t         |ddd      j                               t        j                  j                  t        ddd             | j                  t         |dd      j                               t        j                  j                  t        dd             | j                  t         |d      j                               t        j                  j                  t        d             | j                  t         |d	      j                               t        j                  j                  t        d	             | j                  t         |d
      j                               t        j                  j                  t        d
             | j                  t         |dd
      j                               t        j                  j                  t        dd
             | j                  t         |d
d      j                               t        j                  j                  t        d
d             d d d        y # 1 sw Y   y xY w)N	os.getcwdrc   r!   r"   r:   rX  rR  rW  r[  r  )r1   r   patchr/  return_valuer?   r\   absoluter   rt   r.  )r   rA   r  s      r   test_absolute_commonz"_BasePathTest.test_absolute_commonj  s$   HHZZ$ 	Z"&F S0$7S3!23T:S3!23RWW\\$5LMS3S!1!:!:!<=rww||DRUWZ\_?`a S7G!4!=!=!?@"'',,tU\^eBfgS<!9!9!;<bggll4Q]>^_S#3!4!=!=!?@"'',,tUeBfg S4!1!1!34bggll46NOS3!6!6!89277<<cSW;XYS4!6!6!89277<<dTW;XY#	Z 	Z 	Zs   LL..L7c                 R   | j                  t        j                  j                  d            }| j	                  ||       | j                  t        |      t        |             | j                  t        |      t        |             | j                  |j                                y )N~)r1   r   rt   
expanduserr?   r}  r\   r^   r   r   rb  r(  s      r   
_test_homez_BasePathTest._test_home  so    HHRWW'',-A  QQ0d1gtAw'(r   Nz(Test requires pwd module to get homedir.)reasonc                    t        j                         5 }| j                  | j                  j	                                |j                          t        j                  j                  t        d      |d<   | j                  | j                  j	                                t        j                  j                  t        d      |d<   | j                  | j                  j	                                d d d        y # 1 sw Y   y xY w)NuserprofileUSERPROFILEhomeHOME)
r   EnvironmentVarGuardr  r1   r  clearr   rt   r.  r/  )r   envs     r   	test_homez_BasePathTest.test_home  s     **, 		-OODHHMMO,IIK!#dM!BCOODHHMMO, '',,tV4CKOODHHMMO,		- 		- 		-s   CC88Dc                 T    G d dt         | j                        } |t        d      }| j                  d|j	                         j
                         | j                  d|j                         j
                         t        s9| j                  d|j                  d      j                         j
                         | j                  d|dz  j                  |dz        j
                         | j                  d|dz  j                  |dz        j
                         t        j                         r-| j                  d|dz  j                         j
                         |j                         D ]  }| j                  d|j
                           |j!                  d	      D ]  }| j                  d|j
                           |j#                  d	      D ]  }| j                  d|j
                           |j%                         D ]"  \  }}}| j                  d|j
                         $ y )
Nc                       e Zd Zy)+_BasePathTest.test_with_segments.<locals>.PNrT   rU   r   r   rA   r    rW   r   rA   rl   rm   r  rP  rR  rU  r   )r   r1   r/  r?   r  r   resolver   r   r  renamerx   r   r`  readlinkiterdirglobrglobwalk)r   rA   r7   rt   dirpathdirnames	filenamess          r   test_with_segmentsz _BasePathTest.test_with_segments  s   	%txx 	dr"QZZ\445QYY[334R!5!@!@!B!M!MNa'k11!g+>IIJa'k221w;?JJK  "R!g+!7!7!9!D!DEIIK 	2DR1	2FF3K 	2DR1	2GGCL 	2DR1	2,-FFH 	5(GXyR!3!34	5r   c                    t         j                  j                  t        d      }t         j                  j                  t        dd      }| j	                  |      }| j	                  |      }| j	                  |      }| j                  |j                  |             | j                  |j                  |             | j                  |j                  |             | j                  |j                  |             t         j                  j                  t        d      }| j	                  |      }| j                  t        |j                  |       | j                  t        |j                  |       | j                  t        |j                  |       | j                  t        |j                  |       | j                  t        |j                  |       | j                  t        |j                  |       y )NrP  rM  rR  rj   )
r   rt   r.  r/  r1   r   rm  r   rH   rs  )r   
fileA_path
fileB_pathr7   r   r   non_existentr   s           r   test_samefilez_BasePathTest.test_samefile  sX   WW\\$0
WW\\$8
HHZ XXj!HHZ 

:./

2'J/0A'ww||D%0HH\"+QZZ;+QZZF+QZZ;+QZZF+QZZ;+QZZFr   c                     | j                  d      }| j                  |j                         t        j                  d             y )Nr'   rc   )r1   r?   statr   r6   s     r   test_empty_pathz_BasePathTest.test_empty_path  s-    HHRL2773<0r   zWASI has no user accounts.c                    | j                   } |d      }| j                  |j                          |t        j                  j                  d                    |d      }| j                  |j                         |        |d      }| j                  |j                         |        |d      }| j                  |j                         |        | |d      j                         j                        dz  }| j                  |j                         |        |d      }| j                  |j                          |t        j                  j                  d      d             y )Nr  rj   /~../~r'   z~/a:br=   )r1   r?   r  r   rt   r  r   r@   s      r   test_expanduser_commonz$_BasePathTest.test_expanduser_common  s   HHcF277+=+=c+B)CDeH+dG+fI+aenn%%&,+gJ277+=+=c+BG)LMr   c                 n   | j                   } |t              }| j                  d|j                                | j                  d|dz  j                                | j                  d|dz  j                                | j                  d|dz  dz  j                                t	        j
                         r| j                  d|dz  j                                | j                  d|dz  j                                | j                  d|dz  dz  j                                | j                  d|dz  dz  j                                | j                  d|d	z  j                                | j                  d|d	z  j                  d
             | j                  d|dz  j                                | j                  d |d      j                                | j                  d |t        dz         j                                | j                  d |t        dz         j                                y )NTrL  rP  FbahrU  rX  rR  rW  follow_symlinksrj   z/xyzzy    )r1   r/  r^   existsr   r`  r@   s      r   test_existsz_BasePathTest.test_exists  s   HHdGdAHHJ'dQZ//12dQ[0023ea'kE199;<  "MM$W 4 4 67MM$W 4 4 67MM$Ww!6 > > @AMM%!g+"5!=!=!?@MM%!l"2!:!:!<=MM$\!1 9 9% 9 PQea%i//12eQx[//12eQth/6689eQtf}-4467r   c                    | j                  t              }|dz  j                  d      5 }| j                  |t        j
                         | j                  |j                         d       d d d        |dz  j                  d      5 }| j                  |t        j                         | j                  |j                         j                         d       d d d        |dz  j                  dd      5 }| j                  |t        j                         | j                  |j                         j                         d       d d d        y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   y xY w)NrP  r   zthis is file A
rb   this is file Ar   )	buffering)r1   r/  r^  r>   io
TextIOBaser?   readBufferedIOBasestrip	RawIOBase)r   r7   rc  s      r   test_open_commonz_BasePathTest.test_open_common  s2   HHTN'k$ 	;!!!R]]3QVVX'9:	; 'k% 	B!!!R%6%67QVVX^^-/@A	B 'k2 	Ba!!!R\\2QVVX^^-/@A	B 	B	; 	;	B 	B	B 	Bs&   AEAE4AE$EE!$E-c                 *   | j                  t              }|dz  j                  d       | j                  |dz  j	                         d       | j                  t        |dz  j                  d       | j                  |dz  j	                         d       y )NrP  s   abcdefgsomestr)r1   r/  write_bytesr?   
read_bytesrH   rG   r6   s     r   test_read_write_bytesz#_BasePathTest.test_read_write_bytes  sw    HHTN	
W!!*-!g+113Z@)a'k%>%>	J!g+113Z@r   c                 8   | j                  t              }|dz  j                  dd       | j                  |dz  j	                  dd      d       | j                  t        |dz  j                  d	       | j                  |dz  j	                  d      d       y )
NrP  u   äbcdefgzlatin-1encodingutf-8ignore)r  errorsbcdefgs	   somebytes)r1   r/  
write_textr?   	read_textrH   rG   r6   s     r   test_read_write_textz"_BasePathTest.test_read_write_text  s    HHTN	
W  i @!g+00X 1 /08	: 	)a'k%=%=|L!g+00)0DjQr   c                 @   | j                  t              }|dz  j                  dd       | j                  |dz  j	                         d       |dz  j                  dd       | j                  |dz  j	                         d       |dz  j                  dd       | j                  |dz  j	                         d	       t        t        j                  d
      }|dz  j                  d       | j                  |dz  j	                         d|z   dz   |z   dz          y )NrP  zabcde
fghlk
mnopq
)newlines   abcde
fghlk
mnopqs   abcdefghlkmnopqz
s   abcde
fghlk
mnopqasciir  zabcde
fghlk
mnopqs   abcdes   fghlks   mnopq)r1   r/  r  r?   r  r   r   linesep)r   r7   os_linesep_bytes      r   test_write_text_with_newlinesz+_BasePathTest.test_write_text_with_newlines  s   HHTN	
W  !:D I!g+1133	5 
W  !:D I!g+1133	5 
W  !:F K!g+1137	9  

W=	
W  !89!g+113"_4x?/QT^^	`r   c           
         | j                   } |t              }|j                         }t        |      }g d}t	        j
                         r|g dz  }| j                  ||D ch c]  } |t        |       c}       y c c}w )N)rL  rM  rN  rG  rP  )rU  rX  rW  r[  )r1   r/  r  setr   r`  r?   )r   rA   r7   itpathsrz   r   s          r   test_iterdirz_BasePathTest.test_iterdir  sh    HHdGYY[B<  "JJHh @!D!* @A @s   #A?
c                     | j                   } |t        d      }t        |j                               }dD ch c]  } |t        d|       }}| j	                  ||       y c c}w )NrX  )rR  rZ  )r1   r/  r  r  r?   )r   rA   r7   r  r   rz   s         r   test_iterdir_symlinkz"_BasePathTest.test_iterdir_symlink"  s[     HHdGAIIK 2DFQQtWa(FF) Gs   A!c                 \   | j                  t        d      }| j                  t              5 }t	        |j                                d d d        | j                  j                  j                  t        j                  t        j                  t        j                  f       y # 1 sw Y   ]xY wNrP  )r1   r/  rH   OSErrornextr  assertInrt  ru  ENOTDIRrv  EINVALr   r7   ry  s      r   test_iterdir_nodirz _BasePathTest.test_iterdir_nodir+  sy    HHT7#w' 	2	 	bll((5==+0<<+G 	H		 	s   B""B+c                      fd} j                    t              }|j                  d      } j                  |t        j
                  j                          ||dg        ||j                  d      g         ||j                  d      ddg       t        j                         s ||j                  d      ddg       n ||j                  d      g d	       t        j                         s ||j                  d
      dg       n ||j                  d
      g d       t        j                         s ||j                  d      dg       n ||j                  d      ddg       t        j                         r ||j                  d      dg       t        j                         s ||j                  d      g d       y  ||j                  d      g d       y )Nc           
      x    j                  t        |       |D ch c]  } t        |       c}       y c c}w r   )r?   r  r/  )r  rz   r   rA   r   s      r   _checkz._BasePathTest.test_glob_common.<locals>._check6  s+    SYh(H!D!*(HI(Hs   7
rP  rR  z
dir*/file*
dirB/fileB
dirC/fileCz*ArL  )rL  rP  rU  z*B/*)r  
dirB/linkDlinkB/fileBzlinkB/linkD*/fileBr  rW  */)rL  rM  rN  rG  )rL  rM  rN  rG  rX  )	r1   r/  r  r>   collectionsr   Iteratorr   r`  r   r  r7   r  rA   s   `   @r   test_glob_commonz_BasePathTest.test_glob_common5  ss   	JHHdGVVG_b+//":":;rG9qvvg#qvvl#lL%AB$$&166$<&'!23166$<!;<$$&166&>L>2166&> $B C$$&166)$|n5166)$|]&CD  "166,',8$$&166$<!AB166$<!JKr   c                       j                    fd} t              } ||ddg         ||dddg        ||ddg         ||dddg       y )Nc           	          | j                  ||      D ch c]  }t        |       }}|D ch c]  }t         t        |             }}j                  ||       y c c}w c c}w )Nr   )r  r\   r/  r?   )rt   patternr   rz   r   r{   rA   r   s         r   r  z6_BasePathTest.test_glob_case_sensitive.<locals>._checkV  s]    &*iii&WXc!fXFX19:AAdAJ:H:VX. Y:s
   A!A&z
DIRB/FILE*TFr  z
dirb/file*)r1   r/  )r   r  rt   rA   s   `  @r   test_glob_case_sensitivez&_BasePathTest.test_glob_case_sensitiveT  sX    HH	/ wt\4,t\5<.9t\4,t\5<.9r   c                      fd} j                    t              }|j                  d      } j                  |t        j
                  j                          ||dg        ||j                  d      dg        ||j                  d      dg        ||j                  d      g        t        j                         s ||j                  d      dg       n ||j                  d      g d        ||j                  d	      g d
       t        j                         s ||j                  d      g d       n ||j                  d      g d        ||j                  d      g d        t        d      } ||j                  d      g d        ||j                  d	      ddg        ||j                  d      ddg        ||j                  d      dg        ||j                  d      dg        ||j                  d      dg        ||j                  d      ddg        ||j                  d      ddg        ||j                  d      dg        ||j                  d      dg       y )Nc                 `    j                  t        |       t        fd|D                     y )Nc              3   8   K   | ]  } t         |        y wr   )r/  )rY   r   rA   s     r   r[   zB_BasePathTest.test_rglob_common.<locals>._check.<locals>.<genexpr>b  s     1O!D!*1Os   )r?   sorted)r  rz   rA   r   s     r   r  z/_BasePathTest.test_rglob_common.<locals>._checka  s"    VD\61Oh1O+OPr   rP  rR  r  z**/fileBz*/fileAr  )r  zdirB/linkD/fileBr  zdirA/linkC/fileBzfile*)rP  r  r  dirC/dirD/fileDr  )rL  rM  rN  	dirC/dirDrG  )rL  
dirA/linkCrM  r  rN  r  rG  rX  r'   )r'   rL  rM  rN  rG  r  rN  r   )r  dirC/novel.txtr  r  r  r  z**/file*zdir*/**r  z*/*r   z*.txtr  z*.*)	r1   r/  r  r>   r  r   r  r   r`  r  s   `   @r   test_rglob_commonz_BasePathTest.test_rglob_common`  s    	QHHdGWWWb+//":":;rG9qwww,0qwwz"\N3qwwy!2&$$&1779%~61779% (K Lqwww "C 	D$$&1774= #  1774= #  	qwwr{MNdFOqwws| > 	?qwww,0A!BCqwwz"\3D$EFqwwy!K=1qwwu~ 123qwwt}{m,qwwr{V[12qwwt}v{34qwww"2!34qwwu~ 012r   c                     | j                   } |t              }t        |j                  d            }h d}| j	                  ||D ch c]  }||z  	 c}       y c c}w )Nr   >   rL  rM  rN  rG  rP  rU  rX  rW  r[  r  r  r  r  r  r  r  )r1   r/  r  r  r?   )r   rA   r7   givenexpectrZ   s         r   test_rglob_symlink_loopz%_BasePathTest.test_rglob_symlink_loop  sS     HHdGAGGCL!
 	 71Q 78 7s   A
c                    d}| j                   } |t              dz  } ||gdg|z   }|j                  d       dj                  dg|z        }t	        d      D cg c]  }|j                  |       }}|D ]  }| j                  t        |      |        t	        d      D cg c]  }|j                  d       }}|}t	        |      D ])  }	|dz  }|D ]  }| j                  t        |      |        + y c c}w c c}w )	N   deepr)   Tro   r+   r   d   )	r1   r/  r]  r.  r9  r  r?   r  r  )
r   depthrA   baser7   r  jitersr  is
             r   test_glob_many_open_filesz'_BasePathTest.test_glob_many_open_files  s   HHwd#seEk#	((C55=)-23Z87#88 	*BT"Xq)	**/*5QC55u 	.ACA .  b1-.	. 9 6s   C<(Dc           
         | j                   } |t              }| j                  t        |j	                  d             |t        d      h       | j                  t        |j	                  d             |t        dd      h       | j                  t        |j	                  d             |t        dd      h       | j                  t        |j	                  d             |t        d      h       | j                  t        |j	                  d            t                      | j                  t        |j	                  d            t                      | j                  t        |j	                  d	            t                      | j                  t        |j	                  d
j                  dgdz                     |t        gdgdz   h       y )Nr  z../..zdirA/..rL  zdirA/../file*zdirA/../fileAzdirA/../file*/..z../xyzzyzxyzzy/..r+   2   )r1   r/  r?   r  r  r.  r@   s      r   test_glob_dotdotz_BasePathTest.test_glob_dotdot  sW   HHdGQVVD\*adm,=>QVVG_-4t1D/FGQVVI./1T643H1JKQVVO4549Q7STQVV$678#%@QVVJ/0#%8QVVJ/0#%8QVVCHHdVb[$9:;q?TQS?T=UVr   c           	         | j                   } |t              dz  }|j                          | j                  t        j
                  |       t        d      D ]I  }|d| z  }|dz  r|j                   |t        dd             .|j                   |t        d             K | j                  t        t        |j                  d                  d       | j                  t        t        |j                  d	                  d
       | j                  t        t        |j                  d                  d
       | j                  t        t        |j                  d                  d
       y )Npermissionsr  linkr   rG  nonexistentrN  r   r  r  z*/fileCz*/file*)r1   r/  r]  r\  r   rJ  r9  
symlink_tor?   r   r  r  )r   rA   r  r  r  s        r   test_glob_permissionsz#_BasePathTest.test_glob_permissions  s    HHw&

	(($/s 	1AD*$D1u$ >?$0	1 	S30137S412B7S9!567<S9!567<r   c                     | j                  t              dz  }|j                          |dz  }|j                  d       | j	                  t        |j                  d            |g       y )Nlong_symlinkbad_linkX  badbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadr   )r1   r/  r]  r  r?   r   r  )r   r  r   s      r   test_glob_long_symlinkz$_BasePathTest.test_glob_long_symlink  sW     xx~.

*$K(		& 12XJ?r   c                 &   d}|dz   }t        j                  t        j                  d      }t        j                  |gdg|z   }|j	                  d       t        |      5  t        |j                  d             d d d        y # 1 sw Y   y xY w)Nr  
   r  r)   Tr  r   )r   Pathr   r	   r]  r   r   r  r   recursion_limitdirectory_depthr  rt   s        r   test_glob_above_recursion_limitz-_BasePathTest.test_glob_above_recursion_limit  s|    )B.||I,,f5||D=SEO$;=

4
  1 	"4!	" 	" 	"s   #BBc                 J    |j                  |      }| j                  ||       y r   )r  r?   )r   r7   rz   strictr   s        r   _check_resolvez_BasePathTest._check_resolve  s     IIfH%r   c                 	   | j                   } |t        d      }| j                  t              5 }|j	                  d       d d d        | j                  j                  j                  t        j                         | j                  t        |j	                  d            t        j                  j                  t        d              |t        ddd      }| j                  t        |j	                  d            t        j                  j                  t        ddd              |t        dddd      }| j                  t        |j	                  d            t        j                  j                  t        j                  j                  ddd                    |t        dd	      }| j                  ||        |t        d
      }| j                  | |t        d              |t        ddd	      }| j                  | |t        dd	              |t        ddd	      }| j                  | |t        dd	              |t        ddd	ddd      }| j                  | |t        dd	ddd      d        |t        dddddd      }t        j                   dk(  r"| j                  | |t        dddd      d       n | j                  | |t        ddd      d       t#        j$                  t'        j(                  dt        j*                                     }| j-                  t"        j.                  |       t        j0                  t        j                  j                  |      t        dd             t        j0                  t        d      t        j                  j                  |d              |t        dddd	      }| j3                  | |t        dd	              |t        dddddd      }| j                  | |t        dddd      d        |t        ddddddd      }t        j                   dk(  r| j                  | ||ddd      d       y | j                  | |t        ddd      d       y # 1 sw Y   :xY w)Nrj   Tr+  Finspamr  rM  rR  rU  rP  rL  rY  rZ  r%  z-dirD)r  dirlinkXlinkY)r1   r/  rH   r  r  r?   rt  ru  rv  r}  r\   r   rt   r.  abspath_check_resolve_relativer  r   	_longpathtempfilemkdtempr  r\  rJ  ra  _check_resolve_absolute)r   rA   r7   ry  r)   s        r   test_resolve_commonz!_BasePathTest.test_resolve_common  s   HHdENw' 	#2IITI"	#++U\\:  QYYeY%<!=!#dE!:	<dE4(  QYYeY%<!=!#dE4!H	JdD%v.  QYYeY%<!=!#eT61R!S	U dFG$$$Q*dG$$Q$(89dFGW-$$Q$(@AdFGW-$$Q$(@AdFGWeT6B$$Q$*0)238	:dFGT5$?77d? ((AdFE4.4-67<>
 ((AdE4,H%P 0 057YY[!B C	((!,


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


4<a!9:dFGWg6$$Q$(@AdFGWeT6B$$Q$tV(L%*	,dFGWdE4H77d? ((Aaf,EuM ((AdE4,H%Po	# 	#s   Q::Rc                 :   | j                  t              }| j                  dt        d             | j                  t        j
                  j                  dd      t        d             | j                  t        j
                  j                  dd      t        d             |dz  }| j                  |j                  d      |       |dz  dz  }| j                  t        |j                  d       | j                  |j                  d	      |dz  dz         y )
Nrc   012Tr.  34F)
r1   r/  rb  r.  r   rt   r?   r  rH   rs  )r   r7   r   r   s       r   test_resolve_dotz_BasePathTest.test_resolve_dot(  s     HHTNS$s)$RWW\\#s+T#Y7RWW\\#s+T#Y7G$/3GcM+QYYtD%0!c'C-@r   c                 J   | j                  dd      }t        j                         }t        j                  t               	 | j                  |j                         | j                  t        |             t        j                  |       y # t        j                  |       w xY w)Nnonexist)r1   r   r  chdirr/  r?   r  )r   r7   old_cwds      r   )test_resolve_nonexist_relative_issue38671z7_BasePathTest.test_resolve_nonexist_relative_issue386716  sg    HHUG$))+
	QYY[$((4*;<HHWBHHWs   4B B"c                    | j                  t              }|j                         }|j                         }t        |       | j	                  t
              5  |5  	 d d d        d d d        t        |       t        |       |j                          |j                          |j                          | j	                  t
              5  |5  	 d d d        d d d        y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   *xY w# 1 sw Y   y xY wr   )	r1   r/  r  r  r2  r3  r  r  r  )r   r7   r  it2s       r   	test_withz_BasePathTest.test_with@  s    HHTNYY[iikS	01 	 	
 	RS		
				

01 	 	 	 	 	 	 	sH   C(CC(D 	C4D C%	!C((C14C=	9D  D	c                 h   | j                  t              dz  }|j                         j                  }|dz  }|j	                  |       | j                  |j                         j                  |       |dz  }|j	                  |       | j                  |j                         j                  |       y )NrP  m   )r1   r/  r  st_moderI  r?   )r   r7   modenew_modes       r   
test_chmodz_BasePathTest.test_chmodT  s    HHTNW$vvx&=	))84%<	))84r   c                    | j                  t              dz  }|j                         }|j                         j                  }|dz  }|j                  |d       | j                  |j                         j                  |       |dz  }|j                  |d       | j                  |j                         j                  |       y )NrU  rL  Tr  rM  )r1   r/  r  r  rN  rI  r?   )r   r7   r   rO  rP  s        r   test_chmod_follow_symlinks_truez-_BasePathTest.test_chmod_follow_symlinks_trueb  s     HHTNW$IIKvvx&=	$/))84%<	$/))84r   c                 \   | j                  t              dz  }|j                         }| j                  |j                         |       |j	                  |j
                  dz         | j                  |j                  |j
                         | j                  |j                         |       y )NrP  rM  )r1   r/  r  r?   rI  rN  r\  r   r   r7   sts      r   	test_statz_BasePathTest.test_stats  sv    HHTNW$VVX2&	

U"#,AFFHb)r   c                     | j                  t              dz  }|j                         }| j                  ||j                  d             y )NrU  Fr  )r1   r/  r  r   rU  s      r   test_stat_no_follow_symlinksz*_BasePathTest.test_stat_no_follow_symlinks}  s:    HHTNW$VVXBu =>r   c                     | j                  t              dz  }|j                         }| j                  ||j                  d             y )NrP  Fr  )r1   r/  r  r?   rU  s      r   &test_stat_no_follow_symlinks_nosymlinkz4_BasePathTest.test_stat_no_follow_symlinks_nosymlink  s:    HHTNW$VVXQVVEV:;r   c                     | j                  t              dz  }|j                         }| j                  ||j	                                y )NrU  )r1   r/  r  r   lstatrU  s      r   
test_lstatz_BasePathTest.test_lstat  s5    HHTNG#VVXB	*r   c                     | j                  t              dz  }|j                         }| j                  ||j	                                y r  )r1   r/  r  r?   r]  rU  s      r   test_lstat_nosymlinkz"_BasePathTest.test_lstat_nosymlink  s5    HHTNW$VVXQWWY'r   z&the pwd module is needed for this testc                 .   | j                  t              dz  }|j                         j                  }	 t	        j
                  |      j                  }| j                  |j                                y # t        $ r | j                  d|z         Y @w xY w)NrP  z4user %d doesn't have an entry in the system database)r1   r/  r  st_uidpwdgetpwuidpw_nameKeyErrorr[  r?   r;  )r   r7   uidr  s       r   r<  z_BasePathTest.test_owner  s}    HHTNW$ffhoo	N<<$,,D 	qwwy)  	NMMFLN	N   A4 4BBz&the grp module is needed for this testc                 .   | j                  t              dz  }|j                         j                  }	 t	        j
                  |      j                  }| j                  |j                                y # t        $ r | j                  d|z         Y @w xY w)NrP  z5group %d doesn't have an entry in the system database)r1   r/  r  st_gidgrpgetgrgidgr_namerf  r[  r?   r@  )r   r7   gidr  s       r   rA  z_BasePathTest.test_group  s}    HHTNW$ffhoo	O<<$,,D 	qwwy)  	OMMG#MO	Orh  c                     | j                  t              dz  }|j                          | j                  |j                         | j                  |j                         y r  )r1   r/  unlinkrz  r  r6   s     r   test_unlinkz_BasePathTest.test_unlink  sA    HHTNW$	
')r   c                     | j                  t              dz  }| j                  |j                         |j                  d       y )NfileAAAT)
missing_ok)r1   r/  rz  rp  r6   s     r   test_unlink_missing_okz$_BasePathTest.test_unlink_missing_ok  s4    HHTNY&)	D!r   c                 
   | j                  t              dz  }|j                         D ]  }|j                           |j	                          | j                  |j                         | j                  |j                         y )NrL  )r1   r/  r  rp  rmdirrz  r  r(  s      r   
test_rmdirz_BasePathTest.test_rmdir  s_    HHTNV# 	AHHJ			')r   r  zos.link() is not presentc                 r   | j                  t              }|dz  }|j                         j                  }|dz  dz  }|j	                  |       | j                  |j                         j                  |       | j                  t        j                  j                  ||             | j                  |j                                |dz  dz  }t        d      }|j	                  |       | j                  t        j                  |      j                  |       | j                  |j                                y NrP  rL  fileAArs  )r1   r/  r  st_sizehardlink_tor?   r   r   rt   rm  r  rel_join)r   rA   targetsizer  link2target2s          r   test_hardlink_toz_BasePathTest.test_hardlink_to  s    HHTNW{{}$$6zH$ ,,d3((67(F
Y&7#'")1148'r   zos.link() is presentc                     | j                  t              }|dz  }|dz  dz  }| j                  t              5  |j	                  |       d d d        y # 1 sw Y   y xY w)NrP  rL  r{  )r1   r/  rH   r:  r}  r   rA   r7   r   s       r   test_link_to_not_implementedz*_BasePathTest.test_link_to_not_implemented  sV    HHTNKJ!23 	MM!	 	 	s   AAc                 Z   | j                  t              }|dz  }|j                         j                  }|dz  dz  }|j	                  |      }| j                  ||       | j                  |j                         j                  |       | j                  |j                         t        d      }|j	                  |      }| j                  || j                  |             | j                  t        j                  |      j                  |       | j                  |j                         y rz  )	r1   r/  r  r|  r  r?   rz  r~  r   )r   rA   r7   r  r   	renamed_pr   	renamed_qs           r   test_renamez_BasePathTest.test_rename  s    HHTNKvvxJ!HHQK	A&))40'YHHQK	DHHQK0++T2'r   c                 \   | j                  t              }|dz  }|j                         j                  }|dz  dz  }|j	                  |      }| j                  ||       | j                  |j                         j                  |       | j                  |j                         t        dd      }|j	                  |      }| j                  || j                  |             | j                  t        j                  |      j                  |       | j                  |j                         y )NrP  rL  r{  rM  rR  )	r1   r/  r  r|  rx   r?   rz  r~  r   )r   rA   r7   r  r   
replaced_pr   
replaced_qs           r   test_replacez_BasePathTest.test_replace  s    HHTNKvvxJ!YYq\
Q'))40'VW%YYq\
TXXa[1++T2'r   c                    | j                  t              }| j                  |dz  j                         | j                  d             | j                  |dz  j                         | j                  d             | j                  |dz  j                         | j                  d             | j	                  t
              5  |dz  j                          d d d        y # 1 sw Y   y xY w)NrU  rP  rW  rV  rX  rM  )r1   r/  r?   r  rH   r  r   s     r   test_readlinkz_BasePathTest.test_readlink  s    HHTN!g+//1488G3DE!l*446.1	3!g+//1488F3CDw' 	%[""$	% 	% 	%s   CC'c                    | j                  t              }|dz  }| j                  |j                                |j	                          | j                  |j                                |j                         }|j                  }|j                  }t        j                  t        |      |dz
  |dz
  f       |j	                          |j                         }| j                  |j                  |       | j                  |j                  |       |dz  }| j                  |j                                |j	                  dd       | j                  |j                                | j                  t        |j                  d       y )NnewfileAr$  newfileBi  F)rO  exist_okr  )r1   r/  r   r  touchr   r  st_mtimest_mtime_nsr   utimer\   r  rH   r  )r   rA   r7   rV  	old_mtimeold_mtime_nss         r   test_touch_commonz_BasePathTest.test_touch_common	  s   HHTN
N$		
#VVXKK	~~ 	Q)b.)b.9:		VVX=Y7
N$	UU+
#'177U;r   c                     | j                  t              }|dz  }|j                          |j                  d      5 }| j	                  |j                         j                         d       d d d        y # 1 sw Y   y xY w)NrP  r  r  )r1   r/  r  r^  r?   r  r  )r   rA   r7   rc  s       r   test_touch_nochangez!_BasePathTest.test_touch_nochange	  se    HHTNK		VVD\ 	BQQVVX^^-/@A	B 	B 	Bs   /A44A=c                    | j                  t              }|dz  }| j                  |j                                |j	                          | j                  |j                                | j                  |j                                | j                  t              5 }|j	                          d d d        | j                  j                  j                  t        j                         y # 1 sw Y   >xY w)NnewdirA)r1   r/  r   r  r]  r   is_dirrH   r  r?   rt  ru  EEXIST)r   rA   r7   ry  s       r   
test_mkdirz_BasePathTest.test_mkdir"	  s    HHTN	M$		
#
#w' 	2GGI	++U\\:	 	s   C++C4c                 .   | j                  t        dd      }| j                  |j                                | j	                  t
              5 }|j                          d d d        | j                  j                  j                  t        j                         |j                  d       | j                  |j                                | j                  |j                                | j	                  t
              5 }|j                  d       d d d        | j                  |j                  j                  t        j                         t        j                  |j                         j                         }| j                  t        dd      }|j                  dd       | j                  |j                                | j                  |j                                t"        j$                  dk7  r@| j                  t        j                  |j                         j                         d	|z         | j                  t        j                  |j&                  j                         j                         |       y # 1 sw Y   "xY w# 1 sw Y   {xY w)
NnewdirBnewdirCTr  newdirDnewdirEim  r%  im  )r1   r/  r   r  rH   r  r]  r?   rt  ru  rv  r   r  r  r  S_IMODErN  r   r  rn   )r   r7   ry  rO  s       r   test_mkdir_parentsz _BasePathTest.test_mkdir_parents-	  s   HHT9i0$w' 	2GGI	++U\\:	
#
#w' 	"2GGDG!	"++U\\:||AFFH,,-HHT9i0	t$
#
#77d?T\\!&&(*:*:;Vd]Kahhmmo&=&=>E'	 		" 	"s   I=>J
=J
Jc                 r   | j                  t        d      }|j                         j                  }| j	                  |j                                | j	                  |j                                | j                  t              5 }|j                          d d d        | j                  j                  j                  t        j                         |j                  d       | j	                  |j                                | j                  |j                         j                  |       y # 1 sw Y   xY w)NrM  Tr  )r1   r/  r  st_ctimer   r  r  rH   FileExistsErrorr]  r?   rt  ru  r  )r   r7   st_ctime_firstry  s       r   test_mkdir_exist_okz!_BasePathTest.test_mkdir_exist_okF	  s    HHT6"**
#
#/ 	2GGI	++U\\:	
#**N;	 	s   D--D6c                    | j                  t        d      }| j                  |j                                | j	                  t
              5 }|j                          d d d        | j                  j                  j                  t        j                         |dz  }|j                  d       |j                         j                  }| j                  |j                                | j	                  t
              5 }|j                  d       d d d        | j                  |j                  j                  t        j                         |j                  dd       | j                  |j                                | j                  |j                         j                  |       y # 1 sw Y   OxY w# 1 sw Y   xY w)NrN  r  Tr  ro   r  )r1   r/  r   r  rH   r  r]  r?   rt  ru  r  r  r  )r   r7   ry  r  s       r   test_mkdir_exist_ok_with_parentz-_BasePathTest.test_mkdir_exist_ok_with_parentR	  s9   HHT6"
#/ 	2GGI	++U\\:	M	**
#/ 	"2GGDG!	"++U\\:	t,
#**N;	 		" 	"s   F)=F6)F36F?z)FS root cannot be modified on Emscripten.c                     | j                  d      j                         j                  d       | j                  d      j                         j                  dd       y )Nr+   Tr  r  )r1   r  r]  re   s    r   test_mkdir_exist_ok_rootz&_BasePathTest.test_mkdir_exist_ok_rootc	  sJ     	%%t%4%%dT%Br   c                    dD ](  }| j                  |dz         }|j                         r( n | j                  d       | j                  t              5  dz  dz  j                  d       d d d        y # 1 sw Y   y xY w)NZYXWVUTSRQPONMLKJIHGFEDCBAz:\z&cannot find a drive that doesn't existchildrt   Tr  )r1   r  r[  rH   r  r]  )r   r)   r7   s      r   test_mkdir_with_unknown_drivez+_BasePathTest.test_mkdir_with_unknown_drivei	  s}    - 	DAU#A88:	D
 MMBCw' 	7[6!(((6	7 	7 	7s   A66A?c                 2   | j                  t        dd      }| j                  |j                                | j	                  t
              5 }|j                  d       d d d        | j                  j                  j                  t        j                         | j	                  t
              5 }|j                  dd       d d d        | j                  |j                  j                  t        j                         y # 1 sw Y   xY w# 1 sw Y   JxY w)NrM  rR  Tr  r  r1   r/  r   r  rH   r  r]  r?   rt  ru  r  r  s      r   test_mkdir_with_child_filez(_BasePathTest.test_mkdir_with_child_filet	  s    HHT67+
# / 	"2GGDG!	"++U\\:/ 	12GGD4G0	1++U\\:	" 	"	1 	1s   D0DD
Dc                 *   | j                  t        d      }| j                  |j                                | j	                  t
              5 }|j                          d d d        | j                  j                  j                  t        j                         | j	                  t
              5 }|j                  d       d d d        | j                  |j                  j                  t        j                         y # 1 sw Y   xY w# 1 sw Y   JxY w)NrP  Tr  r  r  s      r   test_mkdir_no_parents_filez(_BasePathTest.test_mkdir_no_parents_file	  s    HHT7#
# / 	2GGI	++U\\:/ 	#2GGTG"	#++U\\:	 		# 	#s   C=-D	=D	Dc           	         t        d      D ]  }| j                  t        d|z        }| j                  |j	                                t
        j                  dfd	}t        d      D cg c]  }t        |d|z  z         c}t               |dz  dz  }	 t        j                  d|      5  |j                  d	d
       d d d        | j                  t        |             | j                  |j	                                 y c c}w # 1 sw Y   KxY w# t        $ r | j                  t        |             Y Yw xY w)N    zdirCPC%dc                     t        |       } j                         r | |       j                  |         | |       y r   )r\   popadd)rt   rO  concurrently_createdr  
real_mkdirs     r   my_mkdirzE_BasePathTest.test_mkdir_concurrent_parent_creation.<locals>.my_mkdir	  s9    4y ;;=tT*(,,T24&r      r   dir1dir2zos.mkdirTFr  )rH  )r9  r1   r/  r   r  r   r]  boolr  r   r  assertNotInr\   r  r  r   )	r   pattern_numr7   r  np12r  r  r  s	         @@@r   %test_mkdir_concurrent_parent_creationz3_BasePathTest.test_mkdir_concurrent_parent_creation	  s    9 	(KzK78AQXXZ(J
' >C1XFtK1623FG#&5 f*v%CAZZ
H5 <IIdUI;<
   S+?@OOAHHJ'7	(" G< <" >c#h(<=>s0   /DD3DDD	D$EEc                    | j                  t              }|dz  }|dz  dz  }|j                  |       | j                  |j	                         |j	                                | j                  |j                         |j	                                |dz  dz  }|j                  t        |             | j                  |j	                         |j	                                | j                  |j                         |j	                                | j                  |j                                |dz  }|dz  dz  }|j                  |d       | j                  |j	                         |j	                                | j                  |j                         |j	                                | j                  |j                                | j                  t        |j                                      y )	NrP  rL  linkAAlinkAAArM  linkAAAATre  )r1   r/  r  r?   r  r   r]  r\   r   r  r   r   r  )r   rA   r  r  s       r   test_symlink_toz_BasePathTest.test_symlink_to	  s\   HHTNW6zH$fkkm4DJJL&++-86zI%F$fkkm4DJJL&++-8'V6zJ&D9fkkm4DJJL&++-8&T\\^,-r   c                    | j                  t              }| j                  |dz  j                                | j	                  |dz  j                                | j	                  |dz  j                                | j	                  |dz  dz  j                                t        j                         rg| j	                  |dz  j                                | j                  |dz  j                                | j	                  |dz  j                         d       | j                  |d	z  j                         d       | j                  |d
z  j                         d       y )NrL  rP  rV  r  rU  rX  rW  Fu   dirAzdirA )r1   r/  r   r  r   r   r`  r^   r   s     r   test_is_dirz_BasePathTest.test_is_dir	  s   HHTNV++-.!g+--/0!n,4467!g+-5578  "a'k1134OOQ[0023ao557?q<'//159q:~--/7r   c                    | j                  t              }| j                  |dz  j                                | j	                  |dz  j                                | j	                  |dz  j                                | j	                  |dz  dz  j                                t        j                         rf| j                  |dz  j                                | j	                  |dz  j                                | j	                  |dz  j                                | j                  |dz  j                         d	       | j                  |d
z  j                         d	       y )NrP  rL  rV  r  rU  rX  rW     fileAFfileA )r1   r/  r   is_filer   r   r`  r^   r   s     r   test_is_filez_BasePathTest.test_is_file	  s   HHTNW--/0!f*--/0!n,5578!g+-6689  "OOQ[1134a'k2245ao6689q=(113U;q;//159r   c                    | j                  t              }t        j                  dk(  r| j                  d      }n| j                  d      }| j	                  |dz  j                                | j	                  |dz  j                                | j	                  |dz  j                                | j	                  |dz  dz  j                                | j                  |j                                t        j                         r"| j	                  |dz  j                                | j                  |d	z  j                         d
       y )Nr%  r  r+   rP  rL  rV  r  rU  r  F)
r1   r/  r   r  r   is_mountr   r   r`  r^   )r   rA   Rs      r   test_is_mountz_BasePathTest.test_is_mount	  s    HHTN77d? AA!g+//12!f*..01!n,6689!g+-779:

%  "a'k3356q8|--/7r   c                 z   | j                  t              }| j                  |dz  j                                | j                  |dz  j                                | j                  |dz  j                                | j                  |dz  dz  j                                t	        j
                         rf| j                  |dz  j                                | j                  |dz  j                                | j                  |dz  j                                | j                  |dz  j                         d	       | j                  |d
z  j                         d	       t	        j
                         rG| j                  |dz  j                         d	       | j                  |dz  j                         d	       y y )NrP  rL  rV  r  rU  rX  rW  r  Fr  u   linkAzlinkA )	r1   r/  r   
is_symlinkr   r`  r   r^   r  r   s     r   test_is_symlinkz_BasePathTest.test_is_symlink	  sW   HHTN!g+1134!f*0023!n,88:;!g+-99;<  "OOQ[4467OOQ[4467OOQ_88:;q=(113U;q;//159  "MM1},557?MM1{?335u= #r   c                 r   | j                  t              }t        j                  j	                  |j
                  d      5  | j                  |j                         |j
                  j                  j                         |j
                  j                  j                  |       d d d        y # 1 sw Y   y xY w)N
isjunction)r1   r/  r   r  objectr2   r?   is_junctionr  r  assert_called_once_withr   s     r   test_is_junctionz_BasePathTest.test_is_junction	  sz    HHTNZZqzz<8 	=Q]]_ajj.C.C.P.PQJJ!!99!<	= 	= 	=s    A$B--B6c                    | j                  t              }| j                  |dz  j                                | j                  |dz  j                                | j                  |dz  j                                | j                  |dz  dz  j                                | j	                  |dz  j                         d       | j	                  |dz  j                         d       y NrP  rL  rV  r  r  Fr  )r1   r/  r   is_fifor^   r   s     r   test_is_fifo_falsez _BasePathTest.test_is_fifo_false
  s    HHTN!g+..01!f*--/0!n,5578!g+-6689q=(113U;q;//159r   mkfifozos.mkfifo() requiredvxworksz%fifo requires special path on VxWorksc                 L   | j                  t        d      }	 t        j                  t	        |             | j                  |j                                | j                  |j                                | j                  |j                                | j                  | j                  t        d      j                         d       | j                  | j                  t        d      j                         d       y # t
        $ r}| j                  d|z         Y d }~d }~ww xY w)Nmyfifozos.mkfifo(): %su	   myfifoFzmyfifo )r1   r/  r   r  r\   PermissionErrorr[  r   r  r   	is_socketr  r^   )r   rA   es      r   test_is_fifo_truez_BasePathTest.test_is_fifo_true
  s     HHT8$	1IIc!f 			$'%dhht^4<<>Fdhht\2::<eD  	1MM+a/00	1s   C< <	D#DD#c                    | j                  t              }| j                  |dz  j                                | j                  |dz  j                                | j                  |dz  j                                | j                  |dz  dz  j                                | j	                  |dz  j                         d       | j	                  |dz  j                         d       y r  )r1   r/  r   r  r^   r   s     r   test_is_socket_falsez"_BasePathTest.test_is_socket_false
  s    HHTN!g+0023!f*//12!n,779:!g+-88:;q=(335u=q;113U;r   AF_UNIXzUnix sockets requiredz/Unix sockets are not implemented on Emscripten.zCannot create socket on WASI.c                 ,   | j                  t        d      }t        j                  t        j                  t        j                        }| j                  |j                         	 |j                  t        |             | j                  |j                                | j                  |j!                                | j                  |j#                                | j%                  | j                  t        d      j                         d       | j%                  | j                  t        d      j                         d       y # t        $ rE}t        |t              sdt        |      v r| j                  dt        |      z          Y d }~d }~ww xY w)NmysockzAF_UNIX path too longzcannot bind Unix socket: u	   mysockFzmysock )r1   r/  socketr  SOCK_STREAMr\  closebindr\   r  
isinstancer  r[  r   r  r   r  r  r^   )r   rA   sockr  s       r   test_is_socket_truez!_BasePathTest.test_is_socket_true#
  s    HHT8$}}V^^V-?-?@

#	DIIc!f
 	&%%dhht^4>>@%Hdhht\2<<>F  	D1o.+s1v59CFBC	Ds   %E 	F:FFc                    | j                  t              }| j                  |dz  j                                | j                  |dz  j                                | j                  |dz  j                                | j                  |dz  dz  j                                | j	                  |dz  j                         d       | j	                  |dz  j                         d       y r  )r1   r/  r   is_block_devicer^   r   s     r   test_is_block_device_falsez(_BasePathTest.test_is_block_device_false:
  s    HHTN!g+6689!f*5578!n,==?@!g+->>@Aq=(99;UCq;7795Ar   c                    | j                  t              }| j                  |dz  j                                | j                  |dz  j                                | j                  |dz  j                                | j                  |dz  dz  j                                | j	                  |dz  j                         d       | j	                  |dz  j                         d       y r  )r1   r/  r   is_char_devicer^   r   s     r   test_is_char_device_falsez'_BasePathTest.test_is_char_device_falseC
  s    HHTN!g+5578!f*4467!n,<<>?!g+-==?@q=(88:EBq;668%@r   c                 >   | j                  t        j                        }|j                         s| j	                  d       | j                  |j                                | j                  |j                                | j                  |j                                | j                  | j                  t        j                   d      j                         d       | j                  | j                  t        j                   d      j                         d       y )Nznull device requiredr  Fr  )r1   r   devnullr  r[  r   r  r   r  r  r^   r   s     r   test_is_char_device_truez&_BasePathTest.test_is_char_device_trueL
  s    HHRZZ xxzMM01((*+**,-%dhh"**V45DDFNdhh"**T23BBDeLr   c                 &   | j                  t        d      }t        dt        j                  dz         D ][  }t        j
                  ||      }t        j                  |      }| j                  |j                         |j                                ] y )NrP  r   r   )	r1   r/  r9  r:  r;  r<  r=  r?   r  )r   r7   r>  r?  r   s        r   r@  z"_BasePathTest.test_pickling_commonW
  sm    HHT7#1f559: 	2E\\!U+Ff%BRWWY1	2r   c                     | j                   } |d      } |d      }| j                  |j                  d   |j                  d          | j                  |j                  d   |j                  d          y )Nz/usr/bin/fooz/usr/local/binr   r   r   )r1   r^   r]   r  s       r   test_parts_interningz"_BasePathTest.test_parts_interning^
  s\    HHnaggaj!''!*-aggaj!''!*-r   c                    | j                  t              }| j                  t        j                  j                  dd      t        d             | j                  t        j                  j                  dd      t        d             | j                  t        j                  j                  dd      t        d             | j                  |t        d             |dz  j                         }| j                  ||       | j                  t        |      t               |dz  j                         }| j                  ||       | j                  t        |      t               |dz  j                         }| j                  ||       | j                  t        |      t               |dz  j                         }| j                  ||       | j                  t        |      t               t        j                         }t        j                  t               	 | j                  d      j                         }| j                  ||       | j                  t        |      t               | j                  d      j                         }| j                  ||       | j                  t        |      t               | j                  d      j                         }| j                  ||       | j                  t        |      t               | j                  d      j                         }| j                  ||       | j                  t        |      t               t        j                  |       y # t        j                  |       w xY w)Nlink0link1r  link3)r1   r/  rb  r   rt   r.  r  r?   r}  r\   r  rE  )r   link0_targetrA   r7   old_paths        r   _check_complex_symlinksz%_BasePathTest._check_complex_symlinksg
  s   HHTNRWW\\'73T']CRWW\\'73T']CRWW\\'73T']C\4=1 [!!#A  Q.[!!#A  Q.[!!#A  Q.[!!#A  Q. 99;
	!))+AQ"$$SVT2!))+AQ"$$SVT2!))+AQ"$$SVT2!))+AQ"$$SVT2HHXBHHXs   E M0 0Nc                 .    | j                  t               y r   )r  r/  re   s    r   test_complex_symlinks_absolutez,_BasePathTest.test_complex_symlinks_absolute
  s    $$T*r   c                 &    | j                  d       y )Nrc   )r  re   s    r   test_complex_symlinks_relativez,_BasePathTest.test_complex_symlinks_relative
  s    $$S)r   c                 b    | j                  t        j                  j                  dd             y )NrL  r  )r  r   rt   r.  re   s    r   &test_complex_symlinks_relative_dot_dotz4_BasePathTest.test_complex_symlinks_relative_dot_dot
  s    $$RWW\\&$%?@r   c                 |    | j                  t              5  | j                  d       d d d        y # 1 sw Y   y xY w)Nrk   )rj   )r2  r3  r1   re   s    r   test_passing_kwargs_deprecatedz,_BasePathTest.test_passing_kwargs_deprecated
  s4    01 	 HHH	  	  	 s   2;)T)lr   r   r   __doc__r8   r   r  rb  rq  rz  r}  r  r  r  r  unittestskipIfrc  r  r  r  r  r   r  r  r  r  r  r  r  r   skip_unless_symlinkr  r  r  r  r  r	  r  r  r  r"  r)  r,  r5  r9  r:  rA  rG  rJ  skip_unless_working_chmodrQ  
only_posixrS  rW  rY  r[  r^  r`  
skipUnlessr<  rk  rA  rq  ru  rx  hasattrr  r  r  r  r  r  r  r  r  r  r  r   r  only_ntr  r  r  r  r  r  r  r  r  r  r  sysplatformr  r  r  r  r  r  r  r@  r  r  r  r  r  r  rU   r   r   rD  rD    s   I,BB 
ww$	<	"*
;
M)Z,) X__tF
-
-5*G(1
 X__W:;N <N8&
BAR`(B ""* #*HL>
:)3V ""9 #9$."W ""= #=& ""@ #@	"&
 9GF5"":Q #:Qx ""A #A( ((
5 )
5 ((5 ) 5 ((* )* ""? #?
<
 ""+ #+
(
 XFG* H* XFG* H**"
* XV,.HI( J(" X__WR(*@A B("(" ""% #%<0B	;F2
<<" X__]$OPC QC
 7 7
;
;(< "". #..8:8> =: XX.0FGX__S\\Y.;=
E= H
E< X35LMX__H X__0G NG BA	M2.'R ""+ #+ ""* #* ""A #A r   rD  c                       e Zd Zd Zd ZddZd Zd Zej                  d        Z
ej                  d        Zd	 Zd
 Zd Zy)	WalkTestsc                    | j                  t        j                  t        j                         t	        j
                  t        j                  d      | _        | j                  dz  | _        | j                  dz  | _        | j                  dz  | _	        | j                  dz  }| j                  dz  }| j                  dz  }| j                  dz  }|dz  }| j                  d	z  | _
        t	        j
                  t        j                  d
      }t	        j
                  t        j                  d
d      }| j                  dz  }| j                  dz  }	| j                  dz  }
t        j                  | j                         t        j                  | j                         t        j                  |       t        j                  |       |||||fD ].  }t        |dd      5 }|j                  d| d       d d d        0 t        j                         rt        j                   t        j"                  j%                  |      | j                         t        j                   d|d       t        j                   t	        j
                  dd      |	d       t        j                   t	        j
                  dd      |
d       | j                  dgg df| _        n| j                  dgdgf| _        t(        st        j*                  |d       	 t        j,                  |       t        j*                  |t.        j0                         t        j2                  |       t        j4                  |       | j&                  d   d d= y # 1 sw Y   xY w# t6        $ r2 | j                  t        j*                  |t.        j0                         Y y w xY w)NTEST1SUB1SUB11SUB2SUB21tmp1tmp2tmp3r  TEST2tmp4broken_linkbroken_link2broken_link3rZ   r  r  zI'm z' and proud of it.  Blame test_pathlib.
brokenTtmp5)r3  r4  r5  r  r0  r   r   )r\  r   rJ  r	   r   r%  	walk_path	sub1_path
sub11_path	sub2_path	link_pathr   makedirsr^  r_  r`  ra  rt   r4  	sub2_treer   rI  listdirr  S_IRWXUrp  rw  r  )r   
sub21_path	tmp1_path	tmp2_path	tmp3_path	tmp5_patht2_path	tmp4_pathbroken_link_pathbroken_link2_pathbroken_link3_pathrt   rc  s                r   r8   zWalkTests.setUp
  s   	(()*:*:;& !i&6&6@&0..72&0NNW,
NNV+	NNV+	NNV+	'	&0,,y//9LL!1!17FC	>>M9 NN^; NN^;
DOO$
DNN#
J
Gy)Y	I 	ODdC'2 Oa$tf$LMNO O	O   "JJrwww/@JJx!148JJw||FH57H$OJJw||GV46GN"nnwi/0DN #nnwi&BDNHHZ#	&JJz" HHZ.IIi HHZ q!"1"%3O O&  	@OOBHHj$,,?	@s   M>N >N	8OOc                 h   | j                   j                         }t        |      }|d   j                          | j	                  || j                   ddgdgf       t        |      }| j	                  || j
                  dgdgf       t        |      }| j	                  || j                  g g f       t        |      }|d   j                          |d   j                          | j	                  || j                         | j                  t              5  t        |       d d d        y # 1 sw Y   y xY w)Nr   r*  r,  r.  r+  r/  r   )
r8  r  r  sortr?   r9  r:  r>  rH   StopIteration)r   walkerentrys      r   test_walk_topdownzWalkTests.test_walk_topdown
  s    $$&Va&&1AF8 LMV'VH EFV"b 9:Vaa/}- 	L	 	 	s   D((D1Nc                    || j                   }g }|j                         D ]0  \  }}}|j                  |||f       d|v s |j                  d       2 | j	                  t        |      d       | j	                  |d   | j                   dgdgf       |d   d   j                          |d   d   j                          | j	                  |d   | j                         y )Nr*  r   r   r,  r.  r   r   )r8  r  r   remover?   r   rL  r>  )r   r8  allrs   dirsfiless         r   test_walk_prunezWalkTests.test_walk_prune
  s    I!*!1 	$D$JJdE*+~F#		$ 	S1%Q$..6(VH!EFAr
Aq	Q0r   c                 h    | j                  t        | j                        j                                y r   )rV  r
   r8  r   re   s    r   test_file_like_pathzWalkTests.test_file_like_path
  s"    Xdnn5@@BCr   c                 <   dx}x}x}}| j                   j                  d      D ]  \  }}}|| j                   k(  rf| j                  |       | j                  |       | j                  |       | j	                  t        |      ddg       | j	                  |dg       d}}|| j                  k(  r\| j                  |       | j                  |       | j                  |       | j	                  |dg       | j	                  |dg       d}|| j                  k(  rJ| j                  |       | j                  |       | j	                  |g        | j	                  |g        d}A|| j                  k(  r| j                  |       | j                  |       | j	                  t        |      t        | j                  d	                | j	                  t        |      t        | j                  d
                d}t        d|        | j                  |       y )NFtop_downr*  r,  r.  Tr+  r/  r   r   zUnexpected path: )r8  r  r   r   r?   r   r9  r:  r;  r>  AssertionError)r   seen_testfn	seen_sub1
seen_sub11	seen_sub2rt   r  r  s           r   test_walk_bottom_upzWalkTests.test_walk_bottom_up  s   ;@@@i@*y)-)<)<e)<)L 	A%D(It~~%  -	*	*  !1FF3CD  VH5"'  -  +
+  G95  VH5 	(  +  ,  2.  B/!
'  -  +  !16$..:K3LM  	!2F4>>!;L4MN 	$'8%?@@9	A: 	$r   c                     | j                   j                  d      }|D ]<  \  }}}|| j                  k(  s| j                  |g        | j                  |dg        y  | j	                  d       y )NTr  r2  z/Didn't follow symlink with follow_symlinks=True)r8  r  r<  r?   failr   walk_itrs   rT  rU  s        r   test_walk_follow_symlinksz#WalkTests.test_walk_follow_symlinks.  sq    ..%%d%;!( 	ID$t~~%  r*  1		I IIGHr   c                 N   | j                   j                  d      }|D ])  \  }}}|| j                  k(  s| j                  d|        n | j	                  d       | j                   j                  d      }|D ])  \  }}}|| j                  k(  s| j                  d|        y  y )NFr  r  zsymlink not foundT)r8  r  r;  r  rc  rd  s        r   test_walk_symlink_locationz$WalkTests.test_walk_symlink_location9  s     ..%%e%<!( 	+D$t~~%fe,	+
 II)*..%%d%;!( 	D$t~~%fd+	r   c                 $   g }| j                   j                  |j                        }t        |      \  }}}| j	                  |g        d}||z  }||z  j                  d      }|j                  |       	 |D 	
cg c]  \  }	}
}
|	
 }}	}
| j                  |       | j                  ||       | j                  ||       |D ]  }||k7  s	| j                  ||z  |        	 |j                  |       y c c}
}	w # |j                  |       w xY w)N)on_errorr*  z.new)
r8  r  r   r  r?   rN   r  r   r  r  )r   r  re  rs   rT  rU  r  path1path1newr   _rootsr  s                r   test_walk_bad_dirzWalkTests.test_walk_bad_dirK  s   ..%%v}}%= MdE$t4K,,V4X		#&-.71aQ.E.OOF#UE*Xu- 64<MM$+u56 OOE" / OOE"s%   7C< <C6	AC< C< 6C< <Dc                    d}t        j                  t        j                  d      }t        j                  |gdg|z   }|j	                  d       t        d      D cg c]  }|j                  d       }}t        |d	z         D ]:  }||rdgng g f}|D ]  }| j                  t        |      |        |j                  }< t        d      D cg c]  }|j                  d       }}|}t        |d	z         D ]6  }|||k  rdgng g f}|D ]  }| j                  t        |      |        |dz  }8 y c c}w c c}w )
Nr  r  r)   Tr  r  FrZ  r   )
r   r%  r   r	   r]  r9  r  r?   r  rn   )	r   r  r  rt   rm  r  r  rz   r  s	            r   test_walk_many_open_filesz#WalkTests.test_walk_many_open_files_  sJ   ||I,,f5||D1SE%K1

4
 49#J?qE*??uqy! 	Aqseb"5H 5  b845;;D		 49:>aD)>>uqy! 	Aq5yseb"=H 5  b845#:D		 @ ?s    D8D=c                 Z   d}|dz   }t        j                  t        j                  d      }t        j                  |gdg|z   }|j	                  d       t        |      5  t        |j                                t        |j                  d             d d d        y # 1 sw Y   y xY w)	N(   r$  r  r)   Tr  FrZ  )r   r%  r   r	   r]  r   r   r  r&  s        r   test_walk_above_recursion_limitz)WalkTests.test_walk_above_recursion_limitt  s    )B.||I,,f5||D=SEO$;=

4
  1 	,E*+	, 	, 	,s   #5B!!B*r   )r   r   r   r8   rP  rV  rX  ra  r   r  rf  rh  ro  rq  rt  rU   r   r   r'  r'  
  sd    C&J 1$D%B ""I #I "" #"#(*
,r   r'  c                   6    e Zd Zej                  Zd Zd Zd Zy)PathTestc                     | j                  d      }| j                  t        |      t        j                  dk(  rt
        j                         y t
        j                         y r$  )r1   r^   r   r   r  r   rB  r5  r6   s     r   r&  zPathTest.test_concrete_class  sD    HHSMd1g#%77d?G	K8?8I8I	Kr   c                     t         j                  dk(  r%| j                  t        t        j
                         y | j                  t        t        j                         y )Nr%  )r   r  rH   r:  r   r5  rB  re   s    r   test_unsupported_flavourz!PathTest.test_unsupported_flavour  s;    77d?173D3DE173F3FGr   c                     | j                         }| j                  t        d      5  t        |j	                  d             d d d        y # 1 sw Y   y xY w)NzUnacceptable patternr'   )r1   rF   r   r   r  r6   s     r   test_glob_empty_patternz PathTest.test_glob_empty_pattern  sC    HHJ##J0FG 		 	 	s   AAN)	r   r   r   r   r%  r1   r&  ry  r{  rU   r   r   rv  rv    s    
,,CK
Hr   rv  c                      e Zd Zej                  Zd ZdddZ ej                  e
xs ed      d        Zd Z ej                  e
xs ed      d        Zej                   d	        Zd
 Zd Z ej(                   eed      d       ej                  ej0                  dk(  d      d               Z ej                  ej0                  dk7  d      d        Zy)PosixPathTestc                 P   | j                   }| j                  t         |d      j                               d       | j                  t         |d      j                               d       | j                  t         |d      j                               d       | j                  t         |d      j                               d       | j                  t         |d      j                               d       | j                  t         |d      j                               d       y )Nr+   r*   r   rE  rD  rN  )r1   r?   r\   r  r   s     r   test_absolutezPosixPathTest.test_absolute  s    HHQsV__./5QtW--/0$7QvY//12F; 	QtW--/0$7QuX..0159QwZ0023W=r   Tr.  c                     | j                   | }| j                  t              5  t        |j	                  |             d d d        y # 1 sw Y   y xY wr   )r1   rH   RuntimeErrorprintr  )r   r+  r_   rt   s       r   _check_symlink_loopz!PosixPathTest._check_symlink_loop  sE    txx|, 	($,,v&'	( 	( 	(s   A		Az,umask is not implemented on Emscripten/WASI.c                    t        j                  d      }| j                  t         j                  |       | j                  t              }|dz  j                  d      5  	 d d d        t        j                  t        d            }| j                  t        j                  |j                        d       t        j                  d       |dz  j                  d      5  	 d d d        t        j                  t        d            }| j                  t        j                  |j                        d       y # 1 sw Y   xY w# 1 sw Y   cxY w)Nr   new_filerQ       other_new_file  )r   umaskr\  r1   r/  r^  r  r.  r?   r  rN  r   old_maskr7   rV  s       r   test_open_modezPosixPathTest.test_open_mode  s    
 88A;(+HHTN*n""4( 		WWT*%&bjj159
""((. 		WWT*+,bjj159	 	
	 	s   D7E7E Ec                 *   t        j                         }	 t        j                  d       | j                  d      }| j	                  t        |j                               d       t        j                  |       y # t        j                  |       w xY w)Nr+   r0  z/spam)r   r  rE  r1   r?   r\   r  )r   current_directoryr7   s      r   test_resolve_rootzPosixPathTest.test_resolve_root  sb    IIK	(HHSM AS-w7HH&'BHH&'s   AA; ;Bc                    t        j                  d      }| j                  t         j                  |       | j                  t              }|dz  j                          t        j                  t        d            }| j                  t        j                  |j                        d       t        j                  d       |dz  j                          t        j                  t        d            }| j                  t        j                  |j                        d       |dz  j                  d	       t        j                  t        d            }| j                  t        j                  |j                        d       y )
Nr   r  r  r  r  r  masked_new_filei  )rO  )r   r  r\  r1   r/  r  r  r.  r?   r  rN  r  s       r   test_touch_modezPosixPathTest.test_touch_mode  s   
 88A;(+HHTN	
Z WWT*%&bjj159
	
	$$&WWT*+,bjj159	
	%%5%1WWT+,-bjj159r   c                    t        j                  dt        d             | j                  t        d       t        j                  dt        d             | j                  t        d       t        j                  dt        d             | j                  t        d       | j                  t        ddd       t        j                  t        d	      t        d
             | j                  t        d
       t        j                  t        d      t        d             | j                  t        d       t        j                  t        d      t        d             | j                  t        d       | j                  t        ddd       y )NzlinkX/insider2  r3  zlinkZ/../linkZlinkZrj   Fr.  zlinkU/insidelinkUlinkVzlinkW/../linkWlinkW)r   ra  r.  r  r/  re   s    r   test_resolve_loopzPosixPathTest.test_resolve_loop  s    	

>4=1  w/


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


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


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


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


4()4=9  w/  we Dr   c                 :   | j                   } |t              }t        |j                  d            }t	        j
                  t              s
t               n|}| j                  ||       | j                  t        |j                  d            t                      y )NFILEazFILEa*)r1   r/  r  r  r   fs_is_case_insensitiver?   r   rA   r7   r  r  s        r   	test_globzPosixPathTest.test_glob  sl    HHdGAFF7O$'>>tD%'QVVH-.6r   c                 <   | j                   } |t        d      }t        |j                  d            }t	        j
                  t              s
t               n|}| j                  ||       | j                  t        |j                  d            t                      y )NrN  FILEdzFILEd*)r1   r/  r  r  r   r  r?   r  s        r   
test_rglobzPosixPathTest.test_rglob  so    HHdFOAGGG$%'>>tD%'QWWX./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                  j                  d      xs d} |j                         D ]3  }|j                  }|j                  j                  d      }||k7  s0|s3 n |}|}d}	  |j                  |      r|dz  } |j                  |      r |d      }	 |d| d      }
 |d| d      } |d	| d      } |d
| d      } |d      } |d| d      }t        j                         5 }|j                  dd        | j!                  |	j#                          ||      dz         | j!                  |
j#                          ||      dz         | j!                  |j#                          ||      dz         | j!                  |j#                         |       | j!                  |j#                         |       | j!                  |j#                         |       | j%                  t&        |j"                         d|d<   | j!                  |	j#                          |d             | j!                  |
j#                          ||      dz         | j!                  |j#                          ||      dz         | j!                  |j#                         |       | j!                  |j#                         |       | j!                  |j#                         |       | j%                  t&        |j"                         d d d        y # t        $ r Y w xY w# 1 sw Y   y xY w)Nrc  r   r+   fakeuserr=  z~/Documentsr  z
/Documentsr  r  r'   r  	Documentsz/tmpz/tmp/Documents)r1   r   import_modulerc  rd  r   getuidre  pw_dirrstripr  getpwnamrf  r   r  r  r?   r  rH   r  )r   rA   rc  pwdentusernameuserhome	othername	otherhomefakenamep1p2p3p4p5p6p7r  s                    r   test_expanduserzPosixPathTest.test_expanduser  s   
 HH##E*biik*>>=='',3"clln 	!FI,,S1IH$		! !I I	#,,x(C #,,x(
 }8*J'(9+Z()hZz*+H:Z()rU8*J'(**, 	;GGFD!R]]_akK.GHR]]_akK.GHR]]_a	l[.HIR]]_b1R]]_b1R]]_b1lBMM: CKR]]_a0@.ABR]]_akK.GHR]]_a	l[.HIR]]_b1R]]_b1R]]_b1lBMM:%	; 	;  			; 	;s   )M! HM1!	M.-M.1M:darwinz1Bad file descriptor in /dev/fd affects only macOSc                    	 t        t        j                  d      j                  d            dd  }|s| j	                  d       |D ]  }|j                          |j                          |j                          |j                          |j                          |j                          |j                          |j                           y # t        $ r4}|j                  t        j                  k(  r| j!                  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   r   r%  r  r[  r  r  r  r  r  r  r  r  r  ru  EBADFrc  )r   file_descriptorsrc  r  s       r   test_handling_bad_descriptorz*PosixPathTest.test_handling_bad_descriptor5  s    	#GLL$;$A$A#$FGK#NO & 

		!!#  "		  	ww%++%		<=	s   C
C 	D
/DD
N)r   r   r   r   r5  r1   r  r  r  r  r   r   r  r  r  r   r  r  r  r  r!  r"  rc  r$  r%  r  r  rU   r   r   r}  r}    s   


C	> 15 (
 X__ 6:	:( X__ 6:	: ""E #E(78 Xj1@BX__S\\Y.353;5B3;j X__S\\X-HJJr   r}  c                   <    e Zd Zej                  Zd Zd Zd Zd Z	y)WindowsPathTestc           
         | j                   }| j                  t         |d      j                               d       | j                  t         |d      j                               d       | j                  t         |d      j                               d       d}| j                  t         ||      j                               |       | j                  t         ||dz         j                               |dz          | j                  t         ||dz         j                               |dz          t	        j
                  d      5 }||_        | j                  t         |       j                               |       | j                  t         |d      j                               |       | j                  t         |d      j                               t        j                  j                  |d             | j                  t         |dd	d
      j                               t        j                  j                  |dd	d
             d d d        t        j                  j                  t              d   }t        j                  t              5  | j                  t         |d      j                               |dz          | j                  t         |d      j                               |dz          | j                  t         ||      j                               t               | j                  t         ||dz         j                               t        j                  j                  t        d             d d d        t        j                  t              5 }t        j                         }| d}t        j                   |       t        j                   |       | j                  t         ||      j                               |       | j                  t         ||dz         j                               |dz          d d d        y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   y xY w)Nr  rI  rr  z\\server\share\r!   za\br  rc   r"   r:   r   r  z\foorj   z\dirA)r1   r?   r\   r  r   r  r  r   rt   r.  
splitdriver/  r   
change_cwdsubst_driver  rE  )r   rA   r  r  rr   other_drive	saved_cwd	other_cwds           r   r  zWindowsPathTest.test_absoluteQ  sg   HH 	QvY//12F;QwZ0023W=Qz]3356
C &QuX..0159Qus{^4467EQuv~.779:EFNK ZZ$ 	A"'FS0%8S3!23U;S3!23RWW\\%5MNS3S!1!:!:!<=WW\\%c3?A	A ""4(+!!$' 	ZS4!1!1!34edlCS7!4!4!67I S5!2!2!45t<S55=!1!:!:!<=rww||DRW?XY	Z ""4( 		ZK		I&-v.IHHYHHY S;!8!8!:;YGS;#6!7!@!@!BCYQXEXY		Z 		Z'	A 	A	Z 	Z		Z 		Zs'   
DQC,Q!B(Q+QQ(+Q4c           
      h   | j                   } |t              }| j                  t        |j	                  d             |t        d      h       | j                  t        |j	                  d             |t        d      h       | j                  t        |j	                  d             |t        d      h       | j                  t        t        t        |j	                  d                  | dh       | j                  t        t        t        |j	                  d                  | dh       y )Nr  rP  z*a\rL  zF*az\fileA)r1   r/  r?   r  r  mapr\   r@   s      r   r  zWindowsPathTest.test_glob~  s    HHdGQVVG_-41A/CDQVVF^,$.ABQVVE]+qw/?-ABSaffWo67QCw-ISaffUm451#WGr   c           
         | j                   } |t        d      }| j                  t        |j	                  d             |t        d      h       | j                  t        |j	                  d             |t        d      h       | j                  t        t        t        |j	                  d                  | dh       y )NrN  r  r  z*\r  z\dirD\fileD)r1   r/  r?   r  r  r  r\   r@   s      r   r  zWindowsPathTest.test_rglob  s    HHdFOQWWW-.!D:K2L0NOQWWU^,$0D.FGSaggg&678aS;N:OPr   c           
         	  j                   t        j                         5 j                  dd        j                  dd        j                  dd        j                  dd        dd<    d       d       d	       d
       d       d      	 j	                  t
        j                          j	                  t
        j                          j	                  t
        j                          j                  j                                 j                  j                                 j                  	j                         	       	 f	d}dd<    |        dd<   dd<    |        j                  dd        j                  dd        dd<    |        dd<    |        d d d        y # 1 sw Y   y xY w)Nr  r  HOMEPATH	HOMEDRIVEaliceUSERNAMEz~/My Documentsz~alice/My Documentsz~bob/My Documentsz/~/My Documentszd:~/My Documentsr'   c                    	 j                  dd        j                  j                           d             j                  t        j                         dd<   j                  j                           d             j                  j                           d             j                  j                                j                  j                                j                  j                                y )Nr  zC:/Users/alice/My Documentsr  zC:/Users/bob/My Documents)r  r?   r  rH   r  )	rA   r  r  r  r  r  r  r  r   s	   r   r   z.WindowsPathTest.test_expanduser.<locals>.check  s    
D)  !"#@!AC!!,>")J  !"#@!AC  !"#>!?A  "5  "5  "5r   zC:\Users\alicer  zUsers\alicezC:\Users\eve)r1   r   r  r  rH   r  r  r?   )
r   r   rA   r  r  r  r  r  r  r  s
   ` @@@@@@@@r   r  zWindowsPathTest.test_expanduser  s   HH**, 1	GGFD!GGM4(GGJ%GGK&%C
O #$B()B&'B$%B%&B2BlBMM:lBMM:lBMM:R]]_b1R]]_b1R]]_b16 6 1C
OG%C,C
OGGGK&GGJ%!3CG +CKGc1	 1	 1	s   F$GG N)
r   r   r   r   rB  r1   r  r  r  r  rU   r   r   r  r  M  s%    


C+ZZHQ3r   r  c                   :    e Zd Z G d dej                        ZdZy)PurePathSubclassTestc                       e Zd Zy)PurePathSubclassTest.clsNrT   rU   r   r   r1   r        r   r1   N)r   r   r   r   r,  r1   r   rU   r   r   r  r    s    g   r   r  c                   :    e Zd Z G d dej                        ZdZy)PathSubclassTestc                       e Zd Zy)PathSubclassTest.clsNrT   rU   r   r   r1   r    r  r   r1   N)r   r   r   r   r%  r1   r   rU   r   r   r  r    s    gll   r   r  c                   0    e Zd ZdZ G d d      Zd Zd Zy)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y)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                     || _         y r   )string)r   r  s     r   r   z&CompatiblePathTest.CompatPath.__init__  s	     DKr   c                 B     t        |       | j                   d|       S rw   r   r  r   others     r   __truediv__z)CompatiblePathTest.CompatPath.__truediv__  s"    4:Qug677r   c                 B     t        |       | d| j                         S rw   r  r  s     r   __rtruediv__z*CompatiblePathTest.CompatPath.__rtruediv__  s"    4:q677r   N)r   r   r   r  r   r  r  rU   r   r   
CompatPathr    s    		!	8	8r   r  c                 F   t        j                  d      | j                  d      z  }| j                  || j                         | j	                  |j
                  d       | j                  t              5  t        j                  d      dz   d d d        y # 1 sw Y   y xY w)Ntestrightz
test/rightr$  )r   r,  r  r>   r?   r  rH   rG   r   results     r   test_truedivzCompatiblePathTest.test_truediv  s~    !!&)DOOG,DDfdoo65y) 	*V$r)	* 	* 	*   5BB c                 F   | j                  d      t        j                  d      z  }| j                  || j                          | j	                  |j
                  d       | j                  t              5  dt        j                  d      z   d d d        y # 1 sw Y   y xY w)Nleftr  z	left/testr$  )r  r   r,  r>   r?   r  rH   rG   r  s     r   test_rtruedivz CompatiblePathTest.test_rtruediv  s~    (7+;+;F+CCfdoo64y) 	*!!&))	* 	* 	*r  N)r   r   r   r  r  r  r  rU   r   r   r  r    s    
8 8 **r   r  __main__)6
contextlibcollections.abcr  r  r   r$  ru  r   r:  r  r  r7  r  r   test.supportr   r   r   r   r   test.support.os_helperr	   r
   rk  rc  ImportErrorr  r   r   TestCaserB  rw  r"  rt   realpathr/  r.  r~  r  r  r#  r   r4  r7  rD  r'  rv  r}  r  r  r  r  r   mainrU   r   r   <module>r     s4     	 	 
         & , / " 3EF Eh
. h
.V[ )8+<+< [ |d
@+X->-> d
@L$h&7&7 > 
ww(.
(//"''T/EGX__RWW_FH
 +   	/  	L F L ^$],!! ],@}h// ( tM8#4#4 t tn 	smX%6%6 s 	sl ,h.?.?   }h&7&7  &*** &*R zHMMO Mg  C#s   H   	HH