+
    Dfj&                      R t ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
Ht ^ RIHtHtHtHtHtHtHtHtHt ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ R	IHtHt ^ R
I H!t! ^ RI"H#t# ^ RI$H%t& ]!PN                  ! 4       '       * t( ! R R]&4      t) ! R R])4      t* ! R R]PV                  ],          4      t,]PB                  R8w  d    ! R R4      t- ! R R])4      t. ! R R4      t/ ! R R]PV                  ],          4      t0 ! R R]PV                  ],          4      t1]! R4      t2 ! R R ])4      t3 ! R! R"]*4      t4 ! R# R$])4      t5 ! R% R&]&4      t6R# )'z1
Test cases covering L{twisted.python.filepath}.
)annotationsN)pformat)	IOAnyStrCallableDictListOptionalTupleTypeVarUnion)skipIf)verifyObject)NoReturn)filepath)FileModeOtherAnyStr)platform)ERROR_DIRECTORY)SynchronousTestCasec                  &    ] tR t^"tRtR R ltRtR# )BytesTestCasez@
Override default method implementations to support byte paths.
c                   V ^8  d   QhRR/# )   returnbytes )formats   "9/usr/lib/python3/dist-packages/twisted/test/test_paths.py__annotate__BytesTestCase.__annotate__'   s     5 5 5    c                L    \         P                  ! V 4      P                  R4      # )z,
Return a temporary path, encoded as bytes.
utf-8)TestCasemktempencodeselfs   &r   r%   BytesTestCase.mktemp'   s     t$++G44r!   r   N)__name__
__module____qualname____firstlineno____doc__r%   __static_attributes__r   r!   r   r   r   "   s    5 5r!   r   c                     ] tR t^.tRtRtRtR R ltR R ltR R	 lt	R
 R lt
R R ltR R ltR R ltR R ltR R ltR R ltR R ltR R ltR R ltR R ltR  R! ltR" R# ltR$ R% ltR& R' ltR( R) ltR*tR+# ),AbstractFilePathTestsz)
Tests for L{IFilePath} implementations.
   file 1s   file 2c                    V ^8  d   QhRRRR/# )r   pr   r   r   )r   s   "r   r   "AbstractFilePathTests.__annotate__6   s      % E r!   c                	    \         P                  P                  \         P                  P                  ! V P                  .VO5!  4      pV P
                  P                  V4       V# N)ospathabspathjoincmnallappend)r(   r4   xs   &* r   _mkpathAbstractFilePathTests._mkpath6   s?    GGOOBGGLL6A67r!   c                    V ^8  d   QhRRRR/# )r   dirnamer   r   Noner   )r   s   "r   r   r5   ;   s     ) )u ) )r!   c                	N    \         P                  ! V P                  ! V!  4       R # r7   )r8   mkdirr@   r(   rC   s   &*r   subdirAbstractFilePathTests.subdir;   s    
w'(r!   c                    V ^8  d   QhRRRR/# )r   rC   r   r   zio.BufferedWriterr   )r   s   "r   r   r5   >   s     2 2 2*; 2r!   c                	6    \        V P                  ! V!  R 4      # )wb)openr@   rG   s   &*r   subfileAbstractFilePathTests.subfile>   s    DLL'*D11r!   c                   V ^8  d   QhRR/# r   r   rD   r   )r   s   "r   r   r5   A   s     , ,t ,r!   c                	   \         P                   ! 4       V n        \        P                  P	                  V P                  4       4      ;qn        V.V n        \        P                  ! V4       V P                  R 4       V P                  R4      ;_uu_ 4       pVP                  V P                  4       RRR4       V P                  R R4      ;_uu_ 4       pVP                  V P                  4       RRR4       V P                  R4       V P                  RR4      P                  4        V P                  RR4      P                  4        V P                  RR4      P                  4        \        P                   ! V4      V n        \        P                   ! R4      V n        R#   + '       g   i     L; i  + '       g   i     L; i)	   sub1   file1N   file2   sub3
   file3.ext1s
   file3.ext2s
   file3.ext3   /)timenowr8   r9   r:   r%   r<   r=   rF   rH   rN   write	f1content	f2contentcloser   FilePathroot)r(   r<   fs   &  r   setUpAbstractFilePathTests.setUpA   s   99;77h5
G\\(##qGGDNN# $\\'8,,GGDNN# -GWm,224Wm,224Wm,224%%c*	%%d+	 $#,,s   F!F4!F1	4G	c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r5   R   s     E E4 Er!   c                l    V P                  \        \        P                  V P                  4      4       R# )z?
Instances of the path type being tested provide L{IFilePath}.
N)
assertTruer   r   	IFilePathr9   r'   s   &r   test_verifyObject'AbstractFilePathTests.test_verifyObjectR   s!     	X%7%7CDr!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r5   X   s     
 
4 
r!   c                    V P                  V P                  P                  R4      P                  R4      P                  R4      P                  V P                  4      . RO4       R# )zF
Verify that the segments between two paths are correctly identified.
   a   b   cNrl   rm   rn   )assertEqualr9   childsegmentsFromr'   s   &r   test_segmentsFromPositive/AbstractFilePathTests.test_segmentsFromPositiveX   sJ     	IIOOD!''-33D9FFtyyQ	
r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r5   a   s     
 
4 
r!   c                $   V P                  \        V P                  P                  R4      P                  R4      P                  R4      P                  V P                  P                  R4      P                  R4      P                  R4      4       R# )zG
Verify that segmentsFrom notices when the ancestor isn't an ancestor.
rl   rm   rn      d   eN)assertRaises
ValueErrorr9   rq   rr   r'   s   &r   test_segmentsFromNegative/AbstractFilePathTests.test_segmentsFromNegativea   sg     	IIOOD!''-33D9FFIIOOD!''-33D9	
r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r5   k   s     0 04 0r!   c                    V P                   P                  4        Uu. uF  qP                   NK  	  ppV P                  \        V4      \        V P                  4      4       R# u upi )zQ
Verify that walking the path gives the same result as the known file
hierarchy.
N)r9   walkrp   setr=   )r(   foor?   s   &  r   	test_walkAbstractFilePathTests.test_walkk   sH    
 "&!12!1#XX!12QTXX/ 3s   A#c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r5   s   s     A Ad Ar!   c                   . pV P                   P                  R4      P                  R4      P                  R4      pVP                   pTp\        P                   P                  V4      pW@P                  P                   8w  d5   VP                  V4       Tp\        P                   P                  V4      pKN  T P                  VP                  4        Uu. uF  qfP                   NK  	  upV4       R# u upi )zc
L{FilePath.parents()} should return an iterator of every ancestor of
the L{FilePath} in question.
rl   rm   rn   N)r9   rq   r8   rC   r`   r>   rp   parents)r(   Lpathobjfullpathlastpaththispathr?   s   &      r   test_parents"AbstractFilePathTests.test_parentss   s    
 ))//$'--d399$?<<77??8,))..(HHXHwwx0H'//*;<*;Q&&*;<a@<s   C2c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r5      s     
5 
5$ 
5r!   c                ~   V P                   P                  R4      pV P                  VP                  4       R4       V P                  VP	                  4       R4       V P                  VP                  4       R4       V P                  VP                  4       R4       V P                  VP                  4       R.4       R# )zu
Verify that a valid subdirectory will show up as a directory, but not as a
file, not as a symlink, and be listable.
rS   zThis directory does exist.zIt's a directory.rU   N)
r9   rq   rf   existsisdirassertFalseisfileislinkrp   listdir)r(   sub1s   & r   test_validSubdir&AbstractFilePathTests.test_validSubdir   s    
 yyw''CD

&9:(;<(;<(4r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r5      s     J JD Jr!   c                |    V P                   P                  R4      pV P                  VP                  4       R4       R# )zD
Verify that a subdirectory that doesn't exist is reported as such.
   sub2zThis directory does not exist.N)r9   rq   r   r   )r(   sub2s   & r   test_invalidSubdir(AbstractFilePathTests.test_invalidSubdir   s-     yyw'(HIr!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r5      s     	7 	7 	7r!   c                
   V P                   P                  R4      pVP                  4       ;_uu_ 4       pV P                  VP	                  4       V P
                  4       RRR4       V P                   P                  R4      P                  R4      pVP                  4       ;_uu_ 4       pV P                  VP	                  4       V P                  4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)z6
Make sure that we can read existent non-empty files.
rT   NrS   rU   )r9   rq   rM   rp   readr\   r]   )r(   f1ra   f2s   &   r   test_validFiles%AbstractFilePathTests.test_validFiles   s     YY__X&WWYY!QVVXt~~6 YY__W%++H5WWYY!QVVXt~~6 Y Y YYs   +C)+C1C.	1D	c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r5      s     + +D +r!   c                    V P                   P                  . RO4      pV P                   P                  R4      P                  R4      P                  R4      pV P                  W4       R# )zn
C{fp.descendant([a, b, c])} returns the same L{FilePath} as is returned
by C{fp.child(a).child(b).child(c)}.
rl   rm   rn   Nro   )r9   
descendantrq   rp   )r(   multiplesingles   &  r   test_multipleChildSegments0AbstractFilePathTests.test_multipleChildSegments   sO    
 99''(:;&,,T288>*r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r5      s     * *T *r!   c                n   V P                   P                  R4      pV P                   P                  R4      pV P                   P                  R4      p/ p^WA&   ^WB&   V P                  WA,          ^4       V P                  \        VP	                  4       4      V.4       V P                  \        VP	                  4       4      ^ ,          V4       V P                  \        VP	                  4       4      ^ ,          V4       ^WC&   V P                  WC,          ^4       V P                  \        V4      ^4       R# )z;
Verify that path instances are usable as dictionary keys.
rT   rU   N)r9   rq   rp   listkeysassertIsassertIsNotlen)r(   r   f1primer   dictoids   &    r   test_dictionaryKeys)AbstractFilePathTests.test_dictionaryKeys   s     YY__X&))//(+YY__X&a(glln-t4d7<<>*1-r2glln-a0':a(Wq)r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r5      s     * *d *r!   c                    V P                   P                  R4      pVR/pRW!P                   &   V P                  \        V4      ^4       R# )zm
Verify that path instances are usable as dictionary keys which do not clash
with their string counterparts.
rT   hellogoodbyeN)r9   rq   rp   r   )r(   r   r   s   &  r   test_dictionaryKeyWithString2AbstractFilePathTests.test_dictionaryKeyWithString   s?    
 YY__X&FH']$Wq)r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r5      s     
 
t 
r!   c                    V P                  \        P                  V P                  P	                  R4      P
                  4       R# )zU
Verify that children raises the appropriate exception for non-existent
directories.
s   not realNry   r   UnlistableErrorr9   rq   childrenr'   s   &r   test_childrenNonexistentError3AbstractFilePathTests.test_childrenNonexistentError   s0    
 	$$diiook&B&K&K	
r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r5      s     X X Xr!   c                    V P                  \        P                  V P                  P	                  R4      P
                  4       R# )zm
Verify that listdir raises the appropriate exception for attempting to list
a file rather than a directory.
rT   Nr   r'   s   &r   test_childrenNotDirectoryError4AbstractFilePathTests.test_childrenNotDirectoryError   s-    
 	(22DIIOOH4M4V4VWr!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r5      s     C C Cr!   c                p   V P                   V P                   P                  R4      3 F  pV P                  \        VP	                  4       4      \
        4       V P                  \        VP                  4       4      \
        4       V P                  \        VP                  4       4      \
        4       K  	  R# )zy
Verify that all times returned from the various new time functions are ints
(and hopefully therefore 'high precision').
rT   N)r9   rq   rp   typegetAccessTimefloatgetModificationTimegetStatusChangeTimer(   r4   s   & r   test_newTimesAreFloats,AbstractFilePathTests.test_newTimesAreFloats   s|    
 DIIOOH55AT!//"34e<T!"7"7"9:EBT!"7"7"9:EB 6r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r5      s     6 6d 6r!   c                p   V P                   V P                   P                  R4      3 F  pV P                  \        VP	                  4       4      \
        4       V P                  \        VP                  4       4      \
        4       V P                  \        VP                  4       4      \
        4       K  	  R# )za
Verify that all times returned from the various time functions are
integers, for compatibility.
rT   N)r9   rq   rp   r   getatimeintgetmtimegetctimer   s   & r   test_oldTimesAreInts*AbstractFilePathTests.test_oldTimesAreInts   su    
 DIIOOH55AT!**,/5T!**,/5T!**,/5 6r!   )r=   r<   rZ   r9   r`   N)r*   r+   r,   r-   r.   r\   r]   r@   rH   rN   rb   rh   rs   r{   r   r   r   r   r   r   r   r   r   r   r   r   r/   r   r!   r   r1   r1   .   s|     II
)2,"E

0A 
5J	7+*$*
XC6 6r!   r1   c                  &    ] tR t^tRtR R ltRtR# )FakeWindowsPathzN
A test version of FilePath which overrides listdir to raise L{WindowsError}.
c                   V ^8  d   QhRR/# )r   r   zList[AnyStr]r   )r   s   "r   r   FakeWindowsPath.__annotate__   s     
 
 
r!   c                :    \        RRV P                  \        4      h)z
@raise WindowsError: always.
Nz0A directory's validness was called into question)OSErrorr9   r   r'   s   &r   r   FakeWindowsPath.listdir   s!     >II	
 	
