
    <e                       d dl Z d dlZ d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl	Z	d dl
Z
d dlZd dlZd dlZd dlZd dlZd dlmZmZmZmZmZmZmZmZmZmZmZmZ d dlZd dlZ	 d dlZn# e$ r dZY nw xY wd dl m!Z! d dl"m#Z# d dl$m%Z%m&Z& d dl"m'Z' e%dz   Z(e%dz   Z)e%d	z   Z*ej+        ,                    d
          Z-ej+        ,                    d          Z.ej+        dd         dk    Z/	 d dl0Z0d dl1Z1dZ2n# e$ r dZ2Y nw xY w	 d dl3Z3n# e$ r dZ3Y nw xY we j4        5                    d e6d                    Z7d Z8d Z9d>dZ:d Z;d>dZ<d Z=d Z> e>            Z?d Z@ G d d          ZA G d deAe jB                  ZC G d d eAe jB                  ZD G d! d"eAe jB                  ZE G d# d$eAe jB                  ZF G d% d&eAe jB                  ZG G d' d(eAe jB                  ZH G d) d*eH          ZI G d+ d,eAe jB                  ZJ G d- d.e jB                  ZK G d/ d0e jB                  ZL G d1 d2eM          ZN e jO        e? d3           G d4 d5eNe jB                              ZP e jO        e- d6           G d7 d8eNe jB                              ZQ G d9 d:e jB                  ZR G d; d<e jB                  ZSeTd=k    r e jU                     dS dS )?    N)make_archiveregister_archive_formatunregister_archive_formatget_archive_formatsErrorunpack_archiveregister_unpack_formatRegistryErrorunregister_unpack_formatget_unpack_formatsSameFileError_GiveupOnFastCopy)support)	os_helper)TESTFNFakePath)warnings_helper2_SRC_DSTdarwinsunos   aixTFzos.chdirzshouldn't call os.chdir()side_effectc                  J    t          t          t          dd          d          )NEXDEV   zInvalid cross-device link)OSErrorgetattrerrno)argskwargss     '/usr/lib/python3.11/test/test_shutil.py_fake_renamer&   :   s    
'%"--/J
K
KK    c                 F     t          j                    fd            }|S )Nc                      	 t           j        }t          t           _         | i ||t           _        S # |t           _        w xY wN)osrenamer&   )r#   r$   builtin_renamefuncs      r%   wrapzmock_rename.<locals>.wrap?   sD    	'YN$BI4(((&BIIBI&&&&s	   $4 A)	functoolswraps)r.   r/   s   ` r%   mock_renamer2   >   s8    _T' ' ' ' ' Kr'   c                     t          | t                    rt          j        j        |  } |rdnd}|rdnd}t          | ||          5 }|                    |           ddd           dS # 1 swxY w Y   dS )zWrite *content* to a file located at *path*.

    If *path* is a tuple instead of a string, os.path.join will be used to
    make a path.  If *binary* is true, the file will be opened in binary
    mode.
    wbwNutf-8encoding)
isinstancetupler+   pathjoinopenwrite)r;   contentbinarymoder8   fps         r%   
write_filerC   I   s     $ #w|T""44sD*tt7H	dD8	,	,	, 
                 s   A**A.1A.c                 h   d }t          |d          }d                    d t          |          D                       }t          | d          5 } |||          D ]}|                    |           	 ddd           n# 1 swxY w Y   t
          j                            |           |k    sJ dS )zBCreate a test file with an arbitrary size and random text content.c              3   T   K   | |k    sJ | |k    r|V  | |z  } | |k    | r| V  d S d S r*    )totalsteps     r%   chunkszwrite_test_file.<locals>.chunksY   sZ      }}}}dllJJJTME dll  	KKKKK	 	r'   i    r'   c                 n    g | ]2}t          j        t          j                                                  3S rF   )randomchoicestringascii_lettersencode).0is     r%   
<listcomp>z#write_test_file.<locals>.<listcomp>b   sA     / / / mF$899@@BB / / /r'   r4   N)minr<   ranger=   r>   r+   r;   getsize)r;   sizerI   bufsizechunkfcsizes          r%   write_test_filer[   W   s      $ooGHH / /$W~~/ / / 0 0E	dD		 QVD'** 	 	EGGENNNN	               7??4  D((((((s   %BB	Bc                     t          | t                    rt          j        j        |  } |rdnd}|rdnd}t          | ||          5 }|                                cddd           S # 1 swxY w Y   dS )zReturn contents from a file located at *path*.

    If *path* is a tuple instead of a string, os.path.join will be used to
    make a path.  If *binary* is true, the file will be opened in binary
    mode.
    rbrNr6   r7   )r9   r:   r+   r;   r<   r=   read)r;   r@   rA   r8   rB   s        r%   	read_filer`   i   s     $ #w|T""44sD*tt7H	dD8	,	,	, wwyy                 s   A((A,/A,c                    g }t          t          j        |                     D ]}t          j                            | |          }t          j                            |          ret          j                            |          sF|                    |dz              t          |          D ]}|                    |dz   |z              |                    |           |S )N/)	sortedr+   listdirr;   r<   isdirislinkappendrlistdir)r;   resnamepns        r%   rh   rh   w   s    
Crz$''((  GLLt$$7== 	BGNN1$5$5 	JJtcz"""a[[ + +

4#:>****+ JJtJr'   c                  6   t          t          d          sdS d } d }	 t          j        dt          j                    d          5 }|j        } |                    d           d d d            n# 1 swxY w Y   t          | d          5 }t          j        dt          j                    d          5 }|j        }|                                }|                                }	 t          j	        ||dd           	 d d d            d d d            | t          j        |            |t          j        |           d	S d	S # t          $ rH Y d d d            d d d            | t          j        |            |t          j        |           dS dS w xY w# 1 swxY w Y   	 d d d            n# 1 swxY w Y   | t          j        |            |t          j        |           d S d S # | t          j        |            |t          j        |           w w xY w)
NsendfileFr4   dirdeletes
   0123456789r]   r      T)hasattrr+   tempfileNamedTemporaryFilegetcwdrj   r>   r=   filenorn   r   unlinkr    )srcnamedstnamerY   srcdstinfdoutfds          r%   supports_file2file_sendfiler      s8   2z"" uGG&(29;;uMMM 	#QRfGGGM"""	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# '4   
	 C,Try{{5QQQ 	 UX(zz||

 KtQ222  	  	  	  	  	  	 
	  
	  
	  
	  
	  
	  W%%%W%%%%%   ! ! ! 	  	  	  	  	  	 
	  
	  
	  
	  
	  
	  W%%%W%%%%% !	  	  	  	  	  	  	  	  	 
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  W%%%W%%%%%  W%%%W%%%% s   (G) A."G) .A22G) 5A26G) 	)F.20F#E:F;F.G) 
FFF.G) FFF	F.F	F."G) .F22G) 5F26G) )/Hc                     t           rxt          j        dk    rht          j        dt          j        z            } |                     d          d                                         d         }t          |d          dk    S dS )	Niz/usr/bin/dump -o %s
      i    T)AIXsysmaxsize
subprocess	getoutput
executablesplitint)hdrsmaxdatas     r%   
_maxdataOKr      sm    
 s{j((!"7#."HII

4  $**,,Q/72*,,tr'   c                       e Zd ZddZdS )BaseTestNc                     t          j        |t          j                              }|                     t
          j        |           |S )zjCreate a temporary directory that will be cleaned up.

        Returns the path of the directory.
        )prefixrp   )rt   mkdtempr+   rv   
addCleanupr   rmtree)selfr   ds      r%   r   zBaseTest.mkdtemp   s;    
 F	<<<	(!,,,r'   r*   )__name__
__module____qualname__r   rF   r'   r%   r   r      s(             r'   r   c                   4   e Zd Zd Zej        d             Zej        d             Z ej	        e
d          d             Z ej	        e
d          d             Zd Z ej        ej        dd	         d
k    d          ej        ej        d                                     Zd Zd Zd Z ej	        ej        d          d             Z ej        ej        d          d             Zd Zej        d             Z ej	        e
d          d             ZdS )
TestRmTreec                 x   |                                  }t          j                            |d          }t          j        |           t          t          j                            |d          d           t          j        |          }|                     |t                     t          j
        |           d S )Nkillmesomefilefoo)r   r+   r;   r<   mkdirrC   fsencodeassertIsInstancebytesshutilr   )r   tmpvictims      r%   test_rmtree_works_on_bytesz%TestRmTree.test_rmtree_works_on_bytes   s    llnnc8,,
27<<
33U;;;V$$fe,,,fr'   c                    |                                  }t          j                            |d          }t          j        |           t          j                            |d          }t          j        ||           |                     t          t          j	        |           | 
                    t          j                            |                     | 
                    t          j                            |                     g fd}t          j	        ||           |                     t                    d           |                     d         d         t          j        j                   |                     d         d         |           |                     d         d         d         t                     d S )Nrp   linkc                  2                         |            d S r*   rg   r#   errorss    r%   onerrorz8TestRmTree.test_rmtree_fails_on_symlink.<locals>.onerror       MM$r'   r   r   r   rr   )r   r+   r;   r<   r   symlinkassertRaisesr    r   r   
assertTrueexistslexistsassertEquallenassertIsrf   r   r   r   dir_r   r   r   s        @r%   test_rmtree_fails_on_symlinkz'TestRmTree.test_rmtree_fails_on_symlink   sh   llnnw||C''
w||C((

4'6=$777t,,-----...	  	  	  	  	 dG,,,,Va(((fQilBGN3331t,,,fQil1ow77777r'   c                    |                                  }t          j                            |d          }t          j                            |d          }t          j                            |d          }|||fD ]}t          j        |           t          j                            |d          }t          |d           t          j                            |d          }t          j        ||           t          j                            |d          }t          j        ||           t          j                            |d          }	t          j        ||	           t          j        |           | 	                    t          j        
                    |                     |                     t          j        
                    |                     |                     t          j        
                    |                     d S 	Ndir1dir2dir3file1r   link1link2link3)r   r+   r;   r<   r   rC   r   r   r   assertFalser   r   
r   r   r   r   r   r   r   r   r   r   s
             r%   test_rmtree_works_on_symlinksz(TestRmTree.test_rmtree_works_on_symlinks   s   llnnw||C((w||D&))w||C((tT! 	 	AHQKKKKS'**5%   T7++

4T7++

4T7++

5%   d--...t,,---u--.....r'   zonly relevant on Windowsc                    |                                  }t          j                            |d          }t          j        |           t          j                            |d          }t          j        ||           |                     t          j	        |           | 
                    t          t          j        |           |                     t          j                            |                     |                     t          j                            |                     g fd}t          j        ||           |                     t%                    d           |                     d         d         t          j        j                   |                     d         d         |           |                     d         d         d         t                     d S )Nrp   r   c                  2                         |            d S r*   r   r   s    r%   r   z:TestRmTree.test_rmtree_fails_on_junctions.<locals>.onerror   r   r'   r   r   r   rr   )r   r+   r;   r<   r   _winapiCreateJunctionr   r   rx   r   r    r   r   r   r   r   r   r   r   rf   r   r   s        @r%   test_rmtree_fails_on_junctionsz)TestRmTree.test_rmtree_fails_on_junctions   s   llnnw||C''
w||C((tT***	($///'6=$777t,,-----...	  	  	  	  	 dG,,,,Va(((fQilBGN3331t,,,fQil1ow77777r'   c                    |                                  }t          j                            |d          }t          j                            |d          }t          j                            |d          }|||fD ]}t          j        |           t          j                            |d          }t          |d           t          j                            |d          }t          j        ||           t          j                            |d          }t          j        ||           t          j                            |d          }	t          j        ||	           t          j	        |           | 
                    t          j                            |                     |                     t          j                            |                     |                     t          j                            |                     d S r   )r   r+   r;   r<   r   rC   r   r   r   r   r   r   r   r   s
             r%   test_rmtree_works_on_junctionsz)TestRmTree.test_rmtree_works_on_junctions  s   llnnw||C((w||D&))w||C((tT! 	 	AHQKKKKS'**5%   T7++tU+++T7++tU+++T7++ue,,,d--...t,,---u--.....r'   c                 :   t          j        |                                           }|                     t          t
          j        |           t          j        |d           |                                 }t          |dfd           t          j	        
                    |d          }|                     t                    5 }t          j        |           d d d            n# 1 swxY w Y   |                     |j        j        |           |                     t          j	                            |                     t          j        |d           |                     t          j	                            |                     g fd}t          j        ||           |                     t#                    d           |                     d	         d	         t          j                   |                     d	         d
         |           |                     d	         d         d
         t                     |                     d	         d         d
         j        |           |                     d
         d	         t          j                   |                     d
         d
         |           |                     d
         d         d
         t                     |                     d
         d         d
         j        |           d S )Nrp   Tignore_errorststfile c                  2                         |            d S r*   r   r   s    r%   r   z.TestRmTree.test_rmtree_errors.<locals>.onerror,  r   r'   r   rr   r   r   )rt   mktempr   r   FileNotFoundErrorr   r   rC   r+   r;   r<   NotADirectoryErrorr   	exceptionfilenamer   r   r   r   scandirr   rmdir)r   r   tmpdircmr   r   s        @r%   test_rmtree_errorszTestRmTree.test_rmtree_errors  s   ?t||~~666+V]HEEEhd3333 FI&+++7<<	22122 	$bM(###	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$.999x00111hd3333x00111	  	  	  	  	 h0000Va(((fQilBJ///1x000fQil1o/ABBB1a18<<<fQilBH---1x000fQil1o/ABBB1a18<<<<<s   C&&C*-C*N   cygwinz2This test can't be run on Cygwin (issue #1071513).c                 z   d| _         t          j        t                     |                     t
          j        t                     t          j                            t          d          | _	        t          j                            t          d          | _
        t          j        | j	                   t          j        | j
                   t          j        t                    j        }t          j        | j	                  j        }t          j        | j
                  j        }t          j        t          j        z  }t          j        | j	        |           t          j        | j
        |           t          j        t          |           |                     t          j        t          |           |                     t          j        | j	        |           |                     t          j        | j
        |           t          j        t          | j                   |                     | j         dd           d S )Nr   abr   r   z1Expected call to onerror function did not happen.)
errorStater+   r   r   r   r   r   r;   r<   child_file_pathchild_dir_pathr   create_empty_filestatst_modeS_IREADS_IEXECchmodcheck_args_to_onerrorr   )r   old_dir_modeold_child_file_modeold_child_dir_modenew_modes        r%   test_on_errorzTestRmTree.test_on_error:  s   
 
v...!w||FC88 gll6377#D$8999
$%%%wv. gd&:;;CWT%899A<,
%x000
$h///
"""&,777$"68KLLL$"57IJJJfd&@AAAA!L	N 	N 	N 	N 	Nr'   c                    | j         dk     r|t          j        u r|                     || j                   nl|t          j        u r|                     || j                   nB|                     |t          j                   | 	                    |t          | j        g           |                     t          |d         t                               | xj         dz  c_         d S |                     |t          j                   |                     |t                     |                     t          |d         t                               d| _         d S )Nrr   r   r   r   )r   r+   rx   r   r   r   r   r   rd   assertInr   r   
issubclassr    )r   r.   argexcs       r%   r   z TestRmTree.check_args_to_onerrorY  s"    ?Qry    d&:;;;;!!  d&9::::dBJ///cFD,?#@AAAOOJs1vw77888OOq OOOOT28,,,S&)))OOJs1vw77888DOOOr'   c                    	 t           j        fd}|t           _        t          j        t                     t	          t          dfd           t          j        t                     t           _        d S # t           _        w xY w)Nc                 L    | t           k    rt                       |           S r*   )r   r    )fnr#   r$   
orig_lstats      r%   raiserzFTestRmTree.test_rmtree_does_not_choke_on_failing_lstat.<locals>.raiserw  s#    <<!))O%:b>>)r'   r   )r+   lstatr   r   rC   r   r   )r   r   r   s     @r%   +test_rmtree_does_not_choke_on_failing_lstatz6TestRmTree.test_rmtree_does_not_choke_on_failing_lstatt  s    	"J* * * * *
 BHHV...M&!!!!BHHHzBH!!!!s   A&A7 7Bc                 b   t           j        t           j        t           j        t           j        ht           j        k    o/t           j        t           j        v ot           j        t           j        v }|r| 	                    t          j                   | 	                    t          j        j                   |                                 }t           j                            |d          }t          j        |           	 t          j        } G d dt&                    fd}|t          _        |                     t          j        |           |t          _        d S # |t          _        w xY w|                     t          j                   |                     t          j        j                   d S )Nr   c                       e Zd ZdS )HTestRmTree.test_rmtree_uses_safe_fd_version_if_available.<locals>.CalledN)r   r   r   rF   r'   r%   Calledr    s          r'   r  c                      r*   rF   )r#   r$   r  s     r%   _raiserzITestRmTree.test_rmtree_uses_safe_fd_version_if_available.<locals>._raiser  s     Lr'   )r+   r=   r   rx   r   supports_dir_fdrd   supports_fdsupports_follow_symlinksr   r   _use_fd_functionsr   avoids_symlink_attacksr   r;   r<   r   _rmtree_safe_fd	Exceptionr   r   )r   r  tmp_dirr   real_rmtreer  r  s         @r%   -test_rmtree_uses_safe_fd_version_if_availablez8TestRmTree.test_rmtree_uses_safe_fd_version_if_available  sn    grw	28D/0 DZ2>9D  W(CC 	  	COOF4555OOFM@AAAllnnGWc**AHQKKK5$4-----Y---! ! ! ! !)0&!!&&-;;;)4&&&&4444V5666V]ABBBBBs   <AE E)zdir_fd is not supportedc                    |                                  }d}t          j                            ||          }t          j        |t          j                  }|                     t          j        |           t          j        |           t          j        t          j                            |d                     t          t          j                            |dd          d           | 
                    t          j                            |                     t          j        ||           |                     t          j                            |                     d S )Nr   subdirr   r   dir_fd)r   r+   r;   r<   r=   O_RDONLYr   closer   rC   r   r   r   r   r   )r   r  r   fullnamer  s        r%   test_rmtree_with_dir_fdz"TestRmTree.test_rmtree_with_dir_fd  s   ,,..7<<00"+..&)))

h1122227<<(J??GGGx00111fV,,,,1122222r'   zdir_fd is supportedc                 "   |                                  }|                     t                    5  t          j        |d           d d d            n# 1 swxY w Y   |                     t          j                            |                     d S )Nr   r  )	r   r   NotImplementedErrorr   r   r   r+   r;   r   )r   r  s     r%   #test_rmtree_with_dir_fd_unsupportedz.TestRmTree.test_rmtree_with_dir_fd_unsupported  s    ,,..233 	- 	-M'!,,,,	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	-w//00000s   AAAc                     t          j        |                                           \  }}t          j        |           |                     t          t          j        |           t          j	        |           d S Nr   )
rt   mkstempr   r+   r  r   r   r   r   remove)r   handler;   s      r%   test_rmtree_dont_delete_filez'TestRmTree.test_rmtree_dont_delete_file  s]    'DLLNN;;;
,fmTBBB
	$r'   c                    t          j        t                     	 t           j                            t          d          }t           j                            t          d          }t          j        |           t          j        ||           |                     t          t          j	        |           t          j	        |d           t          j	        t          d           d S # t          j	        t          d           w xY w)NcheeseshopTr   )
r+   r   r   r;   r<   r   r   r    r   r   r   r{   r|   s      r%   test_rmtree_on_symlinkz!TestRmTree.test_rmtree_on_symlink  s     		6',,vx00C',,vv..CHSMMMJsC   gv}c:::M#T2222M&555555FM&55555s   B/C' 'Dc                    t          j        t                     	 t           j                            t          d          }t           j                            t          d          }t          j        |           t          t           j                            |d          d                                           t          j        ||           | 	                    t          t          j        |           t          j        |d           t          j        t          d           d S # t          j        t          d           w xY w)Nr$  r%  spamr4   Tr   )r+   r   r   r;   r<   r=   r  r   r   r   r    r   r   r&  s      r%   test_rmtree_on_junctionz"TestRmTree.test_rmtree_on_junction  s    
		6',,vx00C',,vv..CHSMMMc6**D1177999"3,,,gv}c:::M#T2222M&555555FM&55555s   C/D' 'E)r   r   r   r   r   skip_unless_symlinkr   r   unittest
skipUnlessr   r   r   r   skipIfr   platformskip_if_dac_overrideskip_unless_working_chmodr   r   r  r  r   r  r  r  r"  r'  r*  rF   r'   r%   r   r      s          "8 8 #"8$ "/ / #"/* X"<==8 8 >=8& X"<==/ / >=/*= = =B X_S\"1"%1IK K#(N N )( $#K KN6     6" " " C C C0 X13LMM3 3 NM3 X_V-/DEE1 1 FE1   "6 6 #"6 X"<==6 6 >=6 6 6r'   r   c                      e Zd Zd Zd Zej        d             Zd Zd Z	d Z
ej                            d          d             Zd	 Z ej         eed
          d          ej         ej        ej        dk    d          d                                     Zd Zej        d             Zej        d             Zd Zd ZdS )TestCopyTreec           	         |                                  }t          j                            |                                  d          }|                     t
          j        |           |                     t
          j        t          j                            |                     t          |dfd           t          j	        t          j                            |d                     t          |ddfd           t          j
        ||           |                     t          j                            t          j                            |d                               |                     t          j                            t          j                            |d                               |                     t          j                            t          j                            |dd                               t          |df          }|                     |d           t          |ddf          }|                     |d           d S )Ndestinationtest.txt123test_dir456)r   r+   r;   r<   r   r   r   dirnamerC   r   copytreer   isfilere   r`   r   r   src_dirdst_diractuals       r%   test_copytree_simplez!TestCopyTree.test_copytree_simple  s   ,,..',,t||~~}==w///rww'?'?@@@GZ(%000