r!   r   N)r*   r+   r,   r-   r.   r   r/   r   r!   r   r   r      s    
 
r!   r   win32c                      ] tR tRtRtR# )WindowsErrori  r   N)r*   r+   r,   r-   r/   r   r!   r   r   r     s    r!   r   c                  ~    ] tR tRtRt]! ]P                  ! 4       '       * R4      R R l4       tR R lt	R R	 lt
R
tR# )ListingCompatibilityTestsi  zM
These tests verify compatibility with legacy behavior of directory listing.
zOnly relevant on on Windows.c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   &ListingCompatibilityTests.__annotate__  s     6 6 6r!   c                    \        V P                  4       4      pV P                  \        P                  VP
                  4       V P                  \        VP
                  4       R# )zV
Verify that when a WindowsError is raised from listdir, catching
WindowsError works.
N)r   r%   ry   r   r   r   r   )r(   fwps   & r   test_windowsErrorExcept1ListingCompatibilityTests.test_windowsErrorExcept  sB     dkkm,(22CLLA,5r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r     s     0 0 0r!   c                    \         P                  ! V P                  4       4      pV P                  \        VP
                  4       R# )zZ
Verify that in the normal case where a directory does not exist, we will
get an OSError.
N)r   r_   r%   ry   r   r   r(   fps   & r   test_alwaysCatchOSError1ListingCompatibilityTests.test_alwaysCatchOSError  s.    
 t{{}-'2;;/r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r   "  s     ! !T !r!   c                   \         P                  ! V P                  4       4      pV P                  \        VP
                  4      p\        VP                  P                  4       4      pVP                  R4       \        VP                  P                  P                  4       4      pVP                  4        VP                  4        V P                  W44       R# )zn
Verify that the Unlistable exception raised will preserve the attributes of
the previously-raised exception.
originalExceptionN)r   r_   r%   ry   r   r   r   __dict__r   remover   sortrp   )r(   r   osed1d2s   &    r   test_keepOriginalAttributes5ListingCompatibilityTests.test_keepOriginalAttributes"  s    
 t{{}-5#,,##%&
		%&#''005578
	
	 r!   r   N)r*   r+   r,   r-   r.   r   r   	isWindowsr   r   r   r/   r   r!   r   r   r     s?     ""$$&DE6 F60! !r!   r   c                  ^    ] tR tRtRtRtRR R lltR R ltR R	 ltR
 R lt	R R lt
RtR# )ExplodingFilei1  z
A C{file}-alike which raises exceptions from its I/O methods and keeps track
of whether it has been closed.

@ivar closed: A C{bool} which is C{False} until C{close} is called, then it
    is C{True}.
Fc                    V ^8  d   QhRRRR/# )r   nr   r   r   r   )r   s   "r   r   ExplodingFile.__annotate__<  s      c ( r!   c                    \        4       hz 
@raise IOError: Always raised.
r   )r(   r  s   &&r   r   ExplodingFile.read<       ir!   c                    V ^8  d   QhRRRR/# )r   whatr   r   r   r   )r   s   "r   r   r  B  s      % H r!   c                    \        4       hr  r  )r(   r
  s   &&r   r[   ExplodingFile.writeB  r  r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  H  s      t r!   c                    RV n         R# )z&
Mark the file as having been closed.
TNclosedr'   s   &r   r^   ExplodingFile.closeH  s     r!   c                   V ^8  d   QhRR/# )r   r   r   r   )r   s   "r   r   r  N  s      = r!   c                	    V # r7   r   r'   s   &r   	__enter__ExplodingFile.__enter__N  s    r!   c               (    V ^8  d   QhRRRRRRRR/# )r   exc_typeobject	exc_value	tracebackr   rD   r   )r   s   "r   r   r  Q  s)       F v RV r!   c                	&    V P                  4        R # r7   )r^   )r(   r  r  r  s   &&&&r   __exit__ExplodingFile.__exit__Q  s    

r!   r  N)    )r*   r+   r,   r-   r.   r  r   r[   r^   r  r  r/   r   r!   r   r   r   1  s,     F r!   r   c                  V    ] tR tRtRtRR R lltRR R lltR R	 ltRR
 R lltRt	R# )TrackingFilePathiU  a7  
A subclass of L{filepath.FilePath} which maintains a list of all other paths
created by clonePath.

@ivar trackingList: A list of all paths created by this path via
    C{clonePath} (which also includes paths created by methods like
    C{parent}, C{sibling}, C{child}, etc (and all paths subsequently created
    by those paths, etc).

@type trackingList: C{list} of L{TrackingFilePath}

@ivar openedFiles: A list of all file objects opened by this
    L{TrackingFilePath} or any other L{TrackingFilePath} in C{trackingList}.

@type openedFiles: C{list} of C{file}
Nc               (    V ^8  d   QhRRRRRRRR/# )	r   r9   r   alwaysCreatebooltrackingListzEOptional[List[Union[TrackingFilePath[str], TrackingFilePath[bytes]]]]r   rD   r   )r   s   "r   r   TrackingFilePath.__annotate__g  s2     / // /
	/ 
/r!   c                	n    \         P                  P                  WV4       Vf   . pVV n        . V n        R # r7   )r   r_   __init__r$  openedFiles)r(   r9   r"  r$  s   &&&&r   r'  TrackingFilePath.__init__g  s<     	""4|<L  	 -/r!   c                    V ^8  d   QhRRRR/# r   moder   r   z	IO[bytes]r   )r   s   "r   r   r%  w  s       I r!   c                z    \         P                  P                  W4      pV P                  P	                  V4       V# )z9
Override 'open' to track all files opened by this path.
)r   r_   rM   r(  r>   r(   r,  ra   s   && r   rM   TrackingFilePath.openw  s3     ""4."r!   c                   V ^8  d   QhRR/# )r   r   z;List[Union[TrackingFilePath[str], TrackingFilePath[bytes]]]r   )r   s   "r   r   r%    s     H H	DHr!   c                j    V P                    Uu. uF  qP                  '       g   K  VNK  	  up# u upi )z
Return a list of all L{TrackingFilePath}s associated with this
L{TrackingFilePath} that have had their C{open()} method called.
)r$  r(  )r(   r9   s   & r   openedPathsTrackingFilePath.openedPaths  s,     "&!2!2G!26F6F!2GGGs   00c               $    V ^8  d   QhRRRRRR/# )r   r9   r   r"  r#  r   zTrackingFilePath[OtherAnyStr]r   )r   s   "r   r   r%    s$     	 		/3		&	r!   c                h    \        WP                  R7      pV P                  P                  V4       V# )ze
Override L{filepath.FilePath.clonePath} to give the new path a reference
to the same tracking list.
)r$  )r   r$  r>   )r(   r9   r"  clones   &&& r   	clonePathTrackingFilePath.clonePath  s-     !4E4EF  'r!   )r(  r$  )FNrF)
r*   r+   r,   r-   r.   r'  rM   r2  r7  r/   r   r!   r   r   r   U  s!    "/ H	 	r!   r   c                  V    ] tR tRt$ RtR]R&   RR R lltRR R	 lltRR
 R lltRt	R# )ExplodingFilePathi  z
A specialized L{FilePath} which always returns an instance of
L{ExplodingFile} from its C{open} method.

@ivar fp: The L{ExplodingFile} instance most recently returned from the
    C{open} method.
r   r   Nc               $    V ^8  d   QhRRRRRR/# )r   pathNamer   originalExploderzAOptional[Union[ExplodingFilePath[str], ExplodingFilePath[bytes]]]r   rD   r   )r   s   "r   r   ExplodingFilePath.__annotate__  s(     2 22
2 
2r!   c                \    \         P                  P                  W4       Vf   T pW n        R# )a!  
Initialize an L{ExplodingFilePath} with a name and a reference to the

@param pathName: The path name as passed to L{filepath.FilePath}.
@type pathName: C{str}

@param originalExploder: The L{ExplodingFilePath} to associate opened
files with.
@type originalExploder: L{ExplodingFilePath}
N)r   r_   r'  _originalExploder)r(   r?  r@  s   &&&r   r'  ExplodingFilePath.__init__  s*    " 	""42##!1r!   c                    V ^8  d   QhRRRR/# r+  r   )r   s   "r   r   rA    s     	 	 	I 	r!   c                :    \        4       ;q P                  n        V# )z
Create, save, and return a new C{ExplodingFile}.

@param mode: Present for signature compatibility.  Ignored.

@return: A new C{ExplodingFile}.
)r   rC  r   r.  s   && r   rM   ExplodingFilePath.open  s     )67""%r!   c               $    V ^8  d   QhRRRRRR/# )r   namer   r"  r#  r   zfilepath.FilePath[OtherAnyStr]r   )r   s   "r   r   rA    s$     ? ??/3?	'?r!   c                	,    \        WP                  4      # r7   )r=  rC  )r(   rI  r"  s   &&&r   r7  ExplodingFilePath.clonePath  s     !'='=>>r!   )rC  r7   r9  r;  )
r*   r+   r,   r-   r.   __annotations__r'  rM   r7  r/   r   r!   r   r=  r=    s#     	2,	? ?r!   r=  Tc                  ~    ] tR tRtRtRR R lltR R ltR R	 ltR
 R ltR R lt	R R lt
R R ltR R ltRtR# )PermissionsTestsi  z"
Test Permissions and RWX classes
Nc               (    V ^8  d   QhRRRRRRRR/# )r   firstrM  secondr  msgzOptional[str]r   r   )r   s   "r   r   PermissionsTests.__annotate__  s,       &-:	
r!   c           	         W8w  dO   Vf   Rp\        V4      ^ 8  d
   VR,          pV P                  V: R\        V4      : R\        V4      : R24      hV# )z
Tests that C{first} != C{second} is false.  This method tests the
__ne__ method, as opposed to L{assertEqual} (C{first} == C{second}),
which tests the __eq__ method.

Note: this should really be part of trial
 
z8not not unequal (__ne__ not implemented correctly):
a = z
b = )r   failureExceptionr   )r(   rQ  rR  rS  s   &&&&r   assertNotUnequal!PermissionsTests.assertNotUnequal  sV     ?{3x!|t''(+WU^WV_N  r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   rT    s     $ $4 $r!   c                6   V P                  \        4      ;_uu_ 4       pV P                  ^^R4       RRR4       V P                  R\	        XP
                  4      4       V P                  R\	        VP
                  4      4       V P                  \        4      ;_uu_ 4       pV P                  ^^4       RRR4       V P                  R\	        XP
                  4      4       V P                  ^^4       R#   + '       g   i     L; i  + '       g   i     L\; i)zB
Self-test for assertNotUnequal to make sure the assertion works.
zcustom messageNz __ne__ not implemented correctly)ry   AssertionErrorrY  assertInstr	exception)r(   aeae2s   &  r   	test_testPermissionsTests.test_test  s     ~.."!!!Q(89 /8#bll:KL&BLL(9:~..#!!!Q' /8#cmm:LMa# /. /.s   C5!D5D	D	c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   rT    s     @ @4 @r!   c                   R F  pR Fw  pR Fn  p\         P                  ! WV4      pV P                  VP                  V4       V P                  VP                  V4       V P                  VP
                  V4       Kp  	  Ky  	  K  	  \         P                  ! RRR4      pT P                  VP                  ;'       d!    VP                  ;'       d    VP
                  4       R# )z.
L{RWX}'s constructor takes a set of booleans
TNTF)r   RWXrp   r   r[   executerf   )r(   r:  wr?   rwxs   &    r   test_rwxFromBools"PermissionsTests.test_rwxFromBools  s     A"&A",,qQ/C$$SXXq1$$SYY2$$S[[!4	 ' #  ll4t,>>SYY>>3;;?r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   rT    s     ? ?d ?r!   c                   R F  pR F  pR F{  pV P                  \        P                  ! WV4      \        P                  ! WV4      4       V P                  \        P                  ! WV4      \        P                  ! WV4      4       K}  	  K  	  K  	  V P	                  \        P                  ! RRR4      \        P                  ! RRR4      4       V P	                  ^\        P                  ! RRR4      4       R# )zi
L{RWX}'s created with the same booleans are equivalent.  If booleans
are different, they are not equal.
TFNrg  )rp   r   rh  rY  assertNotEqual)r(   r:  rj  r?   s   &   r   test_rwxEqNePermissionsTests.test_rwxEqNe  s    
 A"&A$$X\\!%:HLLq<QR))(,,qQ*?aTUAVW ' # 
 	LLtT*HLLtU,K	
 	Ax||D$=>r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   rT    s     M M4 Mr!   c                h   R R lpR
 Fo  pR
 Ff  pR
 F]  p\         P                  ! W#V4      pV P                  VP                  4       V! VR4      V! VR4      ,           V! VR4      ,           4       K_  	  Kh  	  Kq  	  V P                  \         P                  ! RRR4      P                  4       R4       R	# )z
L{RWX}'s shorthand string should be 'rwx' if read, write, and execute
permission bits are true.  If any of those permissions bits are false,
the character is replaced by a '-'.
c               $    V ^8  d   QhRRRRRR/# )r   valr#  letterr_  r   r   )r   s   "r   r   8PermissionsTests.test_rwxShorthand.<locals>.__annotate__  s!     	 	 	s 	s 	r!   c                    V '       d   V# R # )-r   )rv  rw  s   &&r   getChar3PermissionsTests.test_rwxShorthand.<locals>.getChar  s    r!   TFr:  rj  r?   zr-xNrg  )r   rh  rp   	shorthand)r(   r{  r:  rj  r?   rk  s   &     r   test_rwxShorthand"PermissionsTests.test_rwxShorthand  s    	
 A"&A",,qQ/C$$3'!S/9GAsOK ' #  	dE48BBDeLr!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   rT  #  s     'C 'C$ 'Cr!   c           
        R R lp\        ^ ^4       F  p\        ^ ^4       F  p\        ^ ^4       F  pRW#V3,          p\        V^4      p\        P                  ! V4      pV P	                  VP
                  V! VR4      V RVP
                   24       V P	                  VP                  V! VR4      V RVP                   24       V P	                  VP                  V! VR4      V R	VP                   24       K  	  K  	  K  	  \        P                  ! R
4      pR F0  pR F'  p	V P                  \        \        Wx4      V	4      4       K)  	  K2  	  R# )z
L{Permissions}'s constructor takes a valid permissions bitmask and
parsaes it to produce the correct set of boolean permissions.
c               $    V ^8  d   QhRRRRRR/# )r   statModeIntr   whor_  r   zfilepath.RWXr   )r   s   "r   r   ?PermissionsTests.test_permissionsFromStat.<locals>.__annotate__)  s!     	 	c 	 	 	r!   c                X   a aa R  V 3R llo\         P                  ! VV3R lR 4       !  # )c               $    V ^8  d   QhRRRRRR/# )r   r
  r_  r  r   r#  r   )r   s   "r   r   UPermissionsTests.test_permissionsFromStat.<locals>._rwxFromStat.<locals>.__annotate__*  s!     4 4s 4 4 4r!   c                F   < \        \        R V  V 24      pSV,          ^ 8  # )S_I)getattrstat)r
  r  constantr  s   && r   getPermissionBitYPermissionsTests.test_permissionsFromStat.<locals>._rwxFromStat.<locals>.getPermissionBit*  s*     'D6#.? @#h.!33r!   c              3  6   <"   T F  pS! VS4      x  K  	  R # 5ir7   r   ).0r
  r  r  s   & r   	<genexpr>RPermissionsTests.test_permissionsFromStat.<locals>._rwxFromStat.<locals>.<genexpr>/  s     J/$"4--/s   )RWX)r   rh  )r  r  r  s   ff@r   _rwxFromStat?PermissionsTests.test_permissionsFromStat.<locals>._rwxFromStat)  s(    4 4 <<J/J r!   z%d%d%dUSRz: got user: GRPz: got group: OTHz: got other:   N)usergroupother)r   r[   ri  )
ranger   r   Permissionsrp   r  r  r  rf   r  )
r(   r  ugochmodStringchmodValpermr  r
  s
   &         r   test_permissionsFromStat)PermissionsTests.test_permissionsFromStat#  s8   	 q!A1a[q!A"*aAY"6K";2H#//9D$$		$Xu5&-|DII;?
 $$

$Xu5&-}TZZLA
 $$

$Xu5&-}TZZLA % ! * ##E*-C4(:D AB 5 .r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   rT  L  s     < <D <r!   c                   V P                  \        P                  ! R4      \        P                  ! R4      4       V P                  \        P                  ! R4      \        P                  ! R4      4       V P	                  \        P                  ! R4      \        P                  ! R4      4       V P	                  ^\        P                  ! R4      4       R# )zL
Two L{Permissions}'s that are created with the same bitmask
are equivalent
r    N)rp   r   r  rY  rp  r'   s   &r   test_permissionsEq#PermissionsTests.test_permissionsEqL  s    
 	--e4h6J6J56QRh22598;O;OPU;VWH0079M9Me9TUAx33E:;r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   rT  V  s     O O4 Or!   c                   \        ^ ^4       F  p\        ^ ^4       F  p\        ^ ^4       F  p\        P                  ! \        RWV3,          ^4      4      pV P	                  VP                  4       RP                  R VP                  VP                  VP                  3 4       4      4       K  	  K  	  K  	  V P	                  \        P                  ! R4      P                  4       R4       R# )z
L{Permissions}'s shorthand string is the RWX shorthand string for its
user permission bits, group permission bits, and other permission bits
concatenated together, without a space.
z0o%d%d%drV  c              3  @   "   T F  qP                  4       x  K  	  R # 5ir7   )r}  )r  r?   s   & r   r  =PermissionsTests.test_permissionsShorthand.<locals>.<genexpr>b  s       3VaKKMM3Vs   i  z	rwxrwx---N)
r  r   r  r   rp   r}  r;   r  r  r  )r(   r  r  r  r  s   &    r   test_permissionsShorthand*PermissionsTests.test_permissionsShorthandV  s     q!A1a[q!A#//J!4JA0NOD$$(  48IItzz4::3V   % !  	--e4>>@+Nr!   r   r7   )r*   r+   r,   r-   r.   rY  rc  rl  rq  r~  r  r  r  r/   r   r!   r   rO  rO    s:    *$@?M,'CR<O Or!   rO  c                     ] tR tRtRtR R ltR R lt]! ]R4      R R	 l4       t	]! ]R4      R
 R l4       t
R R lt]! ]R4      R R l4       t]! ]R4      R R l4       t]! ]R4      R R l4       tR R ltR R lt]! ]R4      R R l4       t]! ]R4      R R l4       t]! ]R4      R R l4       tR R ltR  R! ltR" R# ltR$ R% ltR& R' lt]! ]P4                  ! 4       R(8g  R)4      R* R+ l4       t]! ]P4                  ! 4       R(8g  R)4      R, R- l4       tR. R/ ltR0 R1 ltR2 R3 ltR4 R5 lt R6 R7 lt!R8 R9 lt"]! ]R4      R: R; l4       t#R< R= lt$R> R? lt%R@ RA lt&RB RC lt']! ]R4      RD RE l4       t(]! ]R4      RF RG l4       t)RH RI lt*RJ RK lt+RL RM lt,RN RO lt-RP 3RQ RR llt.RS RT lt/RU RV lt0RW RX lt1RY RZ lt2]! ]R4      R[ R\ l4       t3]! ]R4      R] R^ l4       t4R_ R` lt5Ra Rb lt6Rc Rd lt7Re Rf lt8Rg Rh lt9Ri Rj lt:Rk Rl lt;Rm Rn lt<Ro Rp lt=Rq Rr lt>Rs Rt lt?Ru Rv lt@]! ]P                  ! 4       Rw4      Rx Ry l4       tBRz R{ ltC]! ]P                  ! 4       '       * R|4      R} R~ l4       tDR R ltE]! ]P                  ! 4       '       * R|4      R R l4       tF]! ]P                  ! 4       Rw4      R R l4       tG]! ]P                  ! 4       Rw4      R R l4       tHRtIR# )FilePathTestsii  z
Test various L{FilePath} path manipulations.

In particular, note that tests defined on this class instead of on the base
class are only run against L{twisted.python.filepath}.
c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   FilePathTests.__annotate__q  s     
 
D 
r!   c           
     :   R F  pV P                   P                  R4      P                  V4       V P                  \        P
                  ! \        P                  ! V P                   P                  R4      P                   4      P                  4      V4       K  	  R# )z
L{FilePath.chmod} modifies the permissions of
the passed file as expected (using C{os.stat} to check). We use some
basic modes that should work everywhere (even on Windows).
rS   N)m  r  )r9   rq   chmodrp   r  S_IMODEr8   st_moder(   r,  s   & r   
test_chmodFilePathTests.test_chmodq  sg     #DIIOOG$**40RWWTYY__W%=%B%BCKKLd #r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  }  s     	
 	
T 	
r!   c                   V P                   P                  R4      p\        P                  ! VP                   V P	                  R4      4       \        P                  ! VP                  R4      P                   V P	                  R4      4       \        P                  ! VP                  R4      P                   V P	                  RR4      4       R# )z9
Create several symbolic links to files and directories.
rS   	   sub1.linkrU   
   file2.links   sub1.file2.linkN)r9   rq   r8   symlinkr@   )r(   rH   s   & r   createLinksFilePathTests.createLinks}  s     )


6;;\ :;


6<<)..]0KL


LL"''g?Q)R	
r!   z"Platform does not support symlinksc                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     
 
d 
r!   c                   V P                  4        \        P                  ! V P                  P	                  R4      P                  V P                  P	                  R4      P                  4       V P                  V P                  P	                  R4      P                  4       V P                  P	                  R4      P	                  R4      4       R# )zL
L{FilePath.realpath} returns the path of the ultimate target of a
symlink.
r  s	   link.linkrS   rU   N)r  r8   r  r9   rq   rp   realpathr'   s   &r   test_realpathSymlink"FilePathTests.test_realpathSymlink  s     	


IIOOM*//1N1S1S	
 	IIOOL)224IIOOG$**84	
r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     R Rd Rr!   c                    \         P                  ! V P                  P                  R4      P                  V P                  P                  R4      P                  4       \         P                  ! V P                  P                  R4      P                  V P                  P                  R4      P                  4       V P	                  \
        P                  V P                  P                  R4      P                  4       R# )zl
L{FilePath.realpath} raises L{filepath.LinkError} if the path is a
symbolic link which is part of a cycle.
   link1s   link2N)r8   r  r9   rq   ry   r   	LinkErrorr  r'   s   &r   test_realpathCyclicalSymlink*FilePathTests.test_realpathCyclicalSymlink  s     	

499??8,11499??83L3Q3QR


499??8,11499??83L3Q3QR(,,diiooh.G.P.PQr!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     X X Xr!   c                    V P                  V P                  P                  R4      P                  4       V P                  P                  R4      4       R# )zR
L{FilePath.realpath} returns the path itself if the path is not a
symbolic link.
rS   N)rp   r9   rq   r  r'   s   &r   test_realpathNoSymlink$FilePathTests.test_realpathNoSymlink  s7    
 	1::<diioog>VWr!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     ? ?$ ?r!   c                R  a  S P                  4        \        P                  ! S P                  P	                  R4      P                  S P                  P	                  R4      P	                  R4      P                  4       R V 3R llpS P                  \        P                  V4       R# )zD
Verify that walking a path with a cyclical symlink raises an error
rS      sub1.loopylinkc                   V ^8  d   QhRR/# r   r   zList[bytes]r   )r   s   "r   r   <FilePathTests.test_walkCyclicalSymlink.<locals>.__annotate__  s     	: 	: 	:r!   c                 t   < SP                   P                  4        U u. uF  q P                   NK  	  up # u up i r7   r9   r   )r   r(   s    r   iterateOverPath?FilePathTests.test_walkCyclicalSymlink.<locals>.iterateOverPath  s*    (,		(89(8HH(8999s   5N)r  r8   r  r9   rq   ry   r   r  )r(   r  s   f r   test_walkCyclicalSymlink&FilePathTests.test_walkCyclicalSymlink  sw    
 	


IIOOG$))IIOOG$**+<=BB	

	: 	: 	(,,o>r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     + +4 +r!   c                N  a a S P                  4        \        P                  ! S P                  P	                  R4      P                  S P                  P	                  R4      P	                  R4      P                  4       R R loR VV 3R llpS P                  V! 4       4       R# )z
Verify that, after making a path with cyclical symlinks, when the
supplied C{descend} predicate returns C{False}, the target is not
traversed, as if it was a simple symlink.
rS   r  c                    V ^8  d   QhRRRR/# r   r9   zfilepath.FilePath[bytes]r   r#  r   )r   s   "r   r   MFilePathTests.test_walkObeysDescendWithCyclicalSymlinks.<locals>.__annotate__       	% 	%5 	%$ 	%r!   c                ,    V P                  4       '       * # r7   r   r9   s   &r   
noSymLinksKFilePathTests.test_walkObeysDescendWithCyclicalSymlinks.<locals>.noSymLinks      {{}$$r!   c                   V ^8  d   QhRR/# r  r   )r   s   "r   r   r    s     	L 	L 	Lr!   c                 x   < SP                   P                  SR 7       U u. uF  q P                   NK  	  up # u up i )descendr  )r   r  r(   s    r   r  PFilePathTests.test_walkObeysDescendWithCyclicalSymlinks.<locals>.iterateOverPath  s.    (,		z(JK(JHH(JKKKs   7N)r  r8   r  r9   rq   rf   )r(   r  r  s   f @r   )test_walkObeysDescendWithCyclicalSymlinks7FilePathTests.test_walkObeysDescendWithCyclicalSymlinks  sw     	


IIOOG$))IIOOG$**+<=BB	

	%	L 	L 	)*r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     0 0t 0r!   c                    V P                  4        R R lpV P                  P                  VR7       Uu. uF  q"P                  NK  	  ppV P                  \	        V4      \	        V P
                  4      4       R# u upi )zc