gz22333GZ4e<<<)))rw||GZ'H'HIIJJJbgll7J&G&GHHIIIrw||GZ4>(@ (@ A A 	B 	B 	BGZ011'''GZ<=='''''r'   c           	      P   |                                  }|                                  }|                     t          j        |           |                     t          j        |           t	          |dfd           t          j        t
          j                            |d                     t          j        t
          j                            |d                     t	          |ddfd           t	          |ddfd           t          j	        ||d           | 
                    t
          j                            t
          j                            |d                               | 
                    t
          j                            t
          j                            |d                               | 
                    t
          j                            t
          j                            |dd                               t          |df          }|                     |d           t          |ddf          }|                     |d           |                     t                     5  t          j	        ||d	           d d d            d S # 1 swxY w Y   d S )
Nznonexisting.txtr7  existing_dirzexisting.txtzwill be replacedzhas been replacedT)dirs_exist_okF)r   r   r   r   rC   r+   r   r;   r<   r;  r   r<  re   r`   r   r   FileExistsErrorr=  s       r%   test_copytree_dirs_exist_okz(TestCopyTree.test_copytree_dirs_exist_ok  s   ,,..,,..w///w///G./777
g~66777
g~66777G^^<>PQQQG^^<>QRRR====rw||G=N'O'OPPQQQbgll7N&K&KLLMMMrw||G^4B(D (D E E 	F 	F 	FG%6788'''G^^DEE!4555// 	C 	COGWEBBBB	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	Cs   6JJ"Jc           	         |                                  }t          j                            |d          }t          j                            |d          }t          j                            |d          }t          j        |           t          j        |           t          |dfd           t          j                            |d          }t          j                            |d          }t          j        t          j                            |d          |           t          t          d          r,t          j        |t          j
        t          j        z             t          t          d	          r4t          t          d
          rt          j        |t          j                   t          j        |          }t          j        ||d           |                     t          j                            t          j                            |dd                               t          j        t          j                            |dd                    }t          j        dk    r|                    d          r
|dd          }|                     |t          j                            |d                     t          j        |          }	t          t          d          r |                     |	j        |j                   t          t          d	          r"|                     |	j        |j                   d S d S )Nr{   r|   subzfile.txtr   r   zsub/linklchmodlchflags	UF_NODUMPTsymlinksntz\\?\   )r   r+   r;   r<   r   rC   r   rs   rI  r   S_IRWXUS_IRWXOrJ  rK  r   r   r;  r   rf   readlinkrj   
startswithr   r   st_flags)
r   r  r>  r?  sub_dirsrc_linkdst_linksrc_statr@  dst_stats
             r%   test_copytree_symlinksz#TestCopyTree.test_copytree_symlinks  s   ,,..',,w..',,w..',,w..

GZ(%0007<<007<<44

27<<44	 	 	2x   	=Iht| ;<<<2z"" 	2wt['A'A 	2K$.1118H%%48888rw||GUF'K'KLLMMMRW\\'5&AABB 7d??v00;;?ABBZFgz!B!BCCC8H%%2x   	AX-x/?@@@2z"" 	CX.0ABBBBB	C 	Cr'   c           
      0   t           j        j        }t           j        j        }|                                 }	  ||                                 d          }t          |dfd           t          |dfd           t          j         ||d                     t          |ddfd           t          j         ||d                     t          |ddfd           t          j         ||dd                     t          j         ||dd	                     t          |dddfd           t          |dd	d
fd           	 t          j        dd          }t          j	        |||           | 
                     | ||d                               |                      | ||d                               |                      | ||d                               t          j        |           n# t          j        |           w xY w	 t          j        dd          }t          j	        |||           |                      | ||d                               |                      | ||dd	                               |                      | ||dd                               t          j        |           n# t          j        |           w xY w	 d }t          j	        |||           |                      | ||dd	d
                               |                      | ||dd                               t          j        |           n# t          j        |           w xY w	 t          j        |           t          j        t           j                            |                     d S # t          j        |           t          j        t           j                            |                     w xY w)Nr5  r6  r7  ztest.tmpr8  r9  	test_dir2r  subdir2ztest.pyz*.tmpignorezsubdir*c                 r   g }|D ]}t           j                            | |          }t           j                            |          r4|                                d         dk    r|                    |           ut           j                            |          d         dv r|                    |           |S )Nr   r  z.py)r+   r;   r<   re   r   rg   splitext)r{   namesri   rj   r;   s        r%   _filterz8TestCopyTree.test_copytree_with_exclude.<locals>._filterK  s    C % - -!w||C66GMM$// - JJLL,88JJt,,,,W--d33B7EBBJJt,,,Jr'   )r+   r;   r<   r   r   rC   r   r   ignore_patternsr;  r   r   r   r:  )r   r<   r   r>  r?  patternsrc  s          r%   test_copytree_with_excludez'TestCopyTree.test_copytree_with_exclude#  s   w|,,..:	4d4<<>>=99G,e444,e444HTT':..///Z8%@@@HTT';//000j95AAAHTT';99:::HTT';	::;;;h
CUKKKiCUKKK'!1';GGBBBBttGZ'@'@ A ABBB  Wj(A(A!B!BCCC  Wk(B(B!C!CDDDg&&&&g&&&&'!1'9EEBBBB  Wj(A(A!B!BCCC  Wk9(M(M!N!NOOO  Wk8(L(L!M!MNNNg&&&&g&&&&'
 
 
 AAAA   Wk9-6)8 )8 "9 "9 : : :  Wk8(L(L!M!MNNN g&&&&g&&&&&M'"""M"'//'2233333 M'"""M"'//'223333sX   D
O B$G< 'O <HO B&K <O K''O +A-M- O -NO APc           
          t           j        j        }t           j        j        }                                 } ||d          }t          j         ||                     t          j         ||d                     t          j        t           j                            |dd                     t          |dddfd           g  fd} |                                 d          }t          j        |||            	                     | ||ddd                                |                                 d          }t          j        t          j        |          ||            	                     | ||ddd                                |                                 d          }t          t          j        |                    d	         }                     |t           j                   t          j        |||            	                     | ||ddd                                                    t#                    d
           d S )Nsourcer8  r  r6  r9  c                 X                        |                                | t                                         |t                                         t          |          t          t          |                               |D ]}                    |t                     g S r*   )rg   r   strlistr   r   set)r{   rb  rj   invokationsr   s      r%   _ignorez?TestCopyTree.test_copytree_arg_types_of_ignore.<locals>._ignorer  s    s###!!#s+++!!%...SZZSZZ999 1 1%%dC0000Ir'   r5  r^  r   	   )r+   r;   r<   r   r   r   rC   r   r;  r   pathlibPathrk  r   r   DirEntryr   r   )	r   r<   r   r  r>  rn  r?  src_dir_entryrm  s	   `       @r%   !test_copytree_arg_types_of_ignorez.TestCopyTree.test_copytree_arg_types_of_ignored  sq   w|,,..$w))
g
gz**+++
gz8<<===GZ:>FFF	 	 	 	 	 	 $t||~~}559999ttGZ$. 0  0 1 1 	2 	2 	2 $t||~~}55W--wwGGGGttGZ$. 0  0 1 1 	2 	2 	2 $t||~~}55RZ0011!4mR[999ww????ttGZ$. 0  0 1 1 	2 	2 	2 	[))1-----r'   c           	         |                                  }t          j                            |d          }t          j        |           t          j                            |d          }|                     t          j        |           t          j        |d           t          |dfd           t          j        t          j                            |d          d           t          |dfd           t          j        t          j                            |d          d           t          j         |	          }|                     t          j        |           t          j        |d           t          j        ||           |                     t          j        |          j        t          j        |          j                   |                     t          j        t          j                            |d                    j        t          j        t          j                            |d                    j                   |                     t          j        t          j                            |d                    j        t          j        t          j                            |d                    j                   t          j                            |t          j                            |          d
                   }|                     t          j        |          j        t          j        |          j                   d S )Nrh  r5  i  zpermissive.txtr7  zrestrictive.txtr9  i  r   r   )r   r+   r;   r<   r   r   r   r   r   rC   rt   r   r;  r   r   r   r   )r   r  r>  r?  restrictive_subdirrestrictive_subdir_dsts         r%   !test_copytree_retains_permissionsz.TestCopyTree.test_copytree_retains_permissions  s   ,,..',,w11
',,w66w///
%   G-.666
g'788%@@@G./777
g'8995AAA%-':::	(*<===
#U+++)))))12773C3C3KLLLg7G!H!HIIQ'"',,w8H"I"IJJR	T 	T 	Tg7H!I!IJJR'"',,w8I"J"JKKS	U 	U 	U!#g.0gmm<N.O.OPQ.R"T "T!344<'"899A	C 	C 	C 	C 	Cr'   zos.chmodc                    |                                  }t          j                            |                                  d          }|                     t
          j        |           |                     t
          j        t          j                            |                     t          d          |_	        | 
                    t
          j                  5  t          j        ||           d d d            d S # 1 swxY w Y   d S )Nr5  zka-boom)r   r+   r;   r<   r   r   r   r:  PermissionErrorr   r   r   r;  )r   
mock_patchr>  r?  s       r%   test_copytree_winerrorz#TestCopyTree.test_copytree_winerror  s   
 ,,..',,t||~~}==w///rww'?'?@@@!0!;!;
v|,, 	. 	.OGW---	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.s   C::C>C>c                      fd}g                                   t          j                                                    t          t          j                            d          dd          5 }|                                 d d d            n# 1 swxY w Y   t          j	        |            
                    t                    d           d S )	Nc                 n                        d                                | t                                         |t                                         | t          j                            d                                         |t          j                            d                     d S Nr   )rg   r   rj  r   r+   r;   r<   )r   r   r|   flagr   r{   s     r%   custom_cpfunzETestCopyTree.test_copytree_custom_copy_function.<locals>.custom_cpfun  s    KK!!!S)))!!!S)))QS% 8 8999QS% 8 899999r'   r   r   r5   r6   r7   copy_functionr   )r   rt   r   r=   r+   r;   r<   r  r   r;  r   r   )r   r  rY   r|   r  r{   s   `  @@@r%   "test_copytree_custom_copy_functionz/TestCopyTree.test_copytree_custom_copy_function  s   	: 	: 	: 	: 	: 	: 	: 	: llnno$,,..111"',,sE**C'BBB 	aGGIII	 	 	 	 	 	 	 	 	 	 	 	 	 	 	S====TA&&&&&s   :BB"Bmkfiforequires os.mkfifo()vxworks%fifo requires special path on VxWorksc                    t          j        t                     	 t           j                            t          d          }t          j        |           t           j                            |d          }	 t          j        |           n/# t          $ r"}|                     d|z             Y d }~nd }~ww xY w	 t          j	        t          t                     |                     d           nq# t          j        $ r_}|j        d         }|                     t          |          d           |d         \  }}}|                     d|z  |           Y d }~nd }~ww xY wt          j        t          d	           t          j        t          d	           d S # t          j        t          d	           t          j        t          d	           w xY w)
Nr  mypipeos.mkfifo(): %sz$shutil.Error should have been raisedr   r   z`%s` is a named pipeTr   )r+   r   r   r;   r<   r  rz  skipTestr   r;  TESTFN2failr   r#   r   r   r   )r   r  pipeer   r{   r|   	error_msgs           r%   test_copytree_named_pipez%TestCopyTree.test_copytree_named_pipe  s   
 		7W\\&(33FHV7<<11D5	$" 5 5 5/!3444444445B000 		@AAAA < K K K  Va000&,Qi#S)  !7$!>	JJJJJJJJ	K M&5555M'666666 M&5555M'66666sa   AF 5B
 	F 

B6B1,F 1B66F :C/ F /E>AEF EF 8Gc                    |                                  }t          j                            |                                  d          }t	          |dfd           t          j        t          j                            |d                     t	          |ddfd           g fd}t          j        |||           |                     t                    d           d S )	Nr5  r6  r7  r8  r9  c                 6                         | |f           d S r*   r   )r{   r|   copieds     r%   _copyz6TestCopyTree.test_copytree_special_func.<locals>._copy  s    MM3*%%%%%r'   r  rr   )
r   r+   r;   r<   rC   r   r   r;  r   r   )r   r>  r?  r  r  s       @r%   test_copytree_special_funcz'TestCopyTree.test_copytree_special_func  s    ,,..',,t||~~}==GZ(%000
gz22333GZ4e<<<	& 	& 	& 	& 	& 	>>>>Va(((((r'   c                    |                                  }t          j                            |d          }t	          |d           t          j                            |d          }t          j        |           ||fD ]h}t          j        dt          j                            |d                     t          j        |t          j                            |d                     it          j                            |                                  d          }|                     t          t          j
        ||           t          j                            |                                  d          }t          j
        ||d	
           t          j        |          D ]2\  }}}|                     d|           |                     d|           3t          j                            |                                  d          }t          j
        ||d	           |                     dt          j        |                     d S )Nr6  abcdir_a