Verify that when the supplied C{descend} predicate returns C{False},
the target is not traversed.
c                    V ^8  d   QhRRRR/# r  r   )r   s   "r   r   9FilePathTests.test_walkObeysDescend.<locals>.__annotate__  r  r!   c                ,    V P                  4       '       * # r7   r  r  s   &r   r  7FilePathTests.test_walkObeysDescend.<locals>.noSymLinks  r  r!   r  N)r  r9   r   rp   r   r=   )r(   r  r   r?   s   &   r   test_walkObeysDescend#FilePathTests.test_walkObeysDescend  s`     		% "&
!CD!C#XX!CDQTXX/ Es   A;c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     . . .r!   c                	   R pV P                   P                  R4      P                  V4       V P                   P                  R4      P                  4       pV P	                  W4       RpV P                   P                  R4      P                  VR4       V P                   P                  R4      P                  4       pV P	                  W4       R# )s
   newcontents   news   contents   .tmpN)r9   rq   
setContent
getContentrp   )r(   content
newcontents   &  r   test_getAndSetFilePathTests.test_getAndSet  s    		**73YY__V,779
-		**7G<YY__V,779
-r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     & &D &r!   c                    \        R4      pV P                  \        VP                  4       V P	                  VP
                  P                  4       R# )z
If reading from the underlying file raises an exception,
L{FilePath.getContent} raises that exception after closing the file.
rV  N)r=  ry   IOErrorr  rf   r   r  r   s   & r   test_getContentFileClosing(FilePathTests.test_getContentFileClosing  s6    
 r"'2==1%r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     $ $4 $r!   c                   V P                   P                  R4      pV P                   P                  R4      p\        P                  ! VP                   VP                   4       V P	                  VP                  4       4       V P                  VP                  4       4       V P	                  VP                  4       4       V P	                  VP                  4       4       R# )z
Verify the behavior of the C{isLink} method against links and
non-links. Also check that the symbolic link shares the directory
property with its target.
s   sub4rV   N)r9   rq   r8   r  rf   r   r   r   )r(   s4s3s   &  r   test_symbolicLinkFilePathTests.test_symbolicLink  s     YY__W%YY__W%


277BGG$		$%
#
#r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     = =T =r!   c                ,   V P                   P                  R4      V P                   P                  R4      3V P                   P                  R4      P                  R4      V P                   P                  R4      3.pV F  w  r#VP                  V4       V P                  VP	                  4       R4       V P                  VP                  4       VP                  4       4       V P                  VP                  4       VP                  4       4       K  	  R# )z
Verify that symlink creates a valid symlink that is both a link and a
file if its target is a file, or a directory if its target is a
directory.
r   s	   sub2.linkrW   s   file3.ext1.linkzThis is a linkN)r9   rq   linkTorf   r   rp   r   r   )r(   targetLinkstargetlinks   &   r   test_linkToFilePathTests.test_linkTo  s     YY__W%tyy|'DE		(..}=		 23
 (LFMM$OODKKM+;<V\\^TZZ\:V]]_dkkm<	 (r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     
 
4 
r!   c                   V P                  \        V P                  P                  R4      P                  V P                  P                  R4      P                  R4      4       V P                  \        V P                  P                  R4      P                  V P                  P                  R4      P                  R4      4       R# )z
Verify C{linkTo} fails in the following case:
    - the target is in a directory that doesn't exist
    - the target already exists
rT   s   nosubrS   rU   N)ry   r   r9   rq   r  r'   s   &r   test_linkToErrorsFilePathTests.test_linkToErrors  s     	IIOOH%,,IIOOH%++H5	

 	IIOOH%,,IIOOG$**84	
r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  $  s     ; ;d ;r!   c                	&   V P                   P                  R 4      P                  R4      pRpV P                  VP                  ! V!  4       VP	                  R4      pVP                  4        VP                  ! V!  pVf   Q hV P                  VP                  4       '       * 4       VP                  R4      pVf   Q hV P                  VP                  4       '       * 4       VP                  4        V P                  VP                  ! V!  4       R# )rV      file3   .fooN   *)r   s   .bars   ext1s   ext2s   ext3)r9   rq   r   siblingExtensionSearchsiblingExtensiontouchr   r   )r(   f3extsf3efoundglobbeds   &     r   testMultiExtFilePathTests.testMultiExt$  s    YY__W%++H5:22D9:!!'*		))40   U\\^+,++D1"""W^^--.

22D9:r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  3  s     Q Q$ Qr!   c                	    \         P                  ! R 4      pVP                  R4       V P                  \         P                  VP                  R4       R# )   .s   foo/bar   /mon€yN)r   r_   preauthChildry   InsecurePathr   s   & r   testPreauthChildFilePathTests.testPreauthChild3  s:    t$

#(//-Pr!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  8  s     % %t %r!   c                	n   V P                   P                  R 4      pVP                  4        V P                  VP	                  4       ^ 4       V P                  \        VP                  4       \        P                  ! 4       ,
          4      ^,          ^ 4       V P                  \        VP                  4       \        P                  ! 4       ,
          4      ^,          ^ 4       V P                  \        VP                  4       \        P                  ! 4       ,
          4      ^,          ^ 4       V P                  VP                  4       4       V P                  VP                  4       4       \        P                  ! VP                   4       V P                  VP                  4       4       VP                  RR7       V P                  VP                  4       4       V P                  VP!                  4       4       V P                  VP#                  4       4       V P                  VP%                  4       4       R# )s   stattestF)reraiseN)r9   rq   r$  rp   getsizeabsr   rY   r   r   rf   r   r8   r   restatr   r   r   r   r   s   & r   testStatCacheFilePathTests.testStatCache8  sX   IIOOK(		a(QZZ\DIIK78B>BQZZ\DIIK78B>BQZZ\DIIK78B>B
#
#
		!&&
#	$$#$r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  K  s     7 7T 7r!   c                	.   \         P                  ! \         P                  ! V P                  4      4      pV P	                  V P                  P
                  VP
                  4       V P	                  V P                  P                  VP                  4       R # r7   )pickleloadsdumpsr9   rp   	__class__)r(   newpaths   & r   testPersistFilePathTests.testPersistK  sY    ,,v||DII67,,g.?.?@6r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  P  s     L L$ Lr!   c                	D   V P                  \        P                  V P                  P                  R 4       V P                  \        P                  V P                  P                  R4       V P                  \        P                  V P                  P                  R4       R# )s   ..s   /etcs   ../..Nry   r   r1  r9   rq   r'   s   &r   testInsecureUNIXFilePathTests.testInsecureUNIXP  sb    (//%H(//'J(//(Kr!   r   zTest will run only on Windows.c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  V  s     S S4 Sr!   c                	    V P                  \        P                  V P                  P                  R 4       V P                  \        P                  V P                  P                  R4       R# )s   ..\..s   C:randomfileNrG  r'   s   &r   testInsecureWin32FilePathTests.testInsecureWin32U  sB    (//)L(///Rr!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  [  s     	M 	M 	Mr!   c                D   V P                  \        P                  V P                  P                  R4       V P                  \        P                  V P                  P                  R4       V P                  \        P                  V P                  P                  R4       R# )z
Windows has 'special' filenames like NUL and CON and COM1 and LPR
and PRN and ... god knows what else.  They can be located anywhere in
the filesystem.  For obvious reasons, we do not wish to normally permit
access to these.
s   CONs   C:CONzC:\CONNrG  r'   s   &r   testInsecureWin32Whacky%FilePathTests.testInsecureWin32WhackyZ  sd     	(//&I(//(K(//)Lr!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  f  s     M M Mr!   c                	   V P                  \        P                  ! R 4      \        P                  ! R 4      4       V P                  \        P                  ! R4      \        P                  ! R 4      8  4       V P                  \        P                  ! R4      \        P                  ! R 4      8  4       V P                  \        P                  ! R 4      \        P                  ! R 4      8  4       V P                  \        P                  ! R 4      \        P                  ! R 4      8*  4       V P                  \        P                  ! R 4      \        P                  ! R4      8  4       V P                  \        P                  ! R 4      \        P                  ! R4      8*  4       V P                  \        P                  ! R 4      \        P                  ! R4      8g  4       V P                  \        P                  ! R4      \        P                  ! R 4      8g  4       V P	                  \        P                  ! R4      \        P                  ! R4      8g  4       R# )rl      zN)rp   r   r_   rf   r   r'   s   &r   testComparisonFilePathTests.testComparisonf  s   **40(2C2CD2IJ))$/(2C2CD2IIJ))$/83D3DT3JJK))$/83D3DT3JJK))$/83D3DT3JJK))$/(2C2CD2IIJ))$/83D3DT3JJK))$/83D3DT3JJK))$/83D3DT3JJK**40H4E4Ed4KKLr!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  s  s     
 
T 
r!   c                t    V P                  \        P                  V P                  P                  RR.4       R# )z\
If C{".."} is in the sequence passed to L{FilePath.descendant},
L{InsecurePath} is raised.
   mon€yz..N)ry   r   r1  r9   r   r'   s   &r   test_descendantOnly!FilePathTests.test_descendantOnlys  s.    
 	!!499#7#7,9M	
r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  |  s     0 0T 0r!   c                	l   V P                   P                  R 4      pVP                  R4      pV P                  VP	                  4       VP	                  4       4       V P                  VP                  4       R4       VP                  4        V P                  W P                   P                  4       4       R# )s   sibling_starts   sibling_testN)	r9   rq   siblingrp   rC   basenamecreateDirectoryr^  r   )r(   r4   tss   &  r   testSiblingFilePathTests.testSibling|  sz    IIOO,-YY'qyy{38
b)),,./r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     9 9d 9r!   c                	   V P                   P                  4       pV P                  VP                  4       V P                   P                  4       4       V P	                  VP                  4       V P                   P                  4       4       VP                  4        V P                  WP                   P                  4       P                  4       4       R # r7   )r9   temporarySiblingrp   rC   assertNotInr_  r   r`  r^  parentr   )r(   ra  s   & r   testTemporarySibling"FilePathTests.testTemporarySibling  s    YY'')tyy'8'8':;		(9(9(;<
b))**,5578r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     

 

 

r!   c                    RpV P                   P                  V4      pV P                  VP                  4       P	                  V4      VP                  4       : RV: 24       R# )z
If L{FilePath.temporarySibling} is given an extension argument, it will
produce path objects with that extension appended to their names.
s   .test-extensionz does not end with N)r9   rf  rf   r_  endswith)r(   testExtensionra  s   &  r   test_temporarySiblingExtension,FilePathTests.test_temporarySiblingExtension  sT    
 +YY''6KKM""=1{{}2=2CD	
r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     - -d -r!   c                    V P                   P                  4        V P                  V P                   P                  4       4       R# )zf
L{FilePath.remove} on a L{FilePath} that refers to a directory will
recursively delete its contents.
N)r9   r   r   r   r'   s   &r   test_removeDirectory"FilePathTests.test_removeDirectory  s/    
 			))+,r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     
; 
; 
;r!   c                   V P                   P                  R4      p\        P                  ! V P                   P                  R4      P                   VP                   4       VP	                  4        V P                  VP                  4       4       V P                  V P                   P                  R4      P                  4       4       R# )z`
For a path which is a symbolic link, L{FilePath.remove} just deletes
the link, not the target.
r  rS   N)r9   rq   r8   r  r   r   r   rf   )r(   r  s   & r   test_removeWithSymlink$FilePathTests.test_removeWithSymlink  sz     yy|,


499??7+00$))<'		0779:r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     - -d -r!   c                   \        V P                  P                  4       4      p\        P                  ! V P                  4       4      pV P                  P                  V4       V P                  P                  4        VP                  V P                  4       \        V P                  P                  4       4      pVP                  4        VP                  4        V P                  W14       R# )zx
L{FilePath.copyTo} makes a copy of all the contents of the directory
named by that L{FilePath} if it is able to do so.
N)
r   r9   r   r   r_   r%   copyTor   r   rp   r(   oldPathsr   newPathss   &   r   test_copyToDirectory"FilePathTests.test_copyToDirectory  s    
 		()t{{}-				
		$))		(),r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     / /4 /r!   c                
   V P                   P                  R4      pR Vn        \        V P	                  4       4      pV P                  \        VP                  V4       V P                  VP                  P                  4       R# )z
If an exception is raised while L{FilePath.copyTo} is trying to open
source file to read from, the destination file is closed and the
exception is raised to the caller of L{FilePath.copyTo}.
s   notherec                     R # )Tr   r   r!   r   <lambda>AFilePathTests.test_copyToMissingDestFileClosing.<locals>.<lambda>  s    r!   N)r9   rq   r   r=  r%   ry   r  r{  rf   r   r  )r(   nosuchdestinations   &  r   !test_copyToMissingDestFileClosing/FilePathTests.test_copyToMissingDestFileClosing  s]     , % (6'6==+>--.r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     
/ 
/ 
/r!   c                ,   \        V P                  4       4      p\        \        4      pV P                  \        VP
                  V4       V P                  VP                  P                  4       V P                  VP                  P                  4       R# )z
If an exception is raised while L{FilePath.copyTo} is copying bytes
between two regular files, the source and destination files are closed
and the exception propagates to the caller of L{FilePath.copyTo}.
N)	r=  r%   __file__ry   r  r{  rf   r   r  )r(   r  sources   &  r   test_copyToFileClosing$FilePathTests.test_copyToFileClosing  s`     (6"8,'6==+>		(()--.r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     
 
D 
r!   c                    V P                  \        \        3V P                  P                  V P                  P                  R4      4       R# )z
L{FilePath.copyTo} fails with an OSError or IOError (depending on
platform, as it propagates errors from open() and write()) when
attempting to copy a directory to a child of itself.
rT   N)ry   r   r  r9   r{  rq   r'   s   &r   test_copyToDirectoryItself(FilePathTests.test_copyToDirectoryItself  5     	g		 0 0$))//(2K	
r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     
 
 
r!   c                   \         P                  ! V P                  P                  R4      P                  V P                  P                  R4      P                  4       \        P
                  ! V P                  4       4      pV P                  P                  V4       V P                  VP                  R4      P                  4       4       T P                  VP                  R4      P                  4        Uu. uF  q"P                  4       NK  	  upVP                  R4      P                  4        Uu. uF  q"P                  4       NK  	  up4       R# u upi u upi )zV
Verify that copying with followLinks=True copies symlink targets
instead of symlinks
rS   r  N)r8   r  r9   rq   r   r_   r%   r{  r   r   rp   r   r_  )r(   r   r?   s   &  r   test_copyToWithSymlink$FilePathTests.test_copyToWithSymlink  s     	

499??7+00$))//(2K2P2PQt{{}-		(+2245#%88G#4#=#=#?@#?aZZ\#?@#%88H#5#>#>#@A#@aZZ\#@A	
@As   7E2E
c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     
 
4 
r!   c                D   \         P                  ! RV P                  P                  R4      P                  4       \        P
                  ! V P                  4       4      pV P                  P                  VRR7       V P                  VP                  R4      P                  4       4       V P                  \         P                  ! V P                  P                  R4      P                  4      \         P                  ! VP                  R4      P                  4      4       R# )zH
Verify that copying with followLinks=False copies symlinks as symlinks
rS   r  FfollowLinksN)r8   r  r9   rq   r   r_   r%   r{  rf   r   rp   readlinkr   s   & r   test_copyToWithoutSymlink'FilePathTests.test_copyToWithoutSymlink  s    
 	

7DIIOOH5::;t{{}-		/*1134KK		1667KK*//0	
r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     2 2$ 2r!   c                    \         P                  ! V P                  4       4      pV P                  \        VP
                  R4      pV P                  VP                  \        P                  4       R# )zF
If the source path is missing, L{FilePath.copyTo} raises L{OSError}.
s   some other pathN)	r   r_   r%   ry   r   r{  rp   errnoENOENT)r(   r9   excs   &  r   test_copyToMissingSource&FilePathTests.test_copyToMissingSource  sK       /6HIELL1r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  	  s     - -T -r!   c                   \        V P                  P                  4       4      p\        P                  ! V P                  4       4      pV P                  P                  V4       VP                  V P                  4       \        V P                  P                  4       4      pVP                  4        VP                  4        V P                  W14       R# )z^
Verify that moving an entire directory results into another directory
with the same content.
N)	r   r9   r   r   r_   r%   moveTor   rp   r|  s   &   r   test_moveToFilePathTests.test_moveTo	  s    
 		()t{{}-		
		$))		(),r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     & & &r!   c                   \         P                  ! V P                  4       4      p\         P                  ! V P                  4       4      pVP                  4        V P	                  VP                  4       4       V P                  VP                  4       4       VP                  V4       V P                  VP                  4       4       V P	                  VP                  4       4       R# )z
A L{FilePath} that has been moved aside with L{FilePath.moveTo} no
longer registers as existing.  Its previously non-existent target
exists, though, as it was created by the call to C{moveTo}.
N)r   r_   r%   r$  rf   r   r   r  )r(   r   fp2s   &  r   test_moveToExistsCache$FilePathTests.test_moveToExistsCache  s     t{{}-.


 			$&
		#%

%r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  +  s     & &$ &r!   c                F    V P                  4        V P                  4        R# )zX
The assertion of test_moveToExistsCache should hold in the case of a
cross-mount move.
N)setUpFaultyRenamer  r'   s   &r    test_moveToExistsCacheCrossMount.FilePathTests.test_moveToExistsCacheCrossMount+  s    
 	 ##%r!   c                 	    R # r7   r   r   r!   r   r  FilePathTests.<lambda>3  s    dr!   c                    V ^8  d   QhRRRR/# )r   hookzCallable[[], None]r   rD   r   )r   s   "r   r   r  3  s     + +); +t +r!   c                J   \         P                  ! V P                  4       4      p\         P                  ! V P                  4       4      pVP                  R4       VP                  R4       V! 4        V P	                  VP                  4       ^4       V P	                  VP                  4       ^
4       \        P                  ! VP                  4       V P	                  VP                  4       ^
4       VP                  V4       V P	                  VP                  4       ^4       R# )a  
L{FilePath.moveTo} clears its destination's status cache, such that
calls to L{FilePath.getsize} after the call to C{moveTo} will report the
new size, not the old one.

This is a separate test from C{test_moveToExistsCache} because it is
intended to cover the fact that the destination's cache is dropped;
test_moveToExistsCache doesn't cover this case because (currently) a
file that doesn't exist yet does not cache the fact of its non-
existence.
s   1234s
   1234567890N)
r   r_   r%   r   rp   r7  r8   r   r9   r  )r(   r  r   r  s   &&  r   test_moveToSizeCache"FilePathTests.test_moveToSizeCache3  s     t{{}-.
g}% 	q)+ 			#((+
		#*r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  R  s     	. 	. 	.r!   c                >   a  R V 3R llpS P                  VR7       R# )zV
The assertion of test_moveToSizeCache should hold in the case of a
cross-mount move.
c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   BFilePathTests.test_moveToSizeCacheCrossMount.<locals>.__annotate__X  s     	% 	%t 	%r!   c                 (   < S P                  4        R # r7   )r  r'   s   r   rb   ;FilePathTests.test_moveToSizeCacheCrossMount.<locals>.setUpX  s    ""$r!   )r  N)r  )r(   rb   s   f r   test_moveToSizeCacheCrossMount,FilePathTests.test_moveToSizeCacheCrossMountR  s     	% 	% 	!!u!-r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  ]  s     
 
$ 
r!   c                    V P                  \        \        3V P                  P                  V P                  P                  R4      4       R# )z
Verify error behavior of moveTo: it should raises one of OSError or
IOError if you want to move a path into one of its child. It's simply
the error raised by the underlying rename system call.
rT   N)ry   r   r  r9   r  rq   r'   s   &r   test_moveToErrorFilePathTests.test_moveToError]  r  r!   c                   V ^8  d   QhRR/# )r   r   zList[Tuple[str, str]]r   )r   s   "r   r   r  g  s      #8 r!   c                p   aa . oR VV3R llp\         P                  oV P                  \         RV4       S# )z
Set up a C{os.rename} that will fail with L{errno.EXDEV} on first call.
This is used to simulate a cross-device rename failure.

@return: a list of pair (src, dest) of calls to C{os.rename}
@rtype: C{list} of C{tuple}
c               $    V ^8  d   QhRRRRRR/# )r   srcr_  destr   rD   r   )r   s   "r   r   5FilePathTests.setUpFaultyRename.<locals>.__annotate__q  s!     	- 	-c 	- 	- 	-r!   c                   < SP                  W34       \        S4      ^8X  d   \        \        P                  R4      hS! W4      # )   z;Test-induced failure simulating cross-device rename failure)r>   r   r   r  EXDEV)r  r  invokedWithoriginalRenames   &&r   faultyRename5FilePathTests.setUpFaultyRename.<locals>.faultyRenameq  sD    {+;1$KKT  "#,,r!   rename)r8   r  patch)r(   r  r  r  s   & @@r   r  FilePathTests.setUpFaultyRenameg  s5     	- 	- 

2x.r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  ~  s     % %t %r!   c                h    V P                  4       pV P                  4        V P                  V4       R# )z
C{moveTo} should be able to handle C{EXDEV} error raised by
C{os.rename} when trying to move a file on a different mounted
filesystem.
N)r  r  rf   )r(   r  s   & r   test_crossMountMoveTo#FilePathTests.test_crossMountMoveTo~  s.     ,,. 	 	$r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     % %$ %r!   c                   V P                  4       pV P                  P                  R4      pV P                  P                  R4      p\        P                  ! V P                  P                  R4      P                  VP                  4       VP                  V4       V P                  VP                  4       4       V P                  VP                  4       R4       V P                  V4       R# )zp
By default, when moving a symlink, it should follow the link and
actually copy the content of the linked node.
rU   r  rT   r2   N)r  r9   rq   r8   r  r  r   r   rp   r  rf   r(   r  r   r%  s   &   r    test_crossMountMoveToWithSymlink.FilePathTests.test_crossMountMoveToWithSymlink  s     ,,.YY__X&YY__X&


499??8,11277;
		"%)4$r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     % %T %r!   c                   V P                  4       pV P                  P                  R4      pV P                  P                  R4      p\        P                  ! V P                  P                  R4      P                  VP                  4       VP                  VRR7       V P                  VP                  4       4       V P                  VP                  4       R4       V P                  V4       R# )zS
Verify that moveTo called with followLinks=False actually create
another symlink.
rU   r  rT   Fr  r2   N)
r  r9   rq   r8   r  r  rf   r   rp   r  r  s   &   r   #test_crossMountMoveToWithoutSymlink1FilePathTests.test_crossMountMoveToWithoutSymlink  s     ,,.YY__X&YY__X&


499??8,11277;
		"%	(		$)4$r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     * *t *r!   c                   \         P                  ! V P                  4       4      pVP                  4       ;_uu_ 4       pV P	                  RVP
                  4       VP                  R4       RRR4       \        VP                  R4      ;_uu_ 4       pVP                  4       pV P                  VR4       RRR4       R#   + '       g   i     L[; i  + '       g   i     R# ; i)a  
L{FilePath.create} should always open (and write to) files in binary
mode; line-feed octets should be unmodified.

(While this test should pass on all platforms, it is only really
interesting on platforms which have the concept of binary mode, i.e.
Windows platforms.)
b   
Nrb)r   r_   r%   creater^  r,  r[   rM   r9   r   rp   )r(   r9   ra   r   r   s   &    r   test_createBinaryMode#FilePathTests.test_createBinaryMode  s       /[[]]aMM#qvv&GGEN  $))T""b779DT5) #" ] #""s   .B>#C>C	C"	c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     L= L=$ L=r!   c                		   V P                   P                  R 4      pV P                  \        VP                  4      pV P                  VP                  \        P                  4       V P                   P                  R4      pVP	                  R4      ;_uu_ 4       pVP                  R4       RRR4       VP	                  4       ;_uu_ 4       pV P                  VP                  4       R4       RRR4       VP	                  R4      P                  4        VP	                  4       ;_uu_ 4       pV P                  VP                  4       R4       RRR4       V P                   P                  R4      pVP	                  R4      ;_uu_ 4       pVP                  R4       RRR4       VP	                  R4      ;_uu_ 4       pVP                  R	4       RRR4       VP	                  R
4      ;_uu_ 4       pV P                  VP                  4       R4       RRR4       VP	                  R4      ;_uu_ 4       pV P                  VP                  4       R4       VP                  ^ ^4       VP                  R4       RRR4       VP	                  R
4      ;_uu_ 4       pV P                  VP                  4       R4       RRR4       VP	                  R4      ;_uu_ 4       pV P                  VP                  4       R4       VP                  ^ ^4       VP                  R4       RRR4       VP	                  R4      ;_uu_ 4       pVP                  R4       VP                  ^ ^4       V P                  VP                  4       R4       VP                  ^ ^ 4       V P                  VP                  4       R4       RRR4       VP                  R4       VP	                  R4      P                  4        Tp?V P                  \        \        3VP                  4       R#   + '       g   i     ELs; i  + '       g   i     ELF; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     ELs; i  + '       g   i     EL"; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL ; i)s   nonexistents   writerrj     abc
defNr!   s   appenders   abcas   defr:  s   abcdefzr+s   ghis	   abcdefghizw+s   123za+s   456s   123456T)r9   rq   ry   r  rM   rp   r  r  r[   r   r^   seekrequireCreater   )r(   nonexistentewriterra   appenderexistents   &      r   testOpenFilePathTests.testOpen  sM   iioon5g{'7'78%,,/ +[[GGK  
 [[]]aQVVX{3  	C [[]]aQVVXs+ 
 99??;/]]31GGFO   ]]31GGFO   ]]31QVVXy1   ]]4  AQVVXy1 FF1aLGGFO ! ]]31QVVX|4  
 ]]4  AQVVXs+FF1aLGGFO ! ]]4  A
 GGFOFF1aLQVVXs+FF1aLQVVXy1 ! 	!!$'##%7G,hmm<I 
 ]]
 ]]       !    
 !   !  s{   P!P*,!P>	Q<Q&/!Q:1AR!R"AR6=A6S
P'	*P;	>Q	Q#	&Q7	:R	R	"R3	6S	
S	c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  
  s     ' ' 'r!   c                   V P                   P                  R4      pVP                  R4      pV;_uu_ 4       pVP                  R4       RRR4       V P	                  VP
                  4       R#   + '       g   i     L-; i)a:  
Due to a bug in Python 2.7 on Windows including multiple 'b'
characters in the mode passed to the built-in open() will cause an
error.  FilePath.open() ensures that only a single 'b' character is
included in the mode passed to the built-in open().

See http://bugs.python.org/issue7686 for details about the bug.
s   explicit-binaryrL   r  Nr9   rq   rM   r[   rf   r   r(   r  openerfiles   &   r   test_openWithExplicitBinaryMode-FilePathTests.test_openWithExplicitBinaryMode
  sU     !34T"VtJJ{# & V   A..A>	c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     ' '4 'r!   c                   V P                   P                  R4      pVP                  R4      pV;_uu_ 4       pVP                  R4       RRR4       V P	                  VP
                  4       R#   + '       g   i     L-; i)af  
Due to a bug in Python 2.7 on Windows including multiple 'b'
characters in the mode passed to the built-in open() will cause an
error.  No matter how many 'b' modes are specified, FilePath.open()
ensures that only a single 'b' character is included in the mode
passed to the built-in open().

See http://bugs.python.org/issue7686 for details about the bug.
s   multiple-binarywbbr  Nr  r  s   &   r   )test_openWithRedundantExplicitBinaryModes7FilePathTests.test_openWithRedundantExplicitBinaryModes  sU     !34U#VtJJ{# & Vr  c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  )  s     	% 	%$ 	%r!   c                    \         P                  ! V P                  4       4      pV P                  VP	                  4       4       VP                  4        V P                  VP	                  4       4       R# )zs
Check that C{filepath.FilePath.exists} correctly restat the object if
an operation has occurred in the mean time.
N)r   r_   r%   r   r   makedirsrf   r   s   & r   test_existsCacheFilePathTests.test_existsCache)  sI    
 t{{}-%
		$r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  4  s     $ $$ $r!   c                h   \         P                  ! \        P                  P	                  V P                  4       RRR4      4      pV P                  VP                  4       4       VP                  4        V P                  VP                  4       4       V P                  VP                  4       4       R# )z
C{FilePath.makedirs} creates a directory at C{path}}, including
recursively creating all parent directories leading up to the path.
s   foos   bars   bazN)r   r_   r8   r9   r;   r%   r   r   r  rf   r   r   s   & r   (test_makedirsMakesDirectoriesRecursively6FilePathTests.test_makedirsMakesDirectoriesRecursively4  sn    
 rww||DKKM666RS%
		$
#r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  A  s     $ $$ $r!   c                ,   \         P                  ! V P                  4       4      pV P                  VP	                  4       4       VP                  RR7       V P                  VP	                  4       4       V P                  VP                  4       4       R# )zx
Calling C{FilePath.makedirs} with C{ignoreExistingDirectory} set to
C{True} has no effect if directory does not exist.
TignoreExistingDirectoryN)r   r_   r%   r   r   r  rf   r   r   s   & r   8test_makedirsMakesDirectoriesWithIgnoreExistingDirectoryFFilePathTests.test_makedirsMakesDirectoriesWithIgnoreExistingDirectoryA  s`    
 t{{}-%
D1		$
#r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  N  s     
8 
8$ 
8r!   c                <   \         P                  ! \        P                  P	                  V P                  4       4      4      pVP                  4        V P                  \        VP                  4      pV P                  VP                  \        P                  4       R# )ze
C{FilePath.makedirs} throws an C{OSError} exception
when called on a directory that already exists.
N)r   r_   r8   r9   r;   r%   r  ry   r   rp   r  EEXISTr(   r   r`  s   &  r   (test_makedirsThrowsWithExistentDirectory6FilePathTests.test_makedirsThrowsWithExistentDirectoryN  s^    
 rww||DKKM:;
%%gr{{;	%,,7r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  Z  s     % %T %r!   c                   \         P                  ! V P                  4       4      pVP                  4        V P	                  VP                  4       4       VP                  RR7       V P	                  VP                  4       4       R# )z
C{FilePath.makedirs} succeeds when called on a directory that already
exists and the c{ignoreExistingDirectory} argument is set to C{True}.
Tr  N)r   r_   r%   r  rf   r   r   s   & r   +test_makedirsAcceptsIgnoreExistingDirectory9FilePathTests.test_makedirsAcceptsIgnoreExistingDirectoryZ  sU    
 t{{}-
		$
D1		$r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  g  s     8 8t 8r!   c                D   \         P                  ! V P                  4       4      pVP                  4        V P	                  VP                  4       4       V P                  \        VP                  RR7      pV P                  VP                  \        P                  4       R# )z
When C{FilePath.makedirs} is called with C{ignoreExistingDirectory} set
to C{True} it throws an C{OSError} exceptions if path is a file.
Tr  N)r   r_   r%   r  rf   r   ry   r   r  rp   r  r  r  s   &  r   5test_makedirsIgnoreExistingDirectoryExistAlreadyAFileCFilePathTests.test_makedirsIgnoreExistingDirectoryExistAlreadyAFileg  so    
 t{{}-
				$%%R[[$ & 
	 	%,,7r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  v  s     8 84 8r!   c                    R R lpV P                  \        RV4       \        P                  ! V P	                  4       4      pV P                  \        VP                  RR7      pV P                  VP                  \        P                  4       R# )z
When C{FilePath.makedirs} is called with C{ignoreExistingDirectory} set
to C{True} it raises an C{OSError} exception if exception errno is not
EEXIST.
c                    V ^8  d   QhRRRR/# )r   r9   r_  r   rD   r   )r   s   "r   r   ]FilePathTests.test_makedirsRaisesNonEexistErrorsIgnoreExistingDirectory.<locals>.__annotate__}  s     	= 	= 	= 	=r!   c                6    \        \        P                  R 4      h)zPermission Denied)r   r  EACCESr  s   &r   faultyMakedirs_FilePathTests.test_makedirsRaisesNonEexistErrorsIgnoreExistingDirectory.<locals>.faultyMakedirs}  s    %,,(;<<r!   r  Tr  N)r  r8   r   r_   r%   ry   r   r  rp   r  r+  )r(   r,  r   r`  s   &   r   9test_makedirsRaisesNonEexistErrorsIgnoreExistingDirectoryGFilePathTests.test_makedirsRaisesNonEexistErrorsIgnoreExistingDirectoryv  si    	= 	

2z>2t{{}-%%R[[$ & 
	 	%,,7r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     * *d *r!   c                   \         P                  ! V P                  4       4      pVP                  R4       V P	                  VP                  4       ^4       \        VP                  R4      ;_uu_ 4       pVP                  R4       RRR4       V P	                  VP                  4       ^4       VP                  4        V P	                  VP                  4       ^4       R#   + '       g   i     Lb; i)z
L{FilePath.changed} indicates that the L{FilePath} has changed, but does
not re-read the status information from the filesystem until it is
queried again via another method, such as C{getsize}.
s   12345rL   s   12345678N)
r   r_   r%   r   rp   r7  rM   r9   r[   changed)r(   r   fObjs   &  r   test_changedFilePathTests.test_changed  s     t{{}-
hq) "''4  DJJ{# ! 	q)


 	q) ! s   4C  C0	zTest does not run on Windowsc                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     
 
4 
r!   c                   R Fz  pV P                   P                  R4      P                  V4       V P                  V P                   P                  R4      P	                  4       \
        P                  ! V4      4       K|  	  V P                   P                  R4      P                  R4       V P                  V P                   P                  R4      P	                  4       P                  4       R4       R# )z
Getting permissions for a file returns a L{Permissions} object for
POSIX platforms (which supports separate user, group, and other
permissions bits.
rS     z	rwxrw-r--N)r  r  )r9   rq   r  rp   getPermissionsr   r  r}  r  s   & r   test_getPermissions_POSIX'FilePathTests.test_getPermissions_POSIX  s     #DIIOOG$**40		(7798;O;OPT;U #
 			 &&u-IIOOG$335??A;	
r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     * *D *r!   c                    \         P                  ! V P                  4       4       V P                  V P                  .4      pV P                  V. 4       R# )zi
While accessing L{twisted.python.filepath.FilePath.statinfo} is
deprecated, the filepath itself is not.
N)r   r_   r%   flushWarningstest_filePathNotDeprecatedrp   )r(   warningInfos   & r   r?  (FilePathTests.test_filePathNotDeprecated  sA    
 	$++-((($*I*I)JKb)r!   zTest will run only on Windowsc                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     
 
T 
r!   c                R   V P                  V P                  P                  R4      P                  R4       R Fz  pV P                  P                  R4      P                  V4       V P	                  V P                  P                  R4      P                  4       \        P                  ! V4      4       K|  	  V P                  P                  R4      P                  R4       V P	                  V P                  P                  R4      P                  4       P                  4       R4       R# )a  
Getting permissions for a file returns a L{Permissions} object in
Windows.  Windows requires a different test, because user permissions
= group permissions = other permissions.  Also, chmod may not be able
to set the execute bit, so we are skipping tests that set the execute
bit.
rS   r  iI  z	r-xr-xr-xN)r  r  )	
addCleanupr9   rq   r  rp   r9  r   r  r}  r  s   & r   test_getPermissions_Windows)FilePathTests.test_getPermissions_Windows  s     			066>"DIIOOG$**40		(7798;O;OPT;U #
 			 &&u-IIOOG$335??A;	