IDONTEXISTbrokenvalidr5  destination2T)ignore_dangling_symlinksdestination3rL  )r   r+   r;   r<   rC   r   r   r   r   r   r;  walkassertNotInr   rd   )	r   r>  
valid_filer  r   r?  rootdirsfiless	            r%   test_copytree_dangling_symlinksz,TestCopyTree.test_copytree_dangling_symlinks  s   ,,..W\\':66
:u%%%Wg..
% 	= 	=AJ|RW\\!X%>%>???Jz27<<7#;#;<<<< ',,t||~~}==%'7CCC ',,t||~~~>>4HHHH!#!1!1 	* 	*D$Xu---MM'5)))) ',,t||~~~>>48888j"*W"5"566666r'   c           	      D   |                                  }t          j                            |                                  d          }t          j        t          j                            |d                     t          t          j                            |dd          d          5  	 d d d            n# 1 swxY w Y   t          j        t          j                            |d          t          j                            |d          d           t          j        ||d	           | 	                    t          j        
                    t          j                            |d                               |                     dt          j        t          j                            |d                               t          j                            |                                  d
          }t          j        ||d	           |                     t          j        
                    t          j                            |d                               |                     dt          j        t          j                            |d                               d S )Nr5  real_dirr6  r4   link_to_dirT)target_is_directoryFrL  r  )r   r+   r;   r<   r   r=   r   r   r;  r   rf   r   rd   r   )r   r>  r?  s      r%   test_copytree_symlink_dirz&TestCopyTree.test_copytree_symlink_dir  s   ,,..',,t||~~}==
gz22333"',,w
J??FF 	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	

27<<447<<77'+	- 	- 	- 	- 	59999Wm(L(LMMNNNj"*RW\\'=-Q-Q"R"RSSS',,t||~~~>>48888rw||G]'K'KLLMMMj"*RW\\'=-Q-Q"R"RSSSSSs   (B66B:=B:c                 V   |                                  }|dz   }|                     t          j        |d           t          j                            |d          }t          |d           t          j        ||          }| 	                    dgt	          j
        |                     d S )NdestTr   )r   r   r   r   r+   r;   r<   rC   r;  r   rd   )r   r>  r?  r{   rvs        r%   test_copytree_return_valuez'TestCopyTree.test_copytree_return_value!  s    ,,..F"w555gll7E**3_Wg..%"*R..11111r'   c                    |                                  }|                     t          j        |d           t          j                            |dd          }t          j                            |dd          }t	          j        |           t          j                            |d          }t          |d           t          j	        ||          }| 
                    dgt	          j        |                     d S )NTr   tpg
somevendorz1.0pol)r   r   r   r   r+   r;   r<   makedirsrC   r;  r   rd   )r   base_dirr>  r?  r{   r  s         r%   test_copytree_subdirectoryz'TestCopyTree.test_copytree_subdirectory+  s    <<>>xtDDD',,xd33',,we<<
Ggll7E**3_Wg..%"*R..11111r'   N)r   r   r   rA  rF  r   r+  rZ  rf  rt  rx  r,  mockpatchr|  r  r-  rs   r+   r.  r   r/  r  r  r  r  r  r  rF   r'   r%   r3  r3    s       ( ( (&C C C2 "C C #"C>?4 ?4 ?4B(. (. (.TC C C6 ]$$. . %$.' ' '$ XX..0FGG"X_S\Y.;= =7 7= = #" HG7.) ) ) "7 7 #"74 "T T #"T&2 2 2
2 
2 
2 
2 
2r'   r3  c                   V   e Zd Zej        d             Z ej         ee	d          d          ej        d                         Z
 ej         ee	d          d          ej        d                         Zej        d             Z ej         ee	d          o eed	          o eed
          d          d             Zej        d             Zej        ej        ej        d                                     Zd Zd Zej        d             Z ej         ee	d          d          d             Zej        d             Zej        d             Zd Zd Zd Zd Zej        d             Z ej         ee	d          d          d             Zej        d             Z  ej         ee	d           d!           ej        e!j"        d"k    d#          d$                         Z#d% Z$d& Z% ej        e&pe'pe(d'           ej        e)d(          d)                         Z*d* Z+d+S ),TestCopyc                    |                                  }t          j                            |d          }t          j                            |d          }t          j                            |d          }t          j                            |d          }t	          |d           t	          |d           t          j        ||           t          j        ||           t          j        |t          j        t          j	        z             t          j        |t          j
                   |                     t          j        |          j        t          j        |          j                   t          j        ||           |                     t          j        |          j        t          j        |          j                   t          j        dk    rjt          j        |t          j
                   t          j        ||           |                     t          j        |          j        t          j        |          j                   t          j        |t          j
                   t          j        ||           |                     t          j        |          j        t          j        |          j                   t          j        |t          j
                   t          j        ||           |                     t          j        |          j        t          j        |          j                   d S d S )Nr   barbazquuxrN  )r   r+   r;   r<   rC   r   r   r   rP  S_IRWXGrQ  assertNotEqualr   r   copymoder   rj   r   r  r{   r|   rV  rW  s         r%   test_copymode_follow_symlinksz&TestCopy.test_copymode_follow_symlinks;  sN   ,,..gll7E**gll7E**7<<//7<<0033

3!!!

3!!!
dl4</000
dl###BGCLL0"'#,,2FGGGS!!!-rws||/CDDD7d??HS$,'''OHc***RWS\\1273<<3GHHHHS$,'''OC***RWS\\1273<<3GHHHHS$,'''OHh///RWS\\1273<<3GHHHHH ?r'   rI  zrequires os.lchmodc                    |                                  }t          j                            |d          }t          j                            |d          }t          j                            |d          }t          j                            |d          }t	          |d           t	          |d           t          j        ||           t          j        ||           t          j        |t          j        t          j	        z             t          j        |t          j                   t          j
        |t          j        t          j	        z             t          j
        |t          j                   t          j        ||d           |                     t          j        |          j        t          j        |          j                   |                     t          j        |          j        t          j        |          j                   t          j
        |t          j                   t          j        ||d           |                     t          j        |          j        t          j        |          j                   t          j
        |t          j                   t          j        ||d           |                     t          j        |          j        t          j        |          j                   d S Nr   r  r  r  Ffollow_symlinks)r   r+   r;   r<   rC   r   r   r   rP  r  rI  rQ  r   r  r   r   r   r  r  s         r%    test_copymode_symlink_to_symlinkz)TestCopy.test_copymode_symlink_to_symlink[  s5    ,,..gll7E**gll7E**7<<//7<<0033

3!!!

3!!!
dl4</000
dl###
	(DL5666
	(DL)))(EBBBB(++3(++3	5 	5 	5BGCLL0"'#,,2FGGG
	(DL)))#u====-rws||/CDDD
	(DL)))Xu====-rws||/CDDDDDr'   z requires os.lchmod to be missingc                    |                                  }t          j                            |d          }t          j                            |d          }t          j                            |d          }t          j                            |d          }t	          |d           t	          |d           t          j        ||           t          j        ||           t          j        ||d           d S r  )r   r+   r;   r<   rC   r   r   r  r  s         r%   *test_copymode_symlink_to_symlink_wo_lchmodz3TestCopy.test_copymode_symlink_to_symlink_wo_lchmody  s     ,,..gll7E**gll7E**7<<//7<<0033

3!!!

3!!!(EBBBBBBr'   c                 b   |                                  }t          j                            |d          }t          j                            |d          }t          j                            |d          }t          j                            |d          }t	          |d           t          j        |          }t          j        ||j        |j        dz
  f           t	          |d           | 	                    t          j        |          j        t          j        |          j                   t          j
        ||           t          j
        ||           t          t          d          rt          j        |t
          j                   t          t          d          r4t          t
          d          rt          j        |t
          j                   t          j        |          }t          t          d          rIt#          j        ||d	
           | 	                    |j        t          j        |          j                   t#          j        ||d
           t          j        |          }t          j        t          j        v r:dD ]7}	|                     t-          ||	          t-          ||	          dz              8t          t          d          r |                     |j        |j                   t          t          d          r0t          |d          r |                     |j        |j                   t#          j        ||d
           |                     t5          t          j        |          j        t          j        |          j        z
            dk                d S )Nr   r  r  quxg      E@rI  rJ  rK  Tr  Fst_atimest_mtimer   rT  g?)r   r+   r;   r<   rC   r   utimer  r  r  r   rs   rI  rQ  rJ  rK  r   r   copystatr   r
  assertLessEqualr!   r   rT  r   abs)
r   r  r{   r|   rV  rW  rX  src_link_statdst_link_statattrs
             r%   test_copystat_symlinkszTestCopy.test_copystat_symlinks  s   ,,..gll7E**gll7E**7<<//7<<//373<<
x((4/1 	2 	2 	23BGCLL1273<<3HIII

3!!!

3!!!2x   	.Ih---2z"" 	2wt['A'A 	2K$.111**2x   	MOHhEEEE 5rws||7KLLL(EBBBB**8r222. G G$$W]D%A%A%,]D%A%AA%EG G G G2x   	K]2M4IJJJ2z"" 	Mw}j'I'I 	M]3]5KLLL#u====BGCLL1BGCLL4IIJJ  	! 	! 	! 	! 	!r'   chflags
EOPNOTSUPPENOTSUPz)requires os.chflags, EOPNOTSUPP & ENOTSUPc                 x   |                                  }t          j                            |d          }t          j                            |d          }t	          |d           t	          |d           d }t          j        }	 t          j        t          j        fD ],} ||          t          _        t          j
        ||           - |t          j        t          j        z             t          _        |                     t          t          j
        ||           |t          _        d S # |t          _        w xY w)Nr   file2xxxc                 8     t                      dd fd
}|S )NTr  c                    _         r*   )r"   )r;   flagsr  errexs      r%   _chflags_raiserzlTestCopy.test_copystat_handles_harmless_chflags_errors.<locals>.make_chflags_raiser.<locals>._chflags_raiser  s    r'   r    )r  r  r  s   ` @r%   make_chflags_raiserzSTestCopy.test_copystat_handles_harmless_chflags_errors.<locals>.make_chflags_raiser  s@    B@D         #"r'   )r   r+   r;   r<   rC   r  r"   r  r  r   r  r   r    )r   r   r   r  r  old_chflagsr  s          r%   -test_copystat_handles_harmless_chflags_errorsz6TestCopy.test_copystat_handles_harmless_chflags_errors  s   
 VW--VW--5%   5%   	# 	# 	# j	%'6 . .0055
u----,,U-=-MNNBJgvuEEE$BJJJBJ$$$$s   BD+ +D9c                   	
 |                                  }t          j                            |d          
t	          
d           t          j                            |d          }t	          |d           t          j        
|           t          j        
dd           t          j        
dd           t          j        
|           |                     t          t          j
        
                    t          t          j
        |                               |                     t          j        
d          t          j        |d                     t          j        |           t	          |d           t          t          j        d          		fd}	 t          j        |t          _        t          j        
|           |                     dt          j
        |                     t          _        n# t          _        w xY wd	d

fd
}	 t          j
        |t          _
        t          j        
|           t          _
        n# t          _
        w xY wt          j                            |d          
t          j                            |d          }t	          

           t	          ||           t          j        
dd           t          j        |dd           t          j        |d           t          j                            |d          }t          j                            |d          }t	          ||           t	          ||           t          j        
|           t          j        ||           |                     t          j        |d          d           |                     t          j        |d          d           d S )Nr   r  user.foo   42zuser.bar   43EPERMc                 .    |dk    r | ||fi | d S )Nr  rF   )fnamer  valr$   orig_setxattros_errors       r%   _raise_on_user_fooz3TestCopy.test_copyxattr.<locals>._raise_on_user_foo  s5    z!!eT399&99999r'   Tr  c                ^    | k    rt          t          j        d           | |          S )NzOperation not supportedr  )r    r"   r  )r  r  orig_listxattrr{   s     r%   _raise_on_srcz.TestCopy.test_copyxattr.<locals>._raise_on_src  s4    ||em-FGGG!>%IIIIr'   the_originalthe_original_rozuser.the_values   fiddlyi$  the_copythe_copy_ro)r   r+   r;   r<   rC   r   
_copyxattrsetxattrr   rc   	listxattrgetxattrr   r    r"   r  r   r   r  )r   r  r|   r  r  srcrodstror  r  r  r{   s          @@@@r%   test_copyxattrzTestCopy.test_copyxattr  s   ,,..gll7E**3gll7E**3 	#s###
CU+++
CU+++#s###S 1 122F2<;L;L4M4MNNNC,,C,,	. 	. 	. 		#35;00	: 	: 	: 	: 	: 	:
	(KM,BKc3'''MM*bl3&7&7888'BKK-BK''''48 	J 	J 	J 	J 	J 	J 	J 	J	*\N(BLc3''')BLL>BL)))) gll7N33W&78835%   
C)9555
E+Y777
gll7J//Wm4435%   S!!!u%%%S*:;;YGGGU,<==yIIIIIs   $AH H!-I I)c                 p   |                                  }t          j                            |d          }t          j                            |d          }t	          |d           t          j        ||           t          j        |dd           t          j        |ddd           t          j                            |d          }t          j                            |d	          }t	          |d           t          j        ||           t          j        ||d           | 	                    t          j
        |dd          d           |                     t          t          j
        |d           t          j        ||d           | 	                    t          j
        |d          d           d S )
Nr   r  ztrusted.foor  r  Fr  r  r  )r   r+   r;   r<   rC   r   r  r   r  r   r  r   r    )r   r  r{   rV  r|   rW  s         r%   test_copyxattr_symlinksz TestCopy.test_copyxattr_symlinks  sr    ,,..gll7E**7<<//3

3!!!
C...
HmUEJJJJgll7E**7<<//3

3!!!(HeDDDDX}eTTTV[\\\'2;]CCC(C????S-88%@@@@@r'   c                    d}|                                  }t          ||fd           t          j                            ||          }|                                  } |||           t          j                            ||          }||fS )Nr6  r  )r   rC   r+   r;   r<   )r   methodr  r   r   tmpdir2r  s          r%   
_copy_filezTestCopy._copy_file+  s{    FE?E***VU++,,..ugWe,,u~r'   c                 6   |                      t          j                  \  }}|                     t          j                            |                     |                     t	          j        |          j	        t	          j        |          j	                   d S r*   )
r  r   copyr   r+   r;   r   r   r   r   )r   r   r  s      r%   	test_copyzTestCopy.test_copy5  sk    v{33uu--.../1GHHHHHr'   c                    |                                  }t          j                            |d          }t          j                            |d          }t          j                            |d          }t	          |d           t          j        ||           t          t          d          r,t          j        |t          j	        t          j
        z             t          j        ||d           |                     t          j                            |                     |                     t!          |          t!          |                     t          j        |           t          j        ||d           |                     t          j                            |                     |                     t          j        |          t          j        |                     t          t          d          rF|                     t          j        |          j        t          j        |          j                   d S d S )Nr   r  r  rI  Tr  F)r   r+   r;   r<   rC   r   rs   rI  r   rP  rQ  r   r
  r   rf   r   r`   r   r   rR  r   r   )r   r  r{   r|   rV  s        r%   test_copy_symlinkszTestCopy.test_copy_symlinks;  s   ,,..gll7E**gll7E**7<<//3

3!!!2x   	=Iht| ;<<<Hc48888,,---33888
	#Hc59999s++,,,S))2;x+@+@AAA2x   	4RXh//7Xc]]24 4 4 4 4	4 	4r'   r  zrequires os.utimec                 h   |                      t          j                  \  }}|                     t          j                            |                     t	          j        |          }t	          j        |          }|                     |j	        |j	                   dD ]7}| 
                    t          ||          t          ||          dz              8t          t          d          rDt          |d          r6|                     t          |d          t          |d                     d S d S d S )Nr  r   r  rT  )r  r   copy2r   r+   r;   r   r   r   r   r  r!   rs   )r   r   r  
file1_stat
file2_statr  s         r%   
test_copy2zTestCopy.test_copy2T  s3    v|44uu--...WU^^
WU^^
+Z-?@@@* 	@ 	@D  T!:!:!(T!:!:Q!>@ @ @ @2y!! 	>gj*&E&E 	>WZ<<$Z<<> > > > >	> 	> 	> 	>r'   c                    |                                  }t          j                            |d          }t          j                            |d          }t          j                            |d          }t	          |d           t          j        ||           t          t          d          r,t          j        |t          j	        t          j
        z             t          t          d          r4t          t          d          rt          j        |t          j                   t          j        |          }t          j        |          }t          j        ||d           |                     t          j                            |                     |                     t'          |          t'          |                     t          j        |           t          j        ||d	           |                     t          j                            |                     |                     t          j        |          t          j        |                     t          j        |          }t          j        t          j        v r:d
D ]7}|                     t5          ||          t5          ||          dz              8t          t          d          r@|                     |j        |j                   |                     |j        |j                   t          t          d          r2t          |d          r$|                     |j        |j                   d S d S d S )Nr   r  r  rI  rJ  rK  Tr  Fr  r   rT  )r   r+   r;   r<   rC   r   rs   rI  r   rP  rQ  rJ  rK  r   r   r  r   rf   r   r`   r   r   rR  r  r
  r  r!   r   r  rT  )	r   r  r{   r|   rV  rX  r  rY  r  s	            r%   test_copy2_symlinkszTestCopy.test_copy2_symlinkse  s   ,,..gll7E**gll7E**7<<//3

3!!!2x   	=Iht| ;<<<2z"" 	2wt['A'A 	2K$.11173<<**XsD9999,,---33888
	#XsE::::s++,,,S))2;x+@+@AAA8C==8r222. B B$$W]D%A%A%,Xt%<%<q%@B B B B2x   	D]2H4DEEE 0(2BCCC2z"" 	Hw}j'I'I 	H]3X5FGGGGG	H 	H 	H 	Hr'   c                    |                                  }t          j                            |d          }t          j                            |d          }t	          |d           t          j        |dd           t          j        ||           |                     t          j	        |d          t          j	        |d                     t          j
        |           d S )Nr   r  r  r  )r   r+   r;   r<   rC   r  r   r  r   r  r   )r   r  r{   r|   s       r%   test_copy2_xattrzTestCopy.test_copy2_xattr  s    ,,..gll7E**gll7E**3
CU+++S#C,,C,,	. 	. 	. 		#r'   c                 (   t           j        t           j        fD ]}|                                 }|                                 }t          j                            |d          }t          |d            |||          }|                     |t          j                            |d                      ||t          j                            |d                    }|                     |t          j                            |d                     d S )Nr   r  )	r   r
  r  r   r+   r;   r<   rC   r   )r   r   r>  r?  r{   r  s         r%   test_copy_return_valuezTestCopy.test_copy_return_value  s    ;- 	? 	?BllnnGllnnG',,w..CsE"""C!!BRgu!=!=>>>Cgu5566BRgu!=!=>>>>	? 	?r'   c                 D    |                      t          j                   d S r*   )_test_copy_dirr   r
  r   s    r%   test_copy_dirzTestCopy.test_copy_dir  s    FK(((((r'   c                 D    |                      t          j                   d S r*   )r  r   r  r  s    r%   test_copy2_dirzTestCopy.test_copy2_dir  s    FL)))))r'   c                    |                                  }t          j                            |d          }|                                  }t          j                            |d          }t	          |d           t
          j        dk    rt          }nt          }| 	                    ||||           | 	                    ||||            |||           d S Nr   does_not_exist/win32)
r   r+   r;   r<   rC   r   r/  rz  IsADirectoryErrorr   )r   	copy_funcr>  src_filer   r|   r  s          r%   r  zTestCopy._test_copy_dir  s    ,,..7<<//||~~gll7$5668U###<7""!CC#C#y$888 	#y$444	(D!!!!!r'   c                    |                                  }t          j                            |d          }t          j                            |d          }t          j                            |d          }t          j                            |d          }t	          |d           t          j        ||           t          j        ||d           |                     t          j        	                    |                     | 
                    t          j        |          t          j        |                     t          j        ||           |                     t          j        	                    |                     d S )Nr{   r|   rW  r   r   Fr  )r   r+   r;   r<   rC   r   r   copyfiler   rf   r   rR  r   )r   r  r{   r|   rW  r   s         r%   test_copyfile_symlinkszTestCopy.test_copyfile_symlinks  s    ,,..gll7E**gll7E**7<<44w||GV,,3

3h>>>>x00111T**BK,A,ABBBc""",,-----r'   r   zrequires os.linkc                 r   t          j        t                     t           j                            t          d          }t           j                            t          d          }	 t          |dd          5 }|                    d           d d d            n# 1 swxY w Y   	 t          j        ||           n/# t          $ r"}| 	                    d|z             Y d }~nd }~ww xY w| 
                    t          j        t          j        ||           t          |dd          5 }|                     |                                d           d d d            n# 1 swxY w Y   t          j        |           t          j        t          d	
           d S # t          j        t          d	
           w xY w)Nr$  r%  r5   r6   r7   cheddarzos.link(): %sr^   Tr   )r+   r   r   r;   r<   r=   r>   r   rz  r  r   r   r   r'  r   r_   r   r   )r   r{   r|   rY   r  s        r%   'test_dont_copy_file_onto_link_to_itselfz0TestCopy.test_dont_copy_file_onto_link_to_itself  s    	gll68,,gll66**	6c3111 #Q	"""# # # # # # # # # # # # # # #3S!!!!" 3 3 3o1222222223f2FOS#NNNc3111 6Q  95556 6 6 6 6 6 6 6 6 6 6 6 6 6 6IcNNNM&555555FM&55555s   %F 7BF BF  B!F %B; :F ;
C'C"F "C''AF ()EF E!!F $E!%F F6c                    t          j        t                     t           j                            t          d          }t           j                            t          d          }	 t          |dd          5 }|                    d           d d d            n# 1 swxY w Y   t          j        d|           |                     t          j
        t          j        ||           t          |dd          5 }|                     |                                d           d d d            n# 1 swxY w Y   t          j        |           t          j        t          d	           d S # t          j        t          d	           w xY w)
Nr$  r%  r5   r6   r7   r*  r^   Tr   )r+   r   r   r;   r<   r=   r>   r   r   r   r   r'  r   r_   r   r   )r   r{   r|   rY   s       r%   *test_dont_copy_file_onto_symlink_to_itselfz3TestCopy.test_dont_copy_file_onto_symlink_to_itself  s    	gll68,,gll66**	6c3111 #Q	"""# # # # # # # # # # # # # # #
 Jx%%%f2FOS#NNNc3111 6Q  95556 6 6 6 6 6 6 6 6 6 6 6 6 6 6IcNNNM&555555FM&55555sU   %E( 7BE( BE(  B!AE( 7)D, E( ,D00E( 3D04E( (Fr  r  r  r  c                    	 t          j        t                     n/# t          $ r"}|                     d|z             Y d }~nd }~ww xY w	 |                     t          j        t          j        t          t                     |                     t          j        t          j        t          t                     t          j        t                     d S # t          j        t                     w xY w)Nr  )r+   r  r   rz  r  r   r   SpecialFileErrorr'  r  __file__r   )r   r  s     r%   test_copyfile_named_pipez!TestCopy.test_copyfile_named_pipe  s    	1If 	1 	1 	1MM+a/00000000	1	f5 &B B Bf5 &6C C C IfBIfs!    
AAAA,C C.c                    |                                  }|                                  }t          j                            |d          }t          j                            |d          }t	          |d           t          j        ||          }|                     t          j                            |                     | 	                    t          |          t          |                     d S )Nr  r   )r   r+   r;   r<   rC   r   r'  r   r   r   r`   )r   r>  r?  dst_filer%  r  s         r%   test_copyfile_return_valuez#TestCopy.test_copyfile_return_value  s    ,,..,,..7<<//7<<//8U###_Xx00r**+++8,,i.A.ABBBBBr'   c                 p   |                                  }t          j                            |d          }t	          |d           |                     t          t          j        ||           |                     t          t          j        ||           | 
                    t          |          d           d S r  )r   r+   r;   r<   rC   r   r   r   r'  r   r   r`   )r   r>  r%  s      r%   test_copyfile_same_filez TestCopy.test_copyfile_same_file  s     ,,..7<<//8U###-(HMMM%(HEEE8,,e44444r'   zMOn MACOS, Solaris and Windows the errors are not confusing (though different)zNot valid on AIX, see gh-92670c                    |                                  }t          j                            |d          }t          j                            |d          }t	          |d           |                     t          t          j        ||           d S )Nr   r!  )	r   r+   r;   r<   rC   r   r   r   r'  )r   r>  r%  r|   s       r%   test_copyfile_nonexistent_dirz&TestCopy.test_copyfile_nonexistent_dir  so     ,,..7<<//gll7$5668U###+V_hLLLLLr'   c                     |                                  }t          j                            |d          }|                                  }t          j                            |d          }t	          |d           t
          j        dk    rt          }nt          }| 	                    |t          j        ||           | 	                    |t          j        ||           | 	                    |t          j        ||           d S r   )r   r+   r;   r<   rC   r   r/  rz  r#  r   r   r'  )r   r>  r%  r   r|   r  s         r%   test_copyfile_copy_dirzTestCopy.test_copyfile_copy_dir'  s     ,,..7<<//||~~gll7$5668U###<7""!CC#C#v===#v'BBB#vg>>>>>r'   N),r   r   r   r   r+  r  r,  r-  rs   r+   r  r.  r  r  r"   r  skip_unless_xattrr  skip_unless_dac_overrider  r  r  r  r  r  r  r  r  r  r  r(  r+  r-  r   r/  r1  r4  r6  MACOSSOLARISr   r   r8  r:  rF   r'   r%   r  r  7  s        "I I #"I> XX..0DEE"E E #" FEE8 X_WWR**,NOO"
C 
C #" PO
C "&! &! #"&!P XY// 3 553 	22DF F% %	F F%6  =J =J ! =J~ " 'A A (' !  #"A.  I I I "4 4 #"40 XW--/BCC> > DC>  " H  H #" HD  
 
 ! 

? 
? 
?) ) )* * *" " "$ ". . #".  XV,,.@AA6 6 BA6& "6 6 #"6( XX..0FGGX_S\Y.;= = = = HG	C 	C 	C
5 
5 
5 X_U0g0  3B  C  C X_S:;;M M <;	 C  C
M? ? ? ? ?r'   r  c                      e Zd Z ej                    d             Zd Zd$dZ ej                     ej	         e
j        d          d          d                         Z ej                    d             Z ej                     ej	         e
j        d	          d
          d                         Z ej                     ej	         e
j        d          d          d                         Zd Z ej                    d             Z ej                     ej	        ed          d                         Zd Zd Z ej                    d             Zd Zd Z ej                    d             Zd Zd Zd Zd Z ej                    d             Z ej                    d             Z  ej!                     ej"        e#o
 e$             d          d                          Z% ej                    d!             Z&d" Z'd#S )%TestArchivesc                    |                      d          \  }}|                                 }t          j        |           t          j                            |          }t          j                            t          j                            |          d          }t          j	        |          5  t          5  t          j                            |          }t          |d|d          }d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   |                     ||dz              |                     t          j                            |                     |                     t!          j        |                     t!          j        |d          5 }|                     |                                g d           d d d            n# 1 swxY w Y   t          j	        |          5  t          5  t          |d|d          }d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   |                     ||d	z              |                     t          j                            |                     |                     t!          j        |                     t!          j        |d
          5 }|                     |                                g d           d d d            d S # 1 swxY w Y   d S )Nr   archivegztar..tar.gzzr:gz)rD  z./subz./sub2z./file1z./file2z./sub/file3tar.tarr^   )_create_filesr   r+   r   r;   r:  r<   basenamer   
change_cwdno_chdirabspathr   r   r   r<  tarfile
is_tarfiler=   assertCountEqualgetnames)	r   root_dirr  r  work_dirrel_base_name	base_nametarballtfs	            r%   test_make_tarballzTestArchives.test_make_tarball>  s    "//33(,,..
7??7++RW%5%5g%>%>	JJ!(++ 	J 	JX 	J 	J66I"='8SIIG	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J
 	)i"7888w//000*733444\'6** 	Ib!!"++--#H #H #HI I I	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I !(++ 	H 	HX 	H 	H"=%3GGG	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H)f"4555w//000*733444\'3'' 	H2!!"++--#G #G #GH H H	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	Hs   1D92C7+D7C;	;D>C;	?DDD +GGG6H4>HH4H!	!H4$H!	%H44H8;H8+K>>LLc                     t          j        |          5 }|                                }|                                 t	          |          cd d d            S # 1 swxY w Y   d S r*   )rM  r=   rP  sortr:   )r   r;   rF  rb  s       r%   _tarinfozTestArchives._tarinfob  s    \$ 	 3LLNNEJJLLL<<	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 s   7AA Adistc                    |                                  }t          j                            ||          }t          j        |d           t          |dfd           t          |dfd           t          j        t          j                            |d                     t          |ddfd           t          j        t          j                            |d                     |rt          |d	fd           ||fS )
NT)exist_okr   r  r  rH  file3sub2outer)r   r+   r;   r<   r  rC   r   )r   r  rQ  r[  s       r%   rH  zTestArchives._create_filesh  s    <<>>w||Hh//
D4((((D'?E***D'?E***
dE**+++D%)5111
dF++,,, 	3'*E222!!r'   rF  zNeed the tar command to runc                    |                                  \  }}t          j                            |                                 d          }t
          5  t          |d||          }d d d            n# 1 swxY w Y   |                     ||dz              |                     t          j        	                    |                     t          j                            |d          }ddd|g}t          j        ||t          j                   |                     t          j        	                    |                     |                     |                     |          |                     |                     t
          5  t          |d||          }d d d            n# 1 swxY w Y   |                     ||dz              |                     t          j        	                    |                     t
          5  t          |d||d	
          }d d d            n# 1 swxY w Y   |                     ||dz              |                     t          j        	                    |                     d S )NrB  rC  rE  zarchive2.tarrF  z-cfcwdstdoutrG  Tdry_run)rH  r+   r;   r<   r   rK  r   r   r   r<  r   