r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     / /4 /r!   c                    V P                  V P                  P                  4       4       V P                  V P                  P                  4       4       R# )z-
Ensure that a file is not a block or socket
N)r   r9   isBlockDeviceisSocketr'   s   &r   test_whetherBlockOrSocket'FilePathTests.test_whetherBlockOrSocket  s:     	0023++-.r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     E E$ Er!   c                   V P                  \        V P                  P                  4       V P                  \        V P                  P                  4       V P                  \        V P                  P
                  4       V P                  \        V P                  P                  4       V P                  \        V P                  P                  4       R# )z=
Verify that certain file stats are not available on Windows
N)ry   NotImplementedErrorr9   getInodeNumber	getDevicegetNumberOfHardLinks	getUserID
getGroupIDr'   s   &r   (test_statinfoBitsNotImplementedInWindows6FilePathTests.test_statinfoBitsNotImplementedInWindows  s    
 	-tyy/G/GH-tyy/B/BC-tyy/M/MN-tyy/B/BC-tyy/C/CDr!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     A AT Ar!   c                   V P                   P                  R4      pV P                   V3 F  pV P                  VP                  4       \        4       V P                  VP                  4       \        4       V P                  VP                  4       \        4       V P                  VP                  4       \        4       V P                  VP                  4       \        4       K  	  V P                  V P                   P                  4       VP                  4       4       V P                  V P                   P                  4       VP                  4       4       R# )zW
Verify that file inode/device/nlinks/uid/gid stats are numbers in
a POSIX environment
rT   N)
r9   rq   assertIsInstancerP  r   rQ  rR  rS  rT  rp   )r(   cr4   s   &  r   test_statinfoBitsAreNumbers)FilePathTests.test_statinfoBitsAreNumbers  s     IIOOH%AA!!!"2"2"4c:!!!++-5!!!"8"8":C@!!!++-5!!!,,.#6  	,,.>--/@r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     > >d >r!   c                  a a  ! R R4      pV! 4       oR VV 3R llpVS P                   n        RS P                   n        S P                  S P                   P	                  4       SP
                  4       S P                  S P                   P                  4       SP                  4       S P                  S P                   P                  4       SP                  4       S P                  S P                   P                  4       SP                  4       S P                  S P                   P                  4       SP                  4       R# )z