check_callDEVNULLrZ  )r   rQ  r  rT  rU  tarball2tar_cmds          r%   test_tarfile_vs_tarz TestArchives.test_tarfile_vs_tarv  s    "//11(GLL;;	 	K 	K"9gxJJG	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	)i"7888w//000 7<<.99%:g8%/%7	9 	9 	9 	9 	x00111w//x1H1HIII  	I 	I"9eXxHHG	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I)f"4555w//000  	1 	1"9eXx+/1 1 1G	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	)f"4555w//00000s6   A00A47A4F!!F%(F%>HH#&H#c                 L   |                                  \  }}|                                 }t          j        |           t          j                            |          }t          j                            t          j                            |          d          }t          j	        |          5  t          5  t          j                            |          }t          |d|          }d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   |                     ||dz              |                     t          j                            |                     |                     t!          j        |                     t!          j        |          5 }|                     |                                g d           d d d            n# 1 swxY w Y   t          j	        |          5  t          5  t          j                            |          }t          |d||          }d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   |                     ||dz              |                     t          j                            |                     |                     t!          j        |                     t!          j        |          5 }|                     |                                g d           d d d            d S # 1 swxY w Y   d S )NrB  zip.zip)dist/	dist/sub/
dist/sub2/
dist/file1
dist/file2dist/sub/file3r`  )ro  rp  rq  rr  rs  rt  )rH  r   r+   r   r;   r:  r<   rI  r   rJ  rK  rL  r   r   r   r<  zipfile
is_zipfileZipFilerO  namelist)	r   rQ  r  r  rR  rS  rT  ri   zfs	            r%   test_make_zipfilezTestArchives.test_make_zipfile  s_    "//11(,,..
7??7++RW%5%5g%>%>	JJ!(++ 	? 	?X 	? 	?66I}eX>>C	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	i&0111s++,,,*3//000_S!! 	R!!"++--    	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 !(++ 	I 	IX 	I 	I66I}eXxHHC	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	i&0111s++,,,*3//000_S!! 	DR!!"++--C C CD D D	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	Ds   0D81C5)D5C9	9D<C9	=DDD+GGG3I;2H9-I9H=	=I H=	III!+LL Lrm  zNeed the zip command to runc                    |                                  \  }}t          j                            |                                 d          }t
          5  t          |d||          }d d d            n# 1 swxY w Y   |                     ||dz              |                     t          j        	                    |                     t          j                            |d          }dddd|g}t          j        ||t          j                   |                     t          j        	                    |                     t          j        |          5 }|                                }d d d            n# 1 swxY w Y   t          j        |          5 }|                                }	d d d            n# 1 swxY w Y   |                     t!          |          t!          |	                     d S )NrB  rm  rn  zarchive2.zipz-qz-rrb  )rH  r+   r;   r<   r   rK  r   r   r   r<  r   rg  rh  ru  rw  rx  rc   )
r   rQ  r  rT  rB  archive2zip_cmdry  rb  names2s
             r%   test_zipfile_vs_zipz TestArchives.test_zipfile_vs_zip  sf    "//11(GLL;;	 	I 	I"9eXxHHG	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	)f"4555w//000 7<<.99$nh?g8%/%7	9 	9 	9 	9 	x00111_W%% 	"KKMME	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	"_X&& 	#"[[]]F	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	#v77777s6   A00A47A4E55E9<E9F55F9<F9unzipzNeed the unzip command to runc                 .   |                                  \  }}t          j                            |                                 d          }t
          5  t          |d||          }d d d            n# 1 swxY w Y   |                     ||dz              |                     t          j        	                    |                     dd|g}t          j        |          5  	 t          j        |t          j                   n{# t          j        $ ri}|j                            d          }d	|v r|                     d
           d}|                     |                    ||                     Y d }~nd }~ww xY wd d d            d S # 1 swxY w Y   d S )NrB  rm  rn  r  z-t)stderrreplace)r   zunrecognized option: tzunzip doesn't support -tz{}

**Unzip Output**
{})rH  r+   r;   r<   r   rK  r   r   r   r<  r   rJ  r   check_outputSTDOUTCalledProcessErroroutputdecoder  r  format)	r   rQ  r  rT  rB  r}  r   detailsmsgs	            r%   test_unzip_zipfilezTestArchives.test_unzip_zipfile  s#    "//11(GLL;;	 	I 	I"9eXxHHG	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	)f"4555w//000 D'*!(++ 	4 	44'
8IJJJJJ0 4 4 4*++9+==+w66MM"<===2		#**S'22333333334	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4sO   A00A47A4F
! DF
E:AE50F
5E::F

FFc                     |                                  }t          j                            |d          }|                     t
          t          |d           d S )NrB  r  )r   r+   r;   r<   r   
ValueErrorr   )r   r   rT  s      r%   test_make_archivezTestArchives.test_make_archive  sD    GLL33	*lIuEEEEEr'   c                 J   t           r5t          j        d          d         }t          j        d          d         }ndx}}|                                 \  }}t          j                            | 	                                d          }t          |d||||          }|                     t          j                            |                     t          |d||          }|                     t          j                            |                     t          |d||||          }|                     t          j                            |                     t          |d||dd          }|                     t          j                            |                     d S )	Nr   r  rB  rm  ownergrouprF  	kjhkjhkjgoihohoh)UID_GID_SUPPORTgrpgetgrgidpwdgetpwuidrH  r+   r;   r<   r   r   r   r<  )r   r  r  rQ  r  rT  ri   s          r%   test_make_archive_owner_groupz*TestArchives.test_make_archive_owner_group  sk     	#LOOA&ELOOA&EE""EE!//11(GLL;;	9eXxu!&( ( (s++,,,9eXx@@s++,,,9eXx!&e5 5 5s++,,,9eXx!,I? ? ?s++,,,,,r'   Requires grp and pwd supportc           
      D   |                                  \  }}t          j                            |                                 d          }t          j        d          d         }t          j        d          d         }t          j
        |          5  t          5  t          |d|d||          }d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   |                     t          j                            |                     t          j        |          }	 |                                D ]8}|                     |j        d           |                     |j        d           9	 |                                 d S # |                                 w xY w)NrB  r   rC  r[  r  )rH  r+   r;   r<   r   r  r  r  r  r   rJ  rK  r   r   r<  rM  r=   
getmembersr   uidgidr  )	r   rQ  r  rT  r  r  archive_namerB  members	            r%   test_tarfile_root_ownerz$TestArchives.test_tarfile_root_owner  s    "//11(GLL;;	Q"Q"!(++ 	B 	BX 	B 	B'	7Hf.35B B BL	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B
 	|44555 ,|,,	!,,.. 0 0  Q///  Q////0 MMOOOOOGMMOOOOsC   CB<0C<C 	 CC 	CCC%AF	 	Fc                    t          j                    }|                                 }d }g fd}t          d|g d           	 t	          j        t           d|          5 	 t          dd|           n# t          $ r Y nw xY wd d d            n# 1 swxY w Y   |                     t          j                    |           |                     ||g           t          d           d S # t          d           w xY w)Nc                      t                      r*   )RuntimeError)r#   kws     r%   _breaksz3TestArchives.test_make_archive_cwd.<locals>._breaks.  s    .. r'   c                 H                         |             |            d S r*   r   )r;   r  
orig_chdirs    r%   _chdirz2TestArchives.test_make_archive_cwd.<locals>._chdir1  s+    KKJtr'   r  xxx filechdir)rQ  )
r+   rv   r   r   r   	swap_attrr   r  r   r   )r   current_dirrQ  r  r  r  r  s        @@r%   test_make_archive_cwdz"TestArchives.test_make_archive_cwd+  so   ikk<<>>	! 	! 	!	 	 	 	 	 	 	 wJ???		-"2w77 : AAAAA    D              
 RY[[+666THk#:;;;%e,,,,,%e,,,,sU   C/ #B%A87B8
BBBBC/ BC/ BAC/ /D c                 r   |                                  }t          j        |          5  t          5  |                     t          dd          d           |                     t          j        	                    d                     d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )NtestrF  ztest.tar
r   r   rJ  rK  r   r   r   r+   r;   r<  r   rQ  s     r%   test_make_tarfile_in_curdirz(TestArchives.test_make_tarfile_in_curdirA  s   <<>>!(++ 	8 	8X 	8 	8\&%88*EEEOOBGNN:66777	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	85   B,ABB,B	B,B	B,,B03B0c                 r   |                                  }t          j        |          5  t          5  |                     t          dd          d           |                     t          j        	                    d                     d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nr  rm  ztest.zipr  r  s     r%   test_make_zipfile_in_curdirz(TestArchives.test_make_zipfile_in_curdirH  s     <<>>!(++ 	8 	8X 	8 	8\&%88*EEEOOBGNN:66777	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8r  c                    |                      t          t          dd           |                      t          t          dd d           |                      t          t          dd ddg           t          dd dgd           d	 t                      D             }|                     d|           t          d           d
 t                      D             }|                     d|           d S )Nr  r   c                      t           S r*   xrF   r'   r%   <lambda>z;TestArchives.test_register_archive_format.<locals>.<lambda>S      Q r'   c                      t           S r*   r  rF   r'   r%   r  z;TestArchives.test_register_archive_format.<locals>.<lambda>U  r  r'   )r   rr   )r   rr   r   c                      t           S r*   r  rF   r'   r%   r  z;TestArchives.test_register_archive_format.<locals>.<lambda>X  s    q r'   r  c                     g | ]\  }}|S rF   rF   rP   rj   paramss      r%   rR   z=TestArchives.test_register_archive_format.<locals>.<listcomp>Y      BBBLD&4BBBr'   c                     g | ]\  }}|S rF   rF   r  s      r%   rR   z=TestArchives.test_register_archive_format.<locals>.<listcomp>]  r  r'   )r   	TypeErrorr   r   r   r   r  )r   formatss     r%   test_register_archive_formatz)TestArchives.test_register_archive_formatP  s    )%<eQGGG)%<eYY	 	 	)%<eYY!9-	/ 	/ 	/ 	 yy6(JGGGBB,?,A,ABBBeW%%%!%(((BB,?,A,ABBB(((((r'   c           	         |                      t          j        t           d           dD ]-}|                     |          5  |                                 }t          j                            |d          }| 	                    t                    5 }t          t          d||           d d d            n# 1 swxY w Y   |                     |j        j        t          j                   |                     |j        j        |           |                     t          j                            t           d                     t'          j        |          \  }}t          j        |           | 	                    t,                    5 }t          t          d||           d d d            n# 1 swxY w Y   |                     |j        j        t          j                   |                     |j        j        |           |                     t          j                            t           d                     d d d            n# 1 swxY w Y   /d S )NrG  FTre  nonexistingrF  r   r   r   rx   r   subTestr   r+   r;   r<   r   r   r   r   r   r"   ENOENTr   r   r   rt   r  r  r   ENOTDIRr   rf  r  nonexisting_filer   tmp_fdtmp_files          r%   test_make_tarfile_rootdir_nodirz,TestArchives.test_make_tarfile_rootdir_nodir`  s   	(V///:::$ 	B 	BGg.. B B,,..#%7<<#G#G &&'899 SR 0@'RRRRS S S S S S S S S S S S S S S  !3U\BBB  !68HIII  6!@!@AAA#+#3#@#@#@    &&'9:: Kb 'JJJJK K K K K K K K K K K K K K K  !3U]CCC  !6AAA  6!@!@AAAB B B B B B B B B B B B B B B	B 	B]   AIB8,I8B<<I?B< CIF2&I2F66I9F6:BII	I	c           	         |                      t          j        t           d           dD ]-}|                     |          5  |                                 }t          j                            |d          }| 	                    t                    5 }t          t          d||           d d d            n# 1 swxY w Y   |                     |j        j        t          j                   |                     |j        j        |           |                     t          j                            t           d                     t'          j        |          \  }}t          j        |           | 	                    t,                    5 }t          t          d||           d d d            n# 1 swxY w Y   |                     |j        j        t          j                   |                     |j        j        |           |                     t          j                            t           d                     d d d            n# 1 swxY w Y   /d S )Nrn  r  re  r  rm  r   r  r  s          r%   test_make_zipfile_rootdir_nodirz,TestArchives.test_make_zipfile_rootdir_nodiru  s    		(V///:::$ 	B 	BGg.. B B,,..#%7<<#G#G &&'899 SR 0@'RRRRS S S S S S S S S S S S S S S  !3U\BBB  !68HIII  6!@!@AAA#+#3#@#@#@    &&'9:: Kb 'JJJJK K K K K K K K K K K K K K K  !3U]CCC  !6AAA  6!@!@AAAB B B B B B B B B B B B B B B	B 	Br  c                      | j         |d fi |  | j         |t          j        fi |  | j         |t          fi | d S )Nc                     | S r*   rF   r;   s    r%   r  z3TestArchives.check_unpack_archive.<locals>.<lambda>  s     r'   )#check_unpack_archive_with_converterrp  rq  r   )r   r  r$   s      r%   check_unpack_archivez!TestArchives.check_unpack_archive  s}    00%%	1 	1)/	1 	1 	100GL	, 	,$*	, 	, 	,00LLVLLLLLr'   c                    |                                  \  }}t          |          }|                    d           t          j                            |                                 d          }t          ||||          }|                                 }	t           ||           ||	          fi | | 	                    t          |	          |           |                                 }
t           ||           ||
          fd|i| | 	                    t          |
          |           | 
                    t          j                  5  t           |t                    fi | d d d            n# 1 swxY w Y   | 
                    t                    5  t           |t                    fddi| d d d            d S # 1 swxY w Y   d S )Nr`  rB  r  r  )rH  rh   r   r+   r;   r<   r   r   r   r   r   r   	ReadErrorr   r  )r   r  	converterr$   rQ  r  expectedrT  r   r  tmpdir3s              r%   r  z0TestArchives.check_unpack_archive_with_converter  sh   !//11(H%%   GLL;;		68XFF ,,..yy**IIg,>,>II&III'**H555 ,,..yy**IIg,>,> 	! 	!v 	!	! 	! 	!'**H555v/00 	8 	899V,,77777	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8z** 	F 	F99V,,EEUEfEEE	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	Fs$   E77E;>E;GGGc                     |                      |d           |                      |d           t          j        |           5  |                      |           d d d            d S # 1 swxY w Y   d S )Nfully_trustedfilterdata)r  r   check_no_warnings)r   r  s     r%   check_unpack_tarballz!TestArchives.check_unpack_tarball  s    !!&!AAA!!&!888.t44 	. 	.%%f---	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.s   A&&A*-A*c                 0    |                      d           d S )NrF  r  r  s    r%   test_unpack_archive_tarz$TestArchives.test_unpack_archive_tar  s    !!%(((((r'   c                 0    |                      d           d S )NrC  r  r  s    r%   test_unpack_archive_gztarz&TestArchives.test_unpack_archive_gztar      !!'*****r'   c                 0    |                      d           d S )Nbztarr  r  s    r%   test_unpack_archive_bztarz&TestArchives.test_unpack_archive_bztar  r  r'   z(AIX MAXDATA must be 0x20000000 or largerc                 0    |                      d           d S )Nxztarr  r  s    r%   test_unpack_archive_xztarz&TestArchives.test_unpack_archive_xztar  s     	!!'*****r'   c                     |                      d           |                     t                    5  |                      dd           d d d            d S # 1 swxY w Y   d S )Nrm  r  r  )r  r   r  r  s    r%   test_unpack_archive_zipz$TestArchives.test_unpack_archive_zip  s    !!%(((y)) 	< 	<%%eF%;;;	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	<s   AAAc                     t                      } fd}t          dddg|dg           t          dd                                t          t          ddg|           t          d           t          ddg|                                ddgd	ft                                                      ddgd	ft                                 t          d                                t                      |           d S )
Nc                                          |d                                | d                                |d           d S )Nr   	stuff.booxx)r   )r   extract_dirextrar   s      r%   _booz/TestArchives.test_unpack_registry.<locals>._boo  sK    UA&&&X{333[$/////r'   Booz.booz.b2)r  r   r  r  Boo2r   )	r   r	   r   r   r
   r   r   r  r   )r   r  r  s   `  r%   test_unpack_registryz!TestArchives.test_unpack_registry  s   $&&	0 	0 	0 	0 	0
 	uvuotl^LLL{D))) 	-)?!(D	* 	* 	* 	!'''vx666vx,.@.B.BCCC%&2.0B0D0DEEE 	!(((+--w77777r'   N)r[  )(r   r   r   r   requires_zlibrW  rZ  rH  r,  r-  r   whichrk  rz  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  requires_bz2r  requires_lzmar.  r   r   r  r  r   rF   r'   r%   r@  r@  :  s        W!H !H !HF     " " " " WXe,,68 81 18 8 1B W"D "D "DH WXe,,68 88 88 8 80 WXg..8: :4 4: : 4,F F F
 W- - -6 WX*HII  JI *- - -,8 8 8 W8 8 8) ) ) B B B* WB B B.M M MF F F0. . .) ) ) W+ + + W+ + + WX_S--/YZZ+ + [Z + W< < <
8 8 8 8 8r'   r@  c                       e Zd Z ej         eed          d          d             Z ej        ed           ej         ee	d          d          d                         Z
dS )	TestMisc
disk_usagez)disk_usage not available on this platformc                 "   t          j        t          j                            t
                              }dD ]+}|                     t          ||          t                     ,| 	                    |j
        d           | 	                    |j        d           |                     |j        d           |                     |j
        |j                   | 	                    |j
        |j                   t          j        t
                     d S )N)rG   usedfreer   )r   r  r+   r;   r:  r0  r   r!   r   assertGreaterrG   r	  assertGreaterEqualr
  )r   usager  s      r%   test_disk_usagezTestMisc.test_disk_usage  s     !"'//(";";<<- 	= 	=D!!'%"6"6<<<<5;***5:q)))
A...UZ8885;
333 	(#####r'   r  chownzrequires os.chownc                                                       }t          j        |          t          d                                t
                    5  t          j                   d d d            n# 1 swxY w Y                        t                    5  t          j        d           d d d            n# 1 swxY w Y                        t                    5  t          j        d           d d d            n# 1 swxY w Y                        t                    5  t          j        d           d d d            n# 1 swxY w Y                        t                    5  t          j        d           d d d            n# 1 swxY w Y   t          j                    }t          j                    }d fd		}t          j        ||            |||           t          j        |            ||           t          j        |            ||           t          j        |            ||
           t          j        |||            ||||           t          j        ||            |||           t          j        ||            |||           t          j        ||            |||
           	 t          j        |          d         }t          j        |          d         }t          j        ||            |||           t          j        |||            ||||           d S # t"          $ r Y d S w xY w)Nr   ztesting chown functionznon-existing username)userznon-existing groupname)r     spamgQ	@c                     t          j                  }|                    ||j                   |                    ||j                   d S d S r*   )r+   r   r   st_uidst_gid)r;   r  r  sr   r   s       r%   check_chownz(TestMisc.test_chown.<locals>.check_chown  sY    !!A  ah///  ah///// r'   )r  r   )NN)r   rt   r   rC   r   r  r   r  LookupErrorr  r+   getuidgetgidr  r  r  r  KeyError)r   r:  r  r  r  r  r  r   s   `      @r%   
test_chownzTestMisc.test_chown  s    ,,..?w///85666z** 	# 	#L"""	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# {++ 	A 	AL(?@@@@	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A {++ 	C 	CL)ABBBB	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C y)) 	, 	,L7+++	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, y)) 	) 	)L4(((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) ikkikk	0 	0 	0 	0 	0 	0 	0 	XsC(((Hc3'''Xs###Hc"""XC((((Hc"""XS))))H#&&&&Wc3'''GS#&&&Wc"""GS!!!W3''''GS!!!WC((((G%%%%
	+<$$Q'DL%%a(E
 L4///K#s+++L$...Kc*****  	 	 	DD	sl   A77A;>A;B??CC$DDD,EEE3FFF 4M 
M*)M*N)r   r   r   r,  r-  rs   r   r  r  r+   r  rF   r'   r%   r  r    s        X66DF F$ $F F$ X*HIIXW--/BCC:+ :+ DC JI:+ :+ :+r'   r  c                   N   e Zd Zd Zd Zd Zd Zd Zej	        d             Z
d Zd Z ej        ej        d	k    d
          d             Zd Zd Zd Zd Zd Zd Z ej        ej        d	k    d          d             Z ej        ej        d	k    d          d             ZdS )	TestWhichc                    |                      d          | _        t          j        | j        dd          | _        t          j        | j        j        t          j	                   | 
                    | j        j                   t
          j                            | j        j                  \  | _        | _        | j        | _        t
          j        | _        d| _        d S )NTmp)r   z.Exerp   r   suffixz.EXE)r   temp_dirrt   ru   	temp_filer+   r   rj   r   S_IXUSRr   r  r;   r   rp   fileenv_pathcurdirextr  s    r%   setUpzTestWhich.setUp5  s    E22 "4<A<BD D D 	$dl333,--- gmmDN,?@@$)ir'   c                     t          j        | j        | j                  }|                     || j        j                   d S Nr  )r   r  r&  rp   r   r$  rj   r   r  s     r%   
test_basiczTestWhich.test_basicC  s;    \$)$(333T^011111r'   c                     t          j        | j        j        | j                  }|                     || j        j                   d S r,  )r   r  r$  rj   r#  r   r-  s     r%   test_absolute_cmdzTestWhich.test_absolute_cmdH  s@     \$.-DMBBBT^011111r'   c                    t           j                            | j                  \  }}t           j                            || j                  }t          j        |          5  t          j	        || j
                  }|                     ||           d d d            n# 1 swxY w Y   t          j        | j                  5  t          j	        ||          }|                     |           d d d            d S # 1 swxY w Y   d S r,  )r+   r;   r   rp   r<   r&  r   rJ  r   r  r#  r   assertIsNone)r   r  tail_dirrelpathr  s        r%   test_relative_cmdzTestWhich.test_relative_cmdN  sn     W]]4844(',,x33!x000 	* 	*gDM:::BR)))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* !tx000 	" 	"gH555Bb!!!	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	"s$   "2B  B$'B$,C>>DDc                    t           j                            | j                  }t	          j        | j                  5  t          j        | j        |          }t          j
        dk    r?|                     |t           j                            | j        | j                             n|                     |           d d d            d S # 1 swxY w Y   d S )Nr  r"  )r+   r;   r:  rp   r   rJ  r   r  r&  r   r/  r   r<   r(  r2  )r   r  r  s      r%   test_cwdzTestWhich.test_cwd[  s    7??48,,!tx000 	& 	&dih777B|w&&  RW\\$+ty%I%IJJJJ !!"%%%	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	&s   B CCCc                 T   t          j        | j        j        t          j                   t          j        | j        j        t           j                  r|                     d           t          j
        | j        | j        t           j                  }|                     |           d S )Nzcan't set the file read-only)r;   rA   )r+   r   r$  rj   r   r   accessW_OKr  r   r  r&  rp   r2  r-  s     r%   test_non_matching_modez TestWhich.test_non_matching_modeg  s     	$dl3339T^("'22 	:MM8999\$)$(AAA"r'   c                 X   t           j                            | j                  \  }}t	          j        |          5  t          j        | j        |          }| 	                    |t           j        
                    || j                             d d d            d S # 1 swxY w Y   d S r,  )r+   r;   r   rp   r   rJ  r   r  r&  r   r<   )r   r  r3  r  s       r%   test_relative_pathzTestWhich.test_relative_pathp  s    W]]4844(!x000 	D 	Ddih777BRh	!B!BCCC	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	Ds   ABB#&B#c                 f    t          j        d| j                  }|                     |           d S )Nzfoo.exer  )r   r  rp   r2  r-  s     r%   test_nonexistent_filezTestWhich.test_nonexistent_filev  s2    \)$(333"r'   r"  zpathext check is Windows-onlyc                     t          j        | j        d d         | j                  }|                     || j        j        d d         | j        z              d S )Nr  )r   r  r&  rp   r   r$  rj   r)  r-  s     r%   test_pathext_checkingzTestWhich.test_pathext_checking{  sU    
 \$)CRC.tx888T^0"5@AAAAAr'   c                     t          j                    5 }| j        |d<   t          j        | j                  }|                     || j        j                   d d d            d S # 1 swxY w Y   d S NPATH)	r   EnvironmentVarGuardr'  r   r  r&  r   r$  rj   r   envr  s      r%   test_environ_pathzTestWhich.test_environ_path  s    *,, 	6-CKdi((BR!4555	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6s   AA%%A),A)c           	         t          j                    5 }d|d<   t          j                            d| j        d          5  t          j        t          d| j                  5  t          j	        | j                  5  t          j        | j                  }|                     |           d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nr   rE  
os.confstrTreturn_valuecreatedefpath)r   rF  r,  r  r  rp   r   r  r+   rJ  r   r  r&  r2  rG  s      r%   test_environ_path_emptyz!TestWhich.test_environ_path_empty  s   *,, 	&CK$$\,0 % 2 2 & &"2y$(;;& & %dh//& & \$),,!!"%%%& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & &	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	&s}   -C=!C%"C</B7	+C7B;;C>B;?CC%CC%CC%C=%C)	)C=,C)	-C==DDc           	         t           j                            | j        j                  }t
          j        dk    rUt           j        }t          |t                    rt          j
        |          }t           j                            ||          }t          j                    5 }t           j        |d<   t          j                            d| j        d          5  t'          j        t           d| j                  5  t+          j        | j                  }|                     |           t          j        | j                  5  t+          j        | j                  }|                     ||           d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nr"  rE  rK  TrL  rO  )r+   r;   rI  r$  rj   r   r/  r(  r9   r   r   r<   r   rF  pathsepr,  r  r  rp   r   r  r   r  r&  r2  rJ  r   )r   expected_cwdr(  rH  r  s        r%   test_environ_path_cwdzTestWhich.test_environ_path_cwd  s   w''(;<<<7""YF,.. -V,,7<<==L *,, 	7*CK$$\,0 % 2 2 	7 	7"2y$(;;	7 	7 \$),,!!"%%% )$(33 7 7di00B$$R6667 7 7 7 7 7 7 7 7 7 7 7 7 7 7	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7s   "7G!F,:AF0E>	2F>FFFF	F,FF,FF, G,F0	0G3F0	4GGGc                 @   t          j                    5 }|                    dd            t          j                            dt          d          5  t          j        t          d| j
                  5  t          j        | j                  }d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   |                     || j        j                   t          j                            d| j
        d          5  t          j        t          dd          5  t          j        | j                  }d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   |                     || j        j                   d d d            d S # 1 swxY w Y   d S )NrE  rK  T)r   rN  rO  rL  r   )r   rF  popr,  r  r  r  r   r  r+   rp   r   r  r&  r   r$  rj   rG  s      r%   test_environ_path_missingz#TestWhich.test_environ_path_missing  s   *,, 	6GGFD!!! $$\z,0 % 2 2 - -"2y$(;;- - \$),,- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - R!4555 $$\,0 % 2 2 - -"2y"55- - \$),,- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - R!4555	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6s   >F!B03BB0BB0 B!B0$F0B4	4F7B4	8A
FEE8EEEEEFE	F"E	##FFFc                 ~   t           j                            | j                  }t	          j        | j                  5  t	          j                    5 }| j        |d<   t          j	        | j
        d          }|                     |           d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nr  rE  r   )r+   r;   r:  rp   r   rJ  rF  r'  r   r  r&  r2  )r   r  rH  r  s       r%   test_empty_pathzTestWhich.test_empty_path  s(   7??48,,!tx000 	" 	"*,,	"03-CKdib111Bb!!!		" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	"s5   B2;BB2B	B2!B	"B22B69B6c                     t          j                    5 }|                    dd            t          j        | j                  }|                     |           d d d            d S # 1 swxY w Y   d S rD  )r   rF  rV  r   r  r&  r2  rG  s      r%   test_empty_path_no_PATHz!TestWhich.test_empty_path_no_PATH  s    *,, 	"GGFD!!!di((Bb!!!	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	"s   AA&&A*-A*ztest specific to Windowsc                    d}t          j        | j        d|          }t          j        |j        t          j                   |                     |j	                   t          j
                            |j                  }t          j
                            |          d         }t          j                    5 }||d<   t          j        || j                  }|                     ||j                   d d d            d S # 1 swxY w Y   d S )N.xyzTmp2r!  r   PATHEXTr  )rt   ru   r#  r+   r   rj   r   r%  r   r  r;   rI  ra  r   rF  r   r  r   r   r)  temp_filexyzprogramrH  r  s         r%   test_pathextzTestWhich.test_pathext  s2   2t}:@N N N
"DL111*+++ '""<#455'""7++A.*,, 	4 C	NgDM:::BR!2333	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4s   9<DD	Dc                    d}t          j        | j        d|          }|                     |j                   t
          j                            |j                  }t
          j        	                    |          d         }t          j                    5 }| d|d<   t          j        || j                  }|                     ||j                   d d d            d S # 1 swxY w Y   d S )Nr]  r^  r!  r   ;r_  r  )rt   ru   r#  r   r  r+   r;   rI  rj   ra  r   rF  r   r  r   r`  s         r%   test_pathext_with_empty_strz%TestWhich.test_pathext_with_empty_str  s!   2t}:@N N N*+++ '""<#455'""7++A.*,, 	4 #YYYC	NgDM:::BR!2333	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4s   ?C!!C%(C%N)r   r   r   r*  r.  r0  r5  r7  r   r0  r;  r=  r?  r,  r-  r   r/  rB  rI  rP  rT  rW  rY  r[  rc  rf  rF   r'   r%   r  r  3  s         2 2 2
2 2 2" " "
& 
& 
& #  $#D D D  
 X08: :B B: :B6 6 6	& 	& 	&7 7 7,6 6 6$" " "" " " X02LMM4 4 NM4" X02LMM4 4 NM4 4 4r'   r  c                       e Zd Zd ZdS )TestWhichBytesc                 z   t                               |            t          j        | j                  | _        t          j        | j                  | _        t          j        | j        j                  | j        _        t          j        | j                  | _        t          j        | j	                  | _	        d S r*   )
r  r*  r+   r   rp   r&  r$  rj   r(  r)  r  s    r%   r*  zTestWhichBytes.setUp  s}    ;tx((K	**	 k$.*=>>k$+..;tx((r'   N)r   r   r   r*  rF   r'   r%   rh  rh    s#        ) ) ) ) )r'   rh  c                      e Zd Zd Zd Zd Zd Zd Zd Zd Z	e
d             Ze
d	             Zd
 Ze
d             Zd Ze
d             Zd Z ej        ej        j        d          d             Zd Zd Zd Zd Zej        e
d                         Zej        e
d                         Zej        e
d                         Z ej        e
d                         Z!d Z"d Z#e
d             Z$e
d             Z%d Z&ej'         ej         e(ed          o e(e)d          o e(e)d           d!          d"                         Z*d#S )$TestMovec                    d}|                                  | _        |                                  | _        t          j                            | j        |          | _        t          j                            | j        |          | _        t          | j        d          5 }|	                    d           d d d            d S # 1 swxY w Y   d S )Nr   r4   r  )
r   r>  r?  r+   r;   r<   r%  r3  r=   r>   )r   r   rY   s      r%   r*  zTestMove.setUp  s    ||~~||~~T\8<<T\8<<$-&& 	!GGG	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   CCCc                    t          |d          5 }|                                }d d d            n# 1 swxY w Y   t          j        ||           t          |d          5 }|                     ||                                           d d d            n# 1 swxY w Y   |                     t          j                            |                     d S Nr]   )	r=   r_   r   mover   r   r+   r;   r   )r   r{   r|   real_dstrY   contentss         r%   _check_move_filezTestMove._check_move_file  s)   #t__ 	 vvxxH	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 C(D!! 	1QXqvvxx000	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1,,-----s   266")BBBc                 @   t          t          j        |                    }t          j        ||           |                     |t          t          j        |                               |                     t          j                            |                     d S r*   )	rc   r+   rd   r   ro  r   r   r;   r   )r   r{   r|   rp  rq  s        r%   _check_move_dirzTestMove._check_move_dir
  sy    "*S//**C6"*X*>*>#?#?@@@,,-----r'   c                 R    |                      | j        | j        | j                   d S r*   )rr  r%  r3  r  s    r%   test_move_filezTestMove.test_move_file  s&    dmT]DMJJJJJr'   c                 R    |                      | j        | j        | j                   d S r*   )rr  r%  r?  r3  r  s    r%   test_move_file_to_dirzTestMove.test_move_file_to_dir  s&    dmT\4=IIIIIr'   c                 z    t          j        | j                  }|                     || j        | j                   d S r*   )rp  rq  r%  rr  r?  r3  )r   r{   s     r%   "test_move_file_to_dir_pathlike_srcz+TestMove.test_move_file_to_dir_pathlike_src  s5    l4=))c4<?????r'   c                 z    t          j        | j                  }|                     | j        || j                   d S r*   )rp  rq  r?  rr  r%  r3  r   r|   s     r%   "test_move_file_to_dir_pathlike_dstz+TestMove.test_move_file_to_dir_pathlike_dst  s5    l4<((dmS$-@@@@@r'   c                 .    |                                   d S r*   )rv  r  s    r%   test_move_file_other_fsz TestMove.test_move_file_other_fs"  s     	r'   c                 .    |                                   d S r*   )rx  r  s    r%   test_move_file_to_dir_other_fsz'TestMove.test_move_file_to_dir_other_fs'  s     	""$$$$$r'   c                     t          j        |                                           }	 |                     | j        ||           t          j        |           d S # t          j        |           w xY wr  )rt   r   r   rt  r>  r   r   r   r?  s     r%   test_move_dirzTestMove.test_move_dir,  si    /dllnn555	&  w@@@W%%%%%IW%%%%s   A A1c                 .    |                                   d S r*   )r  r  s    r%   test_move_dir_other_fszTestMove.test_move_dir_other_fs4  s     	r'   c           
          |                      | j        | j        t          j                            | j        t          j                            | j                                       d S r*   )rt  r>  r?  r+   r;   r<   rI  r  s    r%   test_move_dir_to_dirzTestMove.test_move_dir_to_dir9  sX    T\4<GLLrw'7'7'E'EFF	H 	H 	H 	H 	Hr'   c                 .    |                                   d S r*   )r  r  s    r%   test_move_dir_to_dir_other_fsz&TestMove.test_move_dir_to_dir_other_fs>  s     	!!#####r'   c           
          |                      | j        t          j        j        z   | j        t          j                            | j        t          j                            | j                                       d S r*   )rt  r>  r+   r;   sepr?  r<   rI  r  s    r%   test_move_dir_sep_to_dirz!TestMove.test_move_dir_sep_to_dirC  sa    T\BGK7GLLrw'7'7'E'EFF	H 	H 	H 	H 	Hr'   zrequires os.path.altsepc           
          |                      | j        t          j        j        z   | j        t          j                            | j        t          j                            | j                                       d S r*   )rt  r>  r+   r;   altsepr?  r<   rI  r  s    r%   test_move_dir_altsep_to_dirz$TestMove.test_move_dir_altsep_to_dirG  sa    T\BGN:DLGLLrw'7'7'E'EFF	H 	H 	H 	H 	Hr'   c                     t          | j        d          5  	 d d d            n# 1 swxY w Y   |                     t          j        t          j        | j        | j                   d S )Nr4   )r=   r3  r   r   r   ro  r%  r?  r  s    r%   "test_existing_file_inside_dest_dirz+TestMove.test_existing_file_inside_dest_dirL  s    $-&& 	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	&,T]DLQQQQQs   $((c                     t           j                            | j        d          }|                     t
          j        t
          j        | j        |           d S Nr  )r+   r;   r<   r>  r   r   r   ro  r|  s     r%   test_dont_move_dir_in_itselfz%TestMove.test_dont_move_dir_in_itselfR  s?    gll4<//&,T\3GGGGGr'   c           	         t          j        t                     	 dD ]\  }}t           j                            t          |          }t           j                            t          |          }|                     t          j        ||          d|d|d           	 t          j	        t                     d S # t          j	        t                     w xY w)N))srcdirzsrcdir/dest)_destinsrc() wrongly concluded that dst (z) is not in src ()r  )
r+   r   r   r;   r<   r   r   
_destinsrcr   r   r&  s      r%   test_destinsrc_false_negativez&TestMove.test_destinsrc_false_negativeW  s    
	%7 I ISgll63//gll63// 1#s ; ; ;>Acc333"H   I I I II V$$$$$IV$$$$   BB: :Cc           	         t          j        t                     	 dD ]\  }}t           j                            t          |          }t           j                            t          |          }|                     t          j        ||          d|d|d           	 t          j	        t                     d S # t          j	        t                     w xY w)N))r  zsrc/dest)r  z
srcdir.newr  z) is in src (r  r  )
r+   r   r   r;   r<   r   r   r  r   r   r&  s      r%   test_destinsrc_false_positivez&TestMove.test_destinsrc_false_positivec  s    
	%N D DSgll63//gll63//  !23!<!<!<9<ccc!C ! D D D DD V$$$$$IV$$$$r  c                    t           j                            | j        d          }t          j        | j        |           t          j        || j                   | 	                    t           j        
                    | j                             | 	                    t           j                            | j        | j                             d S r  )r+   r;   r<   r>  r   r%  r   ro  r3  r   rf   samefiler|  s     r%   test_move_file_symlinkzTestMove.test_move_file_symlinko  s     gll4<//