Verify that the right numbers come back from the right accessor methods
for file inode/device/nlinks/uid/gid (in a POSIX environment)
c                  *    ] tR tRt^tRtRtRtRtRt	R# )<FilePathTests.test_statinfoNumbersAreValid.<locals>.FakeStati  i,  i  r8  iX  r   N)
r*   r+   r,   r-   st_inost_devst_nlinkst_uidst_gidr/   r   r!   r   FakeStatr`    s    FFHFFr!   rf  c               $    V ^8  d   QhRRRRRR/# )r   argsr  kwargsr   rD   r   )r   s   "r   r   @FilePathTests.test_statinfoNumbersAreValid.<locals>.__annotate__  s!     	' 	'f 	' 	'4 	'r!   c                 *   < SSP                   n        R # r7   )r9   	_statinfo)rh  ri  faker(   s   *,r   
fakeRestat>FilePathTests.test_statinfoNumbersAreValid.<locals>.fakeRestat  s    "&DIIr!   N)r9   r9  rl  rp   rP  ra  rQ  rb  rR  rc  rS  rd  rT  re  )r(   rf  rn  rm  s   f  @r   test_statinfoNumbersAreValid*FilePathTests.test_statinfoNumbersAreValid  s    	 	 z	' 	' &		 #		113T[[A,,.<7794==I,,.<--/=r!   r   N)Jr*   r+   r,   r-   r.   r  r  r   symlinkSkipr  r  r  r  r  r  r  r	  r  r  r  r*  r2  r:  rC  rH  r   getTyperL  rP  rU  rZ  rb  ri  ro  rs  rw  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  r   r:  r?  rE  rK  rU  r[  rp  r/   r   r!   r   r  r  i  sz   
	
 K=>
 ?
 K=>R ?RX K=>? ?? K=>+ ?+* K=>0 ?0.& K=>$ ?$ K=>= ?=& K=>
 ?
";Q
%&7
L
 H')+KLS MS H')+KL	M M	MM
09

- K=>
; ?
;-/&
/
 K=>
 ?
 K=>
 ?
2-&(& ?K +>	.
.% K=>% ?% K=>% ?%*"L=\'' 	%$$
8%88&*, H "@A
 B
 * ""$$&EF
 G
,/ ""$$&EFE GE H "@AA BA H "@A> B>r!   r  c                  b    ] tR tRtRtR R ltR R ltR R ltR	 R
 ltR R lt	R R lt
RtR# )SetContentTestsi  z#
Tests for L{FilePath.setContent}.
c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   SetContentTests.__annotate__  s     
4 
4D 
4r!   c                   V P                  4       p\        P                  ! V4      pVP                  R4       \	        VR4      ;_uu_ 4       pVP                  4       pRRR4       V P                  RX4       R#   + '       g   i     L$; i)z`
Contents of the file referred to by a L{FilePath} can be written using
L{FilePath.setContent}.
s   hello, worldr  N)r%   r   r_   r   rM   r   rp   )r(   
pathStringr9   r3  contentss   &    r   
test_writeSetContentTests.test_write  sc    
 [[]
  ,(*d##tyy{H $(3 $#s   A99B		c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   rw  $  s     & &$ &r!   c                    \        R4      pV P                  \        VP                  R4       V P	                  VP
                  P                  4       R# )z}
If writing to the underlying file raises an exception,
L{FilePath.setContent} raises that exception after closing the file.
rV  s   blahN)r=  ry   r  r   rf   r   r  r   s   & r   test_fileClosing SetContentTests.test_fileClosing$  s8    
 r"'2==':%r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   rw  -  s     B BD Br!   c                   \        V P                  4       4      pVP                  R4       VP                  R4       VP                  4       pV P	                  \        V4      ^4       V P                  V^ ,          V^,          4       R# )z
L{FilePath.setContent} will use a different temporary filename on each
invocation, so that multiple processes, threads, or reentrant
invocations will not collide with each other.
s   alphas   betaN)r   r%   r   r2  rp   r   rp  )r(   r   openedSiblingss   &  r   test_nameCollision"SetContentTests.test_nameCollision-  si     dkkm,
h
g )^,a0N1-~a/@Ar!   c               $    V ^8  d   QhRRRRRR/# )r   r   zTrackingFilePath[AnyStr]	extensionr_  r   rD   r   )r   s   "r   r   rw  =  s#     
 
#; 
 
PT 
r!   c                0   VP                  4       pV P                  \        V4      ^R4       V P                  V^ ,          P	                  4       P                  4       P                  V4      RP                  V^ ,          P                  4       V4      4       R# )a  
Assert that the L{TrackingFilePath} C{fp} was used to open one sibling
with the given extension.

@param fp: A L{TrackingFilePath} which should have been used to open
    file at a sibling path.
@type fp: L{TrackingFilePath}

@param extension: The extension the sibling path is expected to have
    had.
@type extension: L{str}

@raise: C{self.failureException} is raised if the extension of the
    opened file is incorrect or if not exactly one file was opened
    using C{fp}.
z expected exactly one opened filez%{!r} does not end with {!r} extensionN)r2  rp   r   rf   
asTextModer_  rm  r   )r(   r   r  openeds   &&& r   _assertOneOpened SetContentTests._assertOneOpened=  sw    " !Va)KL1I  "++-66yA3::q	""$i	
r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   rw  W  s     * *t *r!   c                ~    \        V P                  4       4      pVP                  R4       V P                  VR4       R# )zu
L{FilePath.setContent} creates temporary files with the extension
I{.new} if no alternate extension value is given.
s   helloz.newNr   r%   r   r  r   s   & r   test_defaultExtension%SetContentTests.test_defaultExtensionW  s0    
 dkkm,
hb&)r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   rw  `  s     5 5d 5r!   c                    \        V P                  4       4      pVP                  RR4       V P                  VR4       R# )z
L{FilePath.setContent} creates temporary files with a user-supplied
extension so that if it is somehow interrupted while writing them the
file that it leaves behind will be identifiable.
s   goodbyes   -something-elsez-something-elseNr  r   s   & r   test_customExtension$SetContentTests.test_customExtension`  s4     dkkm,
j"45b"34r!   r   N)r*   r+   r,   r-   r.   r{  r  r  r  r  r  r/   r   r!   r   ru  ru    s+    
4&B 
4*5 5r!   ru  c                     ] tR tRtRtR R ltR R ltR R ltR	 R
 ltR R lt	R R lt
R R ltR R ltR R ltR R lt]! ]P"                  ! 4       R4      R R l4       t]! ]P"                  ! 4       R4      R R l4       t]! ]P"                  ! 4       '       * R4      R R l4       t]! ]P"                  ! 4       '       * R4      R R  l4       tR! R" ltR# R$ ltR% R& ltR' R( ltR) R* ltR+ R, ltR- R. ltR/ R0 ltR1 R2 ltR3 R4 ltR5 R6 lt R7 R8 lt!R9 R: lt"R; R< lt#R= R> lt$R? R@ lt%RA RB lt&RC RD lt'RE RF lt(RG RH lt)RI RJ lt*RK RL lt+RMt,RN# )OUnicodeFilePathTestsik  zd
L{FilePath} instances should have the same internal representation as they
were instantiated with.
c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   !UnicodeFilePathTests.__annotate__q  s     - -4 -r!   c                    \         P                  ! R4      pV P                  \        VP                  4      \
        4       R# )zM
L{FilePath} instantiated with a text path will return a text-mode
FilePath.
	   ./mon€yN)r   r_   rp   r   r9   r_  r   s   & r   test_UnicodeInstantiation.UnicodeFilePathTests.test_UnicodeInstantiationq  s,    
 ~.bgg,r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  y  s     2 2T 2r!   c                    \         P                  ! R4      pVP                  RP                  4       4      pV P	                  \        VP                  4      \        4       R# )zq
Calling L{FilePath.child} on a text-mode L{FilePath} with a L{bytes}
subpath will return a bytes-mode FilePath.
   ./parent-mon€y   child-mon€yNr   r_   rq   r&   rp   r   r9   r   r(   r   rq   s   &  r   #test_UnicodeInstantiationBytesChild8UnicodeFilePathTests.test_UnicodeInstantiationBytesChildy  sF    
 45+2245ejj)51r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     0 0t 0r!   c                    \         P                  ! R4      pVP                  R4      pV P                  \	        VP
                  4      \        4       R# )zl
Calling L{FilePath.child} on a text-mode L{FilePath} with a text
subpath will return a text-mode FilePath.
r  rY  N)r   r_   rq   rp   r   r9   r_  r  s   &  r   %test_UnicodeInstantiationUnicodeChild:UnicodeFilePathTests.test_UnicodeInstantiationUnicodeChild  s<    
 45&ejj)3/r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     0 0d 0r!   c                    \         P                  ! R4      pVP                  R4      pV P                  \	        VP
                  4      \        4       R# )zs
Calling L{FilePath.preauthChild} on a text-mode L{FilePath} with a text
subpath will return a text-mode FilePath.
r  rY  N)r   r_   r0  rp   r   r9   r_  r  s   &  r   ,test_UnicodeInstantiationUnicodePreauthChildAUnicodeFilePathTests.test_UnicodeInstantiationUnicodePreauthChild  s<    
 45-ejj)3/r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     2 2D 2r!   c                    \         P                  ! R4      pVP                  RP                  4       4      pV P	                  \        VP                  4      \        4       R# )zu
Calling L{FilePath.preauthChild} on a text-mode L{FilePath} with a bytes
subpath will return a bytes-mode FilePath.
r  r  N)r   r_   r0  r&   rp   r   r9   r   r  s   &  r   *test_UnicodeInstantiationBytesPreauthChild?UnicodeFilePathTests.test_UnicodeInstantiationBytesPreauthChild  sF    
 45 2 9 9 ;<ejj)51r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     / / /r!   c                    \         P                  ! R4      pV P                  \        VP                  4      \
        4       R# )zR
L{FilePath} instantiated with a L{bytes} path will return a bytes-mode
FilePath.
   ./N)r   r_   rp   r   r9   r   r   s   & r   test_BytesInstantiation,UnicodeFilePathTests.test_BytesInstantiation  s,    
 u%bgg.r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     2 24 2r!   c                    \         P                  ! R4      pVP                  RP                  4       4      pV P	                  \        VP                  4      \        4       R# )zo
Calling L{FilePath.child} on a bytes-mode L{FilePath} with a bytes
subpath will return a bytes-mode FilePath.
r  r  Nr  r  s   &  r   !test_BytesInstantiationBytesChild6UnicodeFilePathTests.test_BytesInstantiationBytesChild  sE    
 u%+2245ejj)51r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     0 0T 0r!   c                    \         P                  ! RP                  4       4      pVP                  R4      pV P	                  \        VP                  4      \        4       R# )zm
Calling L{FilePath.child} on a bytes-mode L{FilePath} with a text
subpath will return a text-mode FilePath.
u   parent-mon€yrY  N)r   r_   r&   rq   rp   r   r9   r_  r  s   &  r   #test_BytesInstantiationUnicodeChild8UnicodeFilePathTests.test_BytesInstantiationUnicodeChild  sE    
 299;<&ejj)3/r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     2 2$ 2r!   c                    \         P                  ! RP                  4       4      pVP                  RP                  4       4      pV P	                  \        VP                  4      \        4       R# )zv
Calling L{FilePath.preauthChild} on a bytes-mode L{FilePath} with a
bytes subpath will return a bytes-mode FilePath.
r  r  N)r   r_   r&   r0  rp   r   r9   r   r  s   &  r   (test_BytesInstantiationBytesPreauthChild=UnicodeFilePathTests.test_BytesInstantiationBytesPreauthChild  sO    
 4;;=> 2 9 9 ;<ejj)51r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     0 0D 0r!   c                    \         P                  ! RP                  4       4      pVP                  R4      pV P	                  \        VP                  4      \        4       R# )zt
Calling L{FilePath.preauthChild} on a bytes-mode L{FilePath} with a text
subpath will return a text-mode FilePath.
r  rY  N)r   r_   r&   r0  rp   r   r9   r_  r  s   &  r   *test_BytesInstantiationUnicodePreauthChild?UnicodeFilePathTests.test_BytesInstantiationUnicodePreauthChild  sE    
 4;;=>-ejj)3/r!   zTest will not work on Windowsc                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     @ @$ @r!   c                l    \         P                  ! R4      p\        V4      pV P                  RV4       R# )C
The repr of a L{unicode} L{FilePath} shouldn't burst into flames.
r/  u   FilePath('/mon€y')Nr   r_   reprrp   r(   r   
reprOutputs   &  r   test_unicoderepr%UnicodeFilePathTests.test_unicoderepr  s.    
 }-"X
2J?r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     Q Q Qr!   c                    \         P                  ! RP                  4       4      p\        V4      pV P	                  RV4       R# )A
The repr of a L{bytes} L{FilePath} shouldn't burst into flames.
u   /parent-mon€yz%FilePath(b'/parent-mon\xe2\x82\xacy')N)r   r_   r&   r  rp   r  s   &  r   test_bytesrepr#UnicodeFilePathTests.test_bytesrepr  s8    
 3::<="X
CZPr!   zTest only works on Windowsc                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     ; ; ;r!   c                l    \         P                  ! R4      p\        V4      pV P                  RV4       R# )r  zC:\zFilePath('C:\\')Nr  r  s   &  r   test_unicodereprWindows,UnicodeFilePathTests.test_unicodereprWindows  s.    
 v&"X
-z:r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     < <t <r!   c                l    \         P                  ! R4      p\        V4      pV P                  RV4       R# )r  s   C:\zFilePath(b'C:\\')Nr  r  s   &  r   test_bytesreprWindows*UnicodeFilePathTests.test_bytesreprWindows  s.    
 w'"X
.
;r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     7 7D 7r!   c                    \         P                  ! R4      pVP                  R4      pV P                  V^ ,          P                  \
        4       R# )zD
C{globChildren} will return the same type as the pattern argument.
/r!  N)r   r_   globChildrenrY  r9   r   r(   r   r   s   &  r   test_mixedTypeGlobChildren/UnicodeFilePathTests.test_mixedTypeGlobChildren  s<     s#??4(hqk..6r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     5 5$ 5r!   c                    \         P                  ! R4      pVP                  R4      pV P                  V^ ,          P                  \
        4       R# )z(
C{globChildren} works with L{unicode}.
r  *N)r   r_   r  rY  r9   r_  r  s   &  r   test_unicodeGlobChildren-UnicodeFilePathTests.test_unicodeGlobChildren  s<     s#??3'hqk..4r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     2 2d 2r!   c                z    \         P                  ! R4      pV P                  VP                  4       \        4       R# )zA
Calling C{basename} on an text- L{FilePath} returns L{unicode}.
./N)r   r_   rY  r_  r_  r   s   & r   test_unicodeBasename)UnicodeFilePathTests.test_unicodeBasename  s*     t$bkkmS1r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     1 1T 1r!   c                z    \         P                  ! R4      pV P                  VP                  4       \        4       R# )zC
Calling C{dirname} on a text-mode L{FilePath} returns L{unicode}.
r  N)r   r_   rY  rC   r_  r   s   & r   test_unicodeDirname(UnicodeFilePathTests.test_unicodeDirname  s*     t$bjjlC0r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     0 0D 0r!   c                    \         P                  ! R4      pVP                  4       pV P                  VP                  \
        4       R# )zS
Calling C{parent} on a text-mode L{FilePath} will return a text-mode
L{FilePath}.
r  N)r   r_   rh  rY  r9   r_  )r(   r   rh  s   &  r   test_unicodeParent'UnicodeFilePathTests.test_unicodeParent  s3    
 t$fkk3/r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     7 7 7r!   c                    \         P                  ! R4      pVP                  R4      pV P                  VP                  \
        4       R# )z`
A L{bytes} extension to C{temporarySibling} will mean a L{bytes} mode
L{FilePath} is returned.
r     .txtN)r   r_   rf  rY  r9   r   r(   r   tempSiblings   &  r   test_mixedTypeTemporarySibling3UnicodeFilePathTests.test_mixedTypeTemporarySibling  s:    
 ~.))'2k..6r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     5 5d 5r!   c                    \         P                  ! R4      pVP                  R4      pV P                  VP                  \
        4       R# )zd
A L{unicode} extension to C{temporarySibling} will mean a L{unicode}
mode L{FilePath} is returned.
u   /tmp/mon€y.txtN)r   r_   rf  rY  r9   r_  r  s   &  r   test_unicodeTemporarySibling1UnicodeFilePathTests.test_unicodeTemporarySibling  s;    
 01))&1k..4r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  &  s     3 3d 3r!   c                V   \         P                  ! R4      p\         P                  ! VP                  4       R,           4      pVP                  4        VP	                  R4      pVf   Q hV P                  V\         P                  4       V P                  VP                  \        4       R# )z
C{siblingExtensionSearch} called with L{bytes} on a L{unicode}-mode
L{FilePath} will return a L{list} of L{bytes}-mode L{FilePath}s.
r  r  r  N)r   r_   _asTextPathr$  r"  rY  r9   r   r(   r   r^  newPaths   &   r   $test_mixedTypeSiblingExtensionSearch9UnicodeFilePathTests.test_mixedTypeSiblingExtensionSearch&  s    
 ~.##BNN$4v$=>++G4"""gx'8'89gllE2r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  4  s     1 1D 1r!   c                V   \         P                  ! R4      p\         P                  ! VP                  4       R,           4      pVP                  4        VP	                  R4      pVf   Q hV P                  V\         P                  4       V P                  VP                  \        4       R# )z
C{siblingExtensionSearch} called with L{unicode} on a L{unicode}-mode
L{FilePath} will return a L{list} of L{unicode}-mode L{FilePath}s.
r  r  N)r   r_   r  r$  r"  rY  r9   r_  r  s   &   r   "test_unicodeSiblingExtensionSearch7UnicodeFilePathTests.test_unicodeSiblingExtensionSearch4  s    
 ~.##BNN$4v$=>++F3"""gx'8'89gllC0r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  C  s     3 3 3r!   c                J   \         P                  ! R4      p\         P                  ! VP                  4       R,           4      pVP                  4        VP	                  R4      pV P                  V\         P                  4       V P                  VP                  \        4       R# )zt
C{siblingExtension} called with L{bytes} on a L{unicode}-mode
L{FilePath} will return a L{bytes}-mode L{FilePath}.
r  r  r  N)r   r_   r  r$  r#  rY  r9   r   r  s   &   r   test_mixedTypeSiblingExtension3UnicodeFilePathTests.test_mixedTypeSiblingExtensionC  ss    
 ~.##BNN$4v$=>%%g.gx'8'89gllE2r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  Q  s     1 1d 1r!   c                J   \         P                  ! R4      p\         P                  ! VP                  4       R,           4      pVP                  4        VP	                  R4      pV P                  V\         P                  4       V P                  VP                  \        4       R# )zx
C{siblingExtension} called with L{unicode} on a L{unicode}-mode
L{FilePath} will return a L{unicode}-mode L{FilePath}.
r  r  N)r   r_   r  r$  r#  rY  r9   r_  r  s   &   r   test_unicodeSiblingExtension1UnicodeFilePathTests.test_unicodeSiblingExtensionQ  ss    
 ~.##BNN$4v$=>%%f-gx'8'89gllC0r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  _  s     F F Fr!   c                   \         P                  ! V P                  4       4      pVP                  4        \         P                  ! V P                  4       4      pV P	                  VP                  R4      VP                  4       4       V P	                  VP                  R4      VP                  4       4       V P	                  VP                  R4      R4       V P	                  VP                  R4      R4       R# )zf
C{siblingExtension} passed an empty string should return the same path,
in the type of its argument.
r!   rV  N)r   r_   r%   r$  rp   r"  asBytesModer  )r(   r   	notExistss   &  r   test_selfSiblingExtensionSearch4UnicodeFilePathTests.test_selfSiblingExtensionSearch_  s    
 ""4;;=1%%dkkm4	66s;V=O=O=QR66r:F<M<M<OP99"=tD99#>Er!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  l  s     3 3$ 3r!   c                n  a \         P                  ! R4      oSP                  4        V P                  V3R l4       SP	                  R4      pVP                  4        SP                  R4      pVf   Q hV P                  V\         P                  4       V P                  VP                  \        4       R# )zv
C{childSearchPreauth} called with L{bytes} on a L{unicode}-mode
L{FilePath} will return a L{bytes}-mode L{FilePath}.
r  c                 $   < S P                  4       # r7   r   r   s   r   r  GUnicodeFilePathTests.test_mixedTypeChildSearchPreauth.<locals>.<lambda>s      		r!   text.txts   text.txtN)
r   r_   r`  rD  rq   r$  childSearchPreauthrY  r9   r   r(   rq   r  r   s   &  @r    test_mixedTypeChildSearchPreauth5UnicodeFilePathTests.test_mixedTypeChildSearchPreauthl  s    
 ~.
+,$''4"""gx'8'89gllE2r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r  }  s     1 1 1r!   c                n  a \         P                  ! R4      oSP                  4        V P                  V3R l4       SP	                  R4      pVP                  4        SP                  R4      pVf   Q hV P                  V\         P                  4       V P                  VP                  \        4       R# )zz
C{childSearchPreauth} called with L{unicode} on a L{unicode}-mode
L{FilePath} will return a L{unicode}-mode L{FilePath}.
r  c                 $   < S P                  4       # r7   r  r  s   r   r  EUnicodeFilePathTests.test_unicodeChildSearchPreauth.<locals>.<lambda>  r!  r!   r"  N)
r   r_   r`  rD  rq   r$  r#  rY  r9   r_  r$  s   &  @r   test_unicodeChildSearchPreauth3UnicodeFilePathTests.test_unicodeChildSearchPreauth}  s    
 ~.
+,$''
3"""gx'8'89gllC0r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     1 1T 1r!   c                    \         P                  ! R4      pVP                  4       pV P                  W4       V P	                  VP
                  \        4       R# )Z
C{asBytesMode} on a L{unicode}-mode L{FilePath} returns a new
L{bytes}-mode L{FilePath}.
./tmpN)r   r_   r  r   rY  r9   r   r(   r   newfps   &  r   test_asBytesModeFromUnicode0UnicodeFilePathTests.test_asBytesModeFromUnicode  sB    
 w' #ejj%0r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     / /$ /r!   c                    \         P                  ! R4      pVP                  4       pV P                  W4       V P	                  VP
                  \        4       R# )r/     ./tmpN)r   r_   r  r   rY  r9   r_  r1  s   &  r   test_asTextModeFromBytes-UnicodeFilePathTests.test_asTextModeFromBytes  sA    
 x(#ejj#.r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     1 14 1r!   c                    \         P                  ! R4      pVP                  4       pV P                  W4       V P	                  VP
                  \        4       R# )z[
C{asBytesMode} on a L{bytes}-mode L{FilePath} returns the same
L{bytes}-mode L{FilePath}.
r7  N)r   r_   r  r   rY  r9   r   r1  s   &  r   test_asBytesModeFromBytes.UnicodeFilePathTests.test_asBytesModeFromBytes  s@    
 x( b ejj%0r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     / /D /r!   c                    \         P                  ! R4      pVP                  4       pV P                  W4       V P	                  VP
                  \        4       R# )z^
C{asTextMode} on a L{unicode}-mode L{FilePath} returns the same
L{unicode}-mode L{FilePath}.
r0  N)r   r_   r  r   rY  r9   r_  r1  s   &  r   test_asTextModeFromUnicode/UnicodeFilePathTests.test_asTextModeFromUnicode  s?    
 w'b ejj#.r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     3 3 3r!   c                    \         P                  ! R4      pVP                  RR7      pV P                  RVP                  4       R# )z
C{asBytesMode} with an C{encoding} argument uses that encoding when
coercing the L{unicode}-mode L{FilePath} to a L{bytes}-mode L{FilePath}.
   ☃r#   encoding   ☃N)r   r_   r  r^  r9   r1  s   &  r   'test_asBytesModeFromUnicodeWithEncoding<UnicodeFilePathTests.test_asBytesModeFromUnicodeWithEncoding  s6    
 x(0ouzz2r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     , ,d ,r!   c                    \         P                  ! R4      pVP                  RR7      pV P                  RVP                  4       R# )z
C{asTextMode} with an C{encoding} argument uses that encoding when
coercing the L{bytes}-mode L{FilePath} to a L{unicode}-mode L{FilePath}.
rG  r#   rE  rD  N)r   r_   r  r^  r9   r1  s   &  r   $test_asTextModeFromBytesWithEncoding9UnicodeFilePathTests.test_asTextModeFromBytesWithEncoding  s6    
 /w/h

+r!   c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     - - -r!   c                    \         P                  ! R4      pV P                  \        4      ;_uu_ 4        VP	                  RR7       RRR4       R#   + '       g   i     R# ; i)zu
C{asBytesMode} with an C{encoding} argument that can't be used to encode
the unicode path raises a L{UnicodeError}.
rD  asciirE  N)r   r_   ry   UnicodeErrorr  r   s   & r   /test_asBytesModeFromUnicodeWithUnusableEncodingDUnicodeFilePathTests.test_asBytesModeFromUnicodeWithUnusableEncoding  sB    
 x(|,,NNGN, -,,,   AA"	c                   V ^8  d   QhRR/# rQ   r   )r   s   "r   r   r    s     - -d -r!   c                    \         P                  ! R4      pV P                  \        4      ;_uu_ 4        VP	                  RR7       RRR4       R#   + '       g   i     R# ; i)zt
C{asTextMode} with an C{encoding} argument that can't be used to encode
the unicode path raises a L{UnicodeError}.
s   \u2603zutf-32rE  N)r   r_   ry   rQ  r  r   s   & r   ,test_asTextModeFromBytesWithUnusableEncodingAUnicodeFilePathTests.test_asTextModeFromBytesWithUnusableEncoding  sB    
 z*|,,MM8M, -,,,rT  r   N)-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   r  r  r  r  r  r%  r+  r3  r8  r<  r@  rH  rL  rR  rW  r/   r   r!   r   r  r  k  sO   
-2002/2020 H "AB@ C@ H "ABQ CQ ""$$&BC; D; ""$$&BC< D<75210753131F3"1"1/1/3,-- -r!   r  )7r.   
__future__r   r  ior8   r>  r  sysrY   pprintr   typingr   r   r   r   r   r	   r
   r   r   unittestr   zope.interface.verifyr   r   twisted.pythonr   twisted.python.filepathr   r   twisted.python.runtimer   twisted.python.win32r   twisted.trial.unittestr   r$   _supportsSymlinksrr  r   r1   r_   r   r   r   r   r   r=  rM  rO  r  ru  r  r   r!   r   <module>rf     s4   #  	 	   
   T T T  .  # 9 + 0 B,,..	5H 	5z6M z6z
h''/ 
4 <<7 #! #!L! !H<x((0 <~/?))&1 /?d CL]O} ]O@g>) g>TU5m U5pm-8 m-r!   