4=#&&&C'''t}55666((FFGGGGGr'   c                    d}t           j                            | j        |          }t          j        | j        |           t          j        || j                   t           j                            | j        |          }| 	                    t           j        
                    |                     | 	                    t           j                            | j        |                     d S r  )r+   r;   r<   r>  r   r%  r   ro  r?  r   rf   r  )r   r   r|   
final_links       r%   test_move_file_symlink_to_dirz&TestMove.test_move_file_symlink_to_dirx  s     gll4<22

4=#&&&C&&&W\\$,99
z22333((
CCDDDDDr'   c                 <   t           j                            | j        d          }t           j                            | j        d          }t          j        ||           t           j                            | j        d          }t          j        ||           |                     t           j        	                    |                     | 
                    t           j                            |          t           j                            |                     d S Nr  r  r  )r+   r;   r<   r>  r   r?  r   ro  r   rf   r   realpathr   r{   r|   rW  s       r%   test_move_dangling_symlinkz#TestMove.test_move_dangling_symlink  s     gll4<//gll4<//

37<<f55C"""x00111))#..0@0@0J0JKKKKKr'   c                 *   t           j                            | j        d          }t           j                            | j        d          }t          j        |           t          j        ||           t           j                            | j        d          }t          j        ||           | 	                    t           j        
                    |                     | 	                    t           j                            ||                     d S r  )r+   r;   r<   r>  r   r   r?  r   ro  r   rf   r  r  s       r%   test_move_dir_symlinkzTestMove.test_move_dir_symlink  s     gll4<//gll4<//


37<<f55C"""x00111((h7788888r'   c           	          t          j        | j        | j                  }|                     |t
          j                            | j        t
          j                            | j                                       d S r*   )	r   ro  r%  r?  r   r+   r;   r<   rI  r-  s     r%   test_move_return_valuezTestMove.test_move_return_value  sg    [55T\27+;+;DM+J+JKK	M 	M 	M 	M 	Mr'   c                     t          j        | j        t          j                            | j        d                    }|                     |t          j                            | j        d                     d S r  )r   ro  r%  r+   r;   r<   r?  r   r-  s     r%    test_move_as_rename_return_valuez)TestMove.test_move_as_rename_return_value  sU    [T\5(I(IJJRW\\$,>>?????r'   c                     g fd}t          j        | j        | j        |           |                     t                    d           d S )Nc                 6                         | |f           d S r*   r   r{   r|   moveds     r%   r  z7TestMove.test_move_file_special_function.<locals>._copy      LL#s$$$$$r'   r  r   )r   ro  r%  r?  r   r   r   r  r  s     @r%   test_move_file_special_functionz(TestMove.test_move_file_special_function  s^    	% 	% 	% 	% 	%DM4<uEEEEUQ'''''r'   c                 z   g fd}t          j        t          j                            | j        d                     t          j        t          j                            | j        d                     t          j        | j        | j        |           | 	                    t                    d           d S )Nc                 6                         | |f           d S r*   r   r  s     r%   r  z6TestMove.test_move_dir_special_function.<locals>._copy  r  r'   childchild1r  r   )r   r   r+   r;   r<   r>  r   ro  r?  r   r   r  s     @r%   test_move_dir_special_functionz'TestMove.test_move_dir_special_function  s    	% 	% 	% 	% 	%#BGLLw$G$GHHH#BGLLx$H$HIIIDL$,eDDDDUQ'''''r'   c                 N   |                                  | _        t          j                            t          j                            | j                  t          j                            | j                                                            }|                     | j        |           	 t          j
        | j        |           |                     t          j                            |                     t          j        |           d S # t          j        |           w xY wr*   )r   r>  r+   r;   r<   r:  rI  upperr  r   ro  r   re   r   r  s     r%   test_move_dir_caseinsensitivez&TestMove.test_move_dir_caseinsensitive  s     ||~~',,--  ..44668 8 	DL'222	Kg...OOBGMM'22333HWBHWs   ,AD D$rJ  SF_IMMUTABLE	UF_OPAQUEzrequires lchflagsc                    	 t          j        t                     t          j        t          t          j                   |                     t          t          j	        t          t                     |                     t          t          j                    v            t          j        t          t          j                   t          j        t           j                            t          d                     t          j        t          t          j                   |                     t          t          j	        t          t                     |                     t          t          j                    v            t           j                            t                    r=t          j        t          t          j                   t          j        t                     t           j                            t                    r?t          j        t          t          j                   t          j        t                     d S d S # t           j                            t                    r=t          j        t          t          j                   t          j        t                     t           j                            t                    r>t          j        t          t          j                   t          j        t                     w w xY w)Nr  )r+   r   
TESTFN_SRCrJ  r   r  r   rz  r   ro  
TESTFN_DSTr   rd   r  r   r   r;   r<   r   r   r  s    r%   test_move_dir_permission_deniedz(TestMove.test_move_dir_permission_denied  s   	-HZ   K
D$5666 ov{J
SSSZ2:<<7888 K
DN333'Z(I(IJJJK
D$5666 ov{J
SSSZ2:<<7888w~~j)) -J777 ,,,w~~j)) -J777 ,,,,,- - w~~j)) -J777 ,,,w~~j)) -J777 ,,,,-s   E8I   CLN)+r   r   r   r*  rr  rt  rv  rx  rz  r}  r2   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<  rs   r   r  rF   r'   r%   rk  rk    s(         . . .. . .K K KJ J J@ @ @
A A A
   [ % % [%& & &   [H H H
 $ $ [$H H H X)BCCH H DCHR R RH H H

% 
% 
%
% 
% 
% "H H [ #"H "E E [ #"E "L L [ #"L "9 9 [ #"9M M M
@ @ @ ( ( [( ( ( [(  " 'XZ00 8$WT>::8$WT;77,. .- -	. . ('
- - -r'   rk  c                       e Zd Z G d de          Zd Z ej        ed          d             Z	 ej        ed          d             Z
 ej        ed          d             ZdS )	TestCopyFilec                   4    e Zd ZdZdZdZddZd Zd Zd Z	dS )	TestCopyFile.FauxFNTc                 "    || _         || _        d S r*   )_raise_in_exit_suppress_at_exit)r   raise_in_exitsuppress_at_exits      r%   __init__zTestCopyFile.Faux.__init__  s    "/D%5D"""r'   c                     dS )Nr   rF   )r   r#   s     r%   r_   zTestCopyFile.Faux.read  s    2r'   c                     d| _         d S )NT)_enteredr  s    r%   	__enter__zTestCopyFile.Faux.__enter__  s     DMMMr'   c                 ^    |||f| _         | j        rd| _        t          d          | j        S )NTCannot close)_exited_withr  _raisedr    r  )r   exc_typeexc_valexc_tbs       r%   __exit__zTestCopyFile.Faux.__exit__  s:     ('6 9D" .#n---))r'   r  )
r   r   r   r  r  r  r  r_   r  r  rF   r'   r%   Fauxr    sd        	6 	6 	6 	6	 	 		! 	! 	!	* 	* 	* 	* 	*r'   r  c                    dd}t          j        t          d|          5  |                     t                    5  t          j        dd           d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nr^   c                 0    | dk    rt          d          J )NsrcfilezCannot open "srcfile"r  )r   rA   s     r%   _openz4TestCopyFile.test_w_source_open_fails.<locals>._open  s!    9$$5666Hr'   r=   r  destfiler^   )r   r  r   r   r    r'  )r   r  s     r%   test_w_source_open_failsz%TestCopyFile.test_w_source_open_fails  s   	 	 	 	
 vvu55 	7 	7""7++ 7 7	:6667 7 7 7 7 7 7 7 7 7 7 7 7 7 7	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7s4   A5AA5A!	!A5$A!	%A55A9<A9zskipped on macOSc                    |                                  d	fd	}t          j        t          d|          5  t          j        dd           d d d            n# 1 swxY w Y   |                     j                   |                     j        d         t          u            | 	                    j        d         j
        d           d S )
Nr^   c                 B    | dk    rS | dk    rt          d          J )Nr  r  Cannot open "destfile"r  )r   rA   r  s     r%   r  z2TestCopyFile.test_w_dest_open_fails.<locals>._open	  s2    9$$:%%6777Hr'   r=   r  r  r   r   )r  r  )r  r   r  r   r'  r   r  r  r    r   r#   )r   r  r  s     @r%   test_w_dest_open_failsz#TestCopyFile.test_w_dest_open_fails	  s   ))++	 	 	 	 	 	 vvu55 	3 	3OIz222	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3())),Q/7:;;;-a054	6 	6 	6 	6 	6s   AA Ac                 0   |                                  |                      d          d
fd	}t          j        t          d|          5  t          j        dd           d d d            n# 1 swxY w Y   |                     j                   |                     j                   |                     j                   |                     j        d         t          u            | 
                    j        d         j        d	           d S )NTr^   c                 (    | dk    rS | dk    rS J Nr  r  rF   r   rA   r  r  s     r%   r  z3TestCopyFile.test_w_dest_close_fails.<locals>._open	  (    9$$:%%Hr'   r=   r  r  r   r   )r  r  )r  r   r  r   r'  r   r  r  r  r    r   r#   r   r  r  r  s     @@r%   test_w_dest_close_failsz$TestCopyFile.test_w_dest_close_fails	  sQ   ))++99T??	 	 	 	 	 	 	 vvu55 	3 	3OIz222	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3())))***())),Q/7:;;;-a05*	, 	, 	, 	, 	,s   A00A47A4c                 r   |                      d          |                                  dfd	}t          j        t          d|          5  |                     t
                    5  t          j        dd           d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   |                     j                   |                     j                   | 	                    j
                   |                     j        d         d u            |                     j
                   d S )	NTr^   c                 (    | dk    rS | dk    rS J r  rF   r  s     r%   r  z5TestCopyFile.test_w_source_close_fails.<locals>._open4	  r  r'   r=   r  r  r   r  )r  r   r  r   r   r    r'  r   r  r   r  r  r  s     @@r%   test_w_source_close_failsz&TestCopyFile.test_w_source_close_fails.	  s    ))D//99;;	 	 	 	 	 	 	 vvu55 	7 	7""7++ 7 7	:6667 7 7 7 7 7 7 7 7 7 7 7 7 7 7	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	())))***)***,Q/47888(((((s6   B")B?B"B	B"B	B""B&)B&N)r   r   r   objectr  r  r,  r.  r=  r  r  r  rF   r'   r%   r  r    s        * * * * *v * * *$7 7 7 X_U.//6 6 0/6" X_U.//, , 0/,( X_U.//) ) 0/) ) )r'   r  c                       e Zd ZdZed             Zed             Zd Zej	        d             Z
d Zd Zd Zd	 Z ej        ej        d
k    d          d             ZdS )TestCopyFileObji    c                 :    t          t          | j                   d S r*   )r[   r   FILESIZEclss    r%   
setUpClasszTestCopyFileObj.setUpClassH	  s    -----r'   c                 j    t          j        t                     t          j        t                     d S r*   )r   rx   r   r  r  s    r%   tearDownClasszTestCopyFileObj.tearDownClassL	  s*       !!!!!r'   c                 8    t          j        t                     d S r*   r   rx   r  r  s    r%   tearDownzTestCopyFileObj.tearDownQ	      !!!!!r'   c              #      K   t          t          d          5 }t          t          d          5 }||fV  d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S Nr]   r4   r=   r   r  r&  s      r%   	get_fileszTestCopyFileObj.get_filesT	        &$ 	!3gt$$ !Cj   ! ! ! ! ! ! ! ! ! ! ! ! ! ! !	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	!3   AAAA	AA		AA Ac                    t          |d          5 }t          |d          5 }|                     |                                |                                           d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S rn  )r=   r   r_   )r   r{   r|   fsrcfdsts        r%   assert_files_eqzTestCopyFileObj.assert_files_eqZ	  s    #t__ 	;c4 ;D  diikk:::; ; ; ; ; ; ; ; ; ; ; ; ; ; ;	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	;s4   B;A)B)A-	-B0A-	1BBBc                     |                                  5 \  }}t          j        ||           d d d            n# 1 swxY w Y   |                     t          t
                     d S r*   )r  r   copyfileobjr	  r   r  r&  s      r%   test_contentzTestCopyFileObj.test_content_	  s    ^^ 	)#ssC(((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)VW-----s   :>>c                     |                                  5 \  }}t          j        ||           |j        rJ |j        rJ 	 d d d            d S # 1 swxY w Y   d S r*   )r  r   r  closedr&  s      r%   test_file_not_closedz$TestCopyFileObj.test_file_not_closedd	  s    ^^ 	"#ssC(((z!!!z!!!!	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	"s   +AAAc                 D   |                                  5 \  }}t          j        ||           |                     |                                | j                   |                     |                                | j                   d d d            d S # 1 swxY w Y   d S r*   )r  r   r  r   tellr  r&  s      r%   test_file_offsetz TestCopyFileObj.test_file_offsetj	  s    ^^ 	8#ssC(((SXXZZ777SXXZZ777	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8s   A3BBBrN  zWindows onlyc                    t           j                            d          5 }t          j        t
          t                     d d d            n# 1 swxY w Y   |j        sJ |                     |j	        d         d         d           t          j        t          j                    d          5 }|                    d           d d d            n# 1 swxY w Y   |j        }|                     t"          j        |           t           j                            d          5 }t          j        |t                     d d d            n# 1 swxY w Y   |                     |j	        d         d         d           t          j        t          j                    d          5 }	 d d d            n# 1 swxY w Y   |j        }|                     t"          j        |           t           j                            d          5 }t          j        |t                     d d d            n# 1 swxY w Y   |j        rJ |                     |t                     d S )	Nzshutil._copyfileobj_readintor   rr   i   Fro   s   foor   )r,  r  r  r   r'  r   r  calledr   	call_argsrt   ru   r+   rv   r>   rj   r   r   rx   r	  )r   mrY   r  s       r%   test_win_implzTestCopyFileObj.test_win_implp	  s    ]  !?@@ 	-AOFG,,,	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	-x 	Q*O<<< (RY[[GGG 	1GGFOOO	 	 	 	 	 	 	 	 	 	 	 	 	 	 		(%000]  !?@@ 	,AOE7+++	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	,Q*A... (RY[[GGG 	1	 	 	 	 	 	 	 	 	 	 	 	 	 	 		(%000]  !?@@ 	,AOE7+++	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	,8UG,,,,,sY    AAA.CCC!EEE!F//F36F3 H''H+.H+N)r   r   r   r  classmethodr  r  r  
contextlibcontextmanagerr  r	  r  r  r  r,  r.  r+   rj   r  rF   r'   r%   r  r  E	  s        H. . [. " " ["" " " ! ! !
; ; ;
. . .
" " "8 8 8 X_RW_n55- - 65- - -r'   r  c                       e Zd ZdZdZdZdZed             Zed             Z	d Z
ej        d             Zd	 Zd
 Zd Zd Zd Zd Zd Zd Zd ZdS )_ZeroCopyFileTestz#Tests common to all zero-copy APIs.i   r'   r   c                    t          t          | j                   t          t          d          5 }|                                | _        t          | j                  | j        k    sJ 	 d d d            d S # 1 swxY w Y   d S rn  )r[   r   r  r=   r_   FILEDATAr   )r  rY   s     r%   r  z_ZeroCopyFileTest.setUpClass	  s    ---&$ 	516688CLs|$$44444	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5s   9A77A;>A;c                 8    t          j        t                     d S r*   )r   rx   r   r  s    r%   r  z_ZeroCopyFileTest.tearDownClass	  s         r'   c                 8    t          j        t                     d S r*   r  r  s    r%   r  z_ZeroCopyFileTest.tearDown	  r  r'   c              #      K   t          t          d          5 }t          t          d          5 }||fV  d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S r  r  r&  s      r%   r  z_ZeroCopyFileTest.get_files	  r  r  c                      t          d          )Nzmust be implemented in subclass)r  )r   r#   r$   s      r%   zerocopy_funz_ZeroCopyFileTest.zerocopy_fun	  s    !"CDDDr'   c                     |                                   |                                  |                                  |                                  d S r*   )r  r  r  r*  r  s    r%   resetz_ZeroCopyFileTest.reset	  sB    

r'   c                    |                                  5 \  }}|                     ||           d d d            n# 1 swxY w Y   |                     t          t          d          | j                   |                                  5 \  }}t          j                            d          5 }t          j
        t          t                     d d d            n# 1 swxY w Y   |j        rJ 	 d d d            d S # 1 swxY w Y   d S )NTr@   zshutil.copyfileobj)r  r#  r   r`   r  r  r,  r  r  r   r'  r   r  )r   r{   r|   r  s       r%   test_regular_copyz#_ZeroCopyFileTest.test_regular_copy	  s   ^^ 	(#sc3'''	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(74888$-HHH^^ 	 #s$$%9:: 1a0001 1 1 1 1 1 1 1 1 1 1 1 1 1 1x	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 sC   ;??	#C:, CC:C	C:C	 C::C>C>c                    |                      | j                   |                                 5 \  }}|                     t          t
          f          5  |                     ||           d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   |                     t          t          d          | j
                   d S )NTr'  )r   r%  r  r   r    r   r#  r   r`   r   r  r&  s      r%   test_same_filez _ZeroCopyFileTest.test_same_file	  s.   
###^^ 	,#s""G->#?@@ , ,!!#s+++, , , , , , , , , , , , , , ,	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	6$777GGGGGs5   %BA7+B7A;	;B>A;	?BBBc                     t          j        t          j                              }|                     t
                    5 }t          j        |d           d d d            n# 1 swxY w Y   |                     |j	        j
        |           d S )Nr   new)rt   r   r+   rv   r   r   r   r'  r   r   r   )r   rj   r   s      r%   test_non_existent_srcz'_ZeroCopyFileTest.test_non_existent_src	  s    29;;///011 	)ROD%(((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	).55555s   A##A'*A'c                    t           dz   t           dz   |                     fd           |                     fd           t          d          5  	 d d d            n# 1 swxY w Y   t          d          5 }t          d          5 }|                     ||           d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   |                     t          d          d	           d S )
Nr{   r|   c                  ,    t          j                   S r*   r   rx   )ry   s   r%   r  z3_ZeroCopyFileTest.test_empty_file.<locals>.<lambda>	      	 0 9 9 r'   c                  ,    t          j                   S r*   r0  )rz   s   r%   r  z3_ZeroCopyFileTest.test_empty_file.<locals>.<lambda>	  r1  r'   r4   r]   Tr'  r'   )r   r   r=   r#  r   r`   )r   r{   r|   rz   ry   s      @@r%   test_empty_filez!_ZeroCopyFileTest.test_empty_file	  s   5.5.9999:::9999:::'4   	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 '4   	,Cgt$$ ,!!#s+++, , , , , , , , , , , , , , ,	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	74888#>>>>>sH   A%%A),A) CB4(C4B8	8C;B8	<CCCc                     t           j                            | j        t                    5  |                     t          t          j        t          t                     d d d            d S # 1 swxY w Y   d S )Nr   )
r,  r  r  
PATCHPOINTZeroDivisionErrorr   r   r'  r   r  r  s    r%   test_unhandled_exceptionz*_ZeroCopyFileTest.test_unhandled_exception	  s    ]  -> ! @ @ 	@ 	@/$ovw@ @ @	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@s   2A++A/2A/c                    t           j                            | j        t	          t
          j        d                    5  |                                 5 \  }}|                     t                    5  | 
                    ||           d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S Nyor   )r,  r  r  r5  r    r"   EINVALr  r   r   r#  r&  s      r%   test_exception_on_first_callz._ZeroCopyFileTest.test_exception_on_first_call	  s    ]  -4U\4-H-H ! J J 	0 	0!! 0Zc3&&'899 0 0%%c3///0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0sY   CB,2B	B,BB,BB, C,B0	0C3B0	4CCCc                 V   t           j                            | j        t	          t
          j        d                    5  |                                 5 \  }}|                     t          | j	        ||           d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S r9  )
r,  r  r  r5  r    r"   ENOSPCr  r   r#  r&  s      r%   test_filesystem_fullz&_ZeroCopyFileTest.test_filesystem_full	  sA    ]  -4U\4-H-H ! J J 	H 	H!! HZc3!!'4+<c3GGGH H H H H H H H H H H H H H H	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	Hs5   B&B:BB
	
BB
	BB"%B"N)r   r   r   __doc__r  r  r5  r  r  r  r  r  r  r  r#  r%  r(  r*  r-  r3  r7  r<  r?  rF   r'   r%   r  r  	  s        -- HHJ5 5 [5 ! ! [!" " " ! ! !
E E E       H H H6 6 6? ? ?@ @ @0 0 0H H H H Hr'   r  zos.sendfile() not supportedc                   H    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 ZdS )TestZeroCopySendfileos.sendfilec                 ,    t          j        ||          S r*   )r   _fastcopy_sendfile)r   r  r  s      r%   r#  z!TestZeroCopySendfile.zerocopy_fun	  s    (t444r'   c                    t          j        | j                  5 }t          t          d          5 }|                     t                    5  |                     ||           d d d            n# 1 swxY w Y   t          j	        ||           d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   | 
                    t          t          d          | j                   d S )Nr4   Tr'  )ioBytesIOr  r=   r  r   r   r#  r   r  r   r`   r&  s      r%   test_non_regular_file_srcz.TestZeroCopySendfile.test_non_regular_file_src	  s   Z&& 	-#gt$$ -&&'899 0 0%%c3///0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"3,,,- - - - - - - - - - - - - - -	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	74888$-HHHHHsX   B1BA."B.A22B5A26BB1B	B1!B	"B11B58B5c                    t          t          d          5 }t          j                    5 }|                     t
                    5  |                     ||           d d d            n# 1 swxY w Y   t          j        ||           |	                    d           | 
                    |                                | j                   d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nr]   r   )r=   r   rG  rH  r   r   r#  r   r  seekr   r_   r  r&  s      r%   test_non_regular_file_dstz.TestZeroCopySendfile.test_non_regular_file_dst
  s   &$ 	<3 <&&'899 0 0%%c3///0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"3,,,  T];;;< < < < < < < < < < < < < < <	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	<sY   C.CA(C(A,,C/A,0AC
C.C	C.C	C..C25C2c                    fd}g t           j        t          j                            dd|          5  |                                 5 \  }}|                     t                    5 }t          j	        ||           d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   sJ | 
                    |j        j        t          j                   d S )Nc                  v    s                     d             | i |S t          t          j        d          )Nr:  )rg   r    r"   EBADF)r#   r$   r  orig_sendfiles     r%   rn   zDTestZeroCopySendfile.test_exception_on_second_call.<locals>.sendfile
  sD     1D!!!$}d5f555ek4000r'   rC  T)rN  r   )r+   rn   r,  r  r  r  r   r    r   rE  r   r   r"   rO  )r   rn   r{   r|   r   r  rP  s        @@r%   test_exception_on_second_callz2TestZeroCopySendfile.test_exception_on_second_call
  s   	1 	1 	1 	1 	1 	1 ]  t-5 ! 7 7 	8 	8!! 8Zc3&&w// 82-c37778 8 8 8 8 8 8 8 8 8 8 8 8 8 88 8 8 8 8 8 8 8 8 8 8 8 8 8 8	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8
 +U[99999sY   B<B%,BB%BB%BB%B<%B)	)B<,B)	-B<<C C c                 |   t           j                            dt                    5 }|                                 5 \  }}t          j        ||           |j        sJ 	 d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   |                     t          t          d          | j                   d S )Nos.fstatr   Tr'  )r,  r  r  r    r  r   rE  r  r   r`   r  r  r   r  r{   r|   s       r%   test_cant_get_sizez'TestZeroCopySendfile.test_cant_get_size
  s$    ]   AA 	 Q!!  Zc3)#s333x                             	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	74888$-HHHHHs4   B"A+B+A/	/B2A/	3BB	Bc                    t           j                                        }d|_        t           j                            d|          5 }|                                 5 \  }}t          j        ||           |j        sJ 	 d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   | 	                    t          t          d          | j                   d S )Ni  rS  rM  Tr'  )r,  r  Mockst_sizer  r  r   rE  r  r   r`   r  r  r   r  r  r{   r|   s        r%   test_small_chunksz&TestZeroCopySendfile.test_small_chunks(
  s>   
 }!!## ]  $ ?? 	 1!!  Zc3)#s333x                             	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	74888$-HHHHHs6   B""B?B"B	B"B	B""B&)B&c                    t           j                                        }| j        dz   |_        t           j                            d|          5 }|                                 5 \  }}t          j        ||           |j	        sJ 	 d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   | 
                    t          t          d          | j                   d S )Ni  @rS  rW  Tr'  )r,  r  rX  r  rY  r  r  r   rE  r  r   r`   r  r  rZ  s        r%   test_big_chunkz#TestZeroCopySendfile.test_big_chunk5
  sF   
 }!!##}(9:]  $ ?? 	 1!!  Zc3)#s333x                             	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	74888$-HHHHHs6   B*$"BB*B	B*B	B**B.1B.c                    t           j                            dt                    5 }|                     t          t
          j        t          t                     |j	        d         d         }| 
                    |t          j                            t                               t          j        t                     t!          t          dd           |                     t          j        t          dz              |                     t          t
          j        t          t          dz              |j	        d         d         }| 
                    |d	           d d d            d S # 1 swxY w Y   d S )
NrC  r   r   r   s   helloTr'  3i   )r,  r  r  r6  r   r   r'  r   r  r  r   r+   r;   rU   r   rx   rC   r   )r   r  	blocksizes      r%   test_blocksize_argz'TestZeroCopySendfile.test_blocksize_argB
  sw   ]  -> ! @ @ 	1CD/$ovw@ @ @Aq)I Y(?(?@@@W%%%w6666OOI,gm<<</$ow#G G GAq)IY000	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1s   D2E&&E*-E*c                    t           j        sJ 	 t          j                            | j        t          t          j        d                    5 }| 	                                5 \  }}| 
                    t                    5  t          j        ||           d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   |j        sJ 	 d d d            n# 1 swxY w Y   t           j        rJ t          j                            | j                  5 }t          j        t          t                      |j        rJ 	 d d d            n# 1 swxY w Y   dt           _        d S # dt           _        w xY w)Nr:  r   T)r   _USE_CP_SENDFILEr,  r  r  r5  r    r"   ENOTSOCKr  r   r   rE  r  r'  r   r  rT  s       r%   test_file2file_not_supportedz1TestZeroCopySendfile.test_file2file_not_supportedT
  sP    &&&&	+$$O ' = = % ? ?  BC^^%% <#s**+<== < <1#s;;;< < < < < < < < < < < < < < << < < < < < < < < < < < < < < x                              ....$$T_55 $0008####$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ '+F###dF#****s   >E' C#B:B#B:#B''B:*B'+B:.C:B>	>CB>	CE' CE' "C#5E' )EE' EE' EE' 'E5N)r   r   r   r5  r#  rI  rL  rQ  rU  r[  r]  ra  re  rF   r'   r%   rB  rB  	  s        J5 5 5I I I< < <: : :$I I II I II I I1 1 1$+ + + + +r'   rB  z
macOS onlyc                       e Zd ZdZd ZdS )TestZeroCopyMACOSzposix._fcopyfilec                 B    t          j        ||t          j                  S r*   )r   _fastcopy_fcopyfileposix_COPYFILE_DATAr&  s      r%   r#  zTestZeroCopyMACOS.zerocopy_funn
  s    )#sE4HIIIr'   N)r   r   r   r5  r#  rF   r'   r%   rg  rg  j
  s-        #JJ J J J Jr'   rg  c                      e Zd Zd Zd Zd Z ej         ej	        e
j                                                  d           ej         eed          d          d                         Z ej        ej        d          d	             Zd
S )TestGetTerminalSizec                     t          j                    }|                     |j        d           |                     |j        d           dS )zCheck if get_terminal_size() returns a meaningful value.

        There's no easy portable way to actually check the size of the
        terminal, so let's check if it returns something sensible instead.
        r   N)r   get_terminal_sizer  columnslines)r   rV   s     r%   test_does_not_crashz'TestGetTerminalSize.test_does_not_crashs
  sH     '))a000
A.....r'   c                    t          j                    5 }d|d<   |d= t          j                    }ddd           n# 1 swxY w Y   |                     |j        d           t          j                    5 }|d= d|d<   t          j                    }ddd           n# 1 swxY w Y   |                     |j        d           dS )z.Check if environment variables have precedence777COLUMNSLINESNi	  888ix  )r   rF  r   ro  r   rp  rq  r   rH  rV   s      r%   test_os_environ_firstz)TestGetTerminalSize.test_os_environ_first}
  s<    *,, 	."C	NG+--D	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	s+++*,, 	.I CL+--D	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	S)))))s!   <A A 5BB!$B!c                    t          j                    5 }d|d<   d|d<   t          j                    }d d d            n# 1 swxY w Y   |                     |j        d           |                     |j        d           d S )Nr  ru  yyyrv  r   )r   rF  r   ro  r  rp  rq  rx  s      r%   test_bad_environz$TestGetTerminalSize.test_bad_environ
  s    *,, 	."C	N CL+--D	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	a000
A.....s   >AAz
not on ttyro  zneed os.get_terminal_size()c                    	 t          j        ddg                                                                          }n7# t          t
          t           j        f$ r |                     d           Y nw xY wt          |d                   t          |d                   f}t          j
                    5 }|d= |d= t          j                    }ddd           n# 1 swxY w Y   |                     ||           dS )	zCheck if stty returns the same results ignoring env

        This test will fail if stdin and stdout are connected to
        different terminals with different sizes. Nevertheless, such
        situations should be pretty rare.
        sttyrV   zstty invocation failedr   r   rv  ru  N)r   r  r  r   r   rz  r  r  r   r   rF  r   ro  r   )r   rV   r  rH  r@  s        r%   test_stty_matchz#TestGetTerminalSize.test_stty_match
  s2   	4*FF+;<<CCEEKKMMDD!?-/ 	4 	4 	4MM233333	4 QLL#d1g,,/*,, 	0GI-//F	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0
 	6*****s!   := 1A10A11CCCzWASI has no /dev/nullc                    t          j                    5 }|d= |d= t          j        t          dd           5  t          j        d          }d d d            n# 1 swxY w Y   |                     |j        d           |                     |j	        d           t          t          j        dd	
          5 }t          j        t          d|          5  t          j        d          }d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   |                     |j        d           |                     |j	        d           d d d            d S # 1 swxY w Y   d S )Nrv  ru  
__stdout__)
      )fallbackr  r  r5   r6   r7   )   (   r  r  )r   rF  r   r  r   r   ro  r   rp  rq  r=   r+   devnull)r   rH  rV   rY   s       r%   test_fallbackz!TestGetTerminalSize.test_fallback
  s{   *,, 	-GI "3d;; C C/BBBC C C C C C C C C C C C C C CT\2...TZ,,, bj#888 CA"3a88C C/BBBC C C C C C C C C C C C C C C C C C C C C C C C C C C C C C T\2...TZ,,,!	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	-s}   "EAEA	EA	 AE5D
C3'D
3C77D
:C7;D
>E
D	ED	9EEEN)r   r   r   rr  ry  r|  r,  r-  r+   isattyr   r  rw   rs   r  r.  r   is_wasir  rF   r'   r%   rm  rm  r
  s        / / /* * */ / / X3>#8#8#:#:;;\JJX%89968 8+ +8 8 KJ+* X_W_&=>>- - ?>- - -r'   rm  c                       e Zd ZdZd ZdS )PublicAPITestsz>Ensures that the correct values are exposed in the public API.c                 F   |                      t          t          d                     g d}t          t          d          st          j        dk    r|                    d           |                     t          t          j                  t          |                     d S )N__all__)r  r'  r  r  r
  r  r;  ro  r   r   r/  	ExecErrorr   r   r   r   r   r	   r   r   rd  r  r  ro  r   statvfsrN  r  )	r   rs   r   r+   rj   rg   r   rl  r  )r   
target_apis     r%   test_module_all_attributez(PublicAPITests.test_module_all_attribute
  s    	22333< < <
 2y!! 	,RW__l+++V^,,c*oo>>>>>r'   N)r   r   r   r@  r  rF   r'   r%   r  r  
  s)        HH? ? ? ? ?r'   r  __main__)F)Vr,  unittest.mockr   rt   r   r   r+   os.pathr"   r0   rp  r   rK   rM   r  rG  r   r   r   r   r   r   r	   r
   r   r   r   r   rM  ru  rj  ImportErrorr  r   test.supportr   test.support.os_helperr   r   r   r  r  r  r/  rS  r=  r>  r   r  r  r  r   r  r  AssertionErrorrK  r&   r2   rC   r[   r`   rh   r   SUPPORTS_SENDFILEr   r   TestCaser   r3  r  r@  r  r  rh  rk  r  r  r  r  r.  rB  rg  rm  r  r   mainrF   r'   r%   <module>r     s          



  				                  				6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6  LLLL   EEE       " " " " " " 3 3 3 3 3 3 3 3 ( ( ( ( ( (
3,f_
f_
))
,
!
!'
*
*	l2A2%JJJJJJOO   OOONNNN   GGG =z"N#>??  A AL L L	 	 	   ) ) )$   
 
 
& & &: 0/11   	 	 	 	 	 	 	 	W6 W6 W6 W6 W68, W6 W6 W6t`2 `2 `2 `2 `28X. `2 `2 `2D@? @? @? @? @?x* @? @? @?Ff8 f8 f8 f8 f88X. f8 f8 f8RM+ M+ M+ M+ M+x* M+ M+ M+`w4 w4 w4 w4 w4(+ w4 w4 w4t) ) ) ) )Y ) ) )o- o- o- o- o-x* o- o- o-dY) Y) Y) Y) Y)8$ Y) Y) Y)xG- G- G- G- G-h' G- G- G-TaH aH aH aH aH aH aH aHH &&(EFFs+ s+ s+ s+ s+,h.? s+ s+ GFs+l UL))J J J J J)8+< J J *)JL- L- L- L- L-(+ L- L- L-^? ? ? ? ?X& ? ? ?$ zHMOOOOO s6   &A+ +A54A5)
C4 4C>=C>D DD