
    ,h4                     :   d Z ddlZddlZddlZddlZddlZddlZddlZddlZ	ddl
mZ ddlmZ ddlmZmZ ddlmZmZ ddlmZmZmZmZmZmZmZmZmZmZ ddlZ ej<                  d      d	        Zej@                  jC                  d
       G d d             Z"y)zTests for distutils.util.    N)copy)	sysconfigutil)DistutilsByteCompileErrorDistutilsPlatformError)
byte_compilechange_rootcheck_environconvert_pathget_host_platformget_platformgrok_environment_errorrfc822_escapesplit_quoted	strtoboolT)autousec                    | j                  t        dt        j                         | j                  t        dt        j                         | j                  t        dt        j
                         | j                  t        dt        j                         | j                  t        j                  dt        j                  j                         | j                  t        j                  dt        j                  j                         | j                  t        j                  dt        j                  j                         | j                  t        dt        t        j                               y )	Nnameplatformversionsepjoinisabs
splitdrive_config_vars)setattrosr   sysr   r   r   pathr   r   r   r   r   r   )monkeypatchs    g/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/setuptools/_distutils/tests/test_util.pyenvironmentr"      s    FBGG,Z6Y4E266*6"''--8rww/A/AB	>4	8N8N3OP    save_envc                      e Zd Zd Zd Zd Zd Zd Zej                  j                  d      d        Zd Zd	 Zd
Zej                  j                  ddde de de fdde dfddde de de de fg      d        Zd Zd Zy)TestUtilc                    t        j                  dd      5  t        j                  dd      5  t               dk(  sJ 	 d d d        t        j                  dd      5  t               dk(  sJ 	 d d d        d d d        t        j                  dd	      5  t               t        j                         k(  sJ 	 d d d        y # 1 sw Y   xY w# 1 sw Y   _xY w# 1 sw Y   cxY w# 1 sw Y   y xY w)
Nos.namentzsys.versionz... [... (ARM64)]	win-arm64z... [... (ARM)]	win-arm32zsys.version_info)   	   r   finalr   )mockpatchr   stdlib_sysconfigr   selfs    r!   test_get_host_platformzTestUtil.test_get_host_platform-   s    ZZ	4( 	:M+>? :(*k999:M+<= :(*k999:	: ZZ*,AB 	J$&*:*G*G*IIII	J 	J: :: :	: 	:	J 	JsE   CC CC.C"C$ C		CC	CC!$C-c                    t        j                  dd      5  t         j                  j                  dddi      5  t               dk(  sJ 	 d d d        t         j                  j                  dddi      5  t               dk(  sJ 	 d d d        t         j                  j                  ddd	i      5  t               d
k(  sJ 	 d d d        t         j                  j                  dddi      5  t               dk(  sJ 	 d d d        d d d        y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   exY w# 1 sw Y   6xY w# 1 sw Y   y xY w)Nr(   r)   z
os.environVSCMD_ARG_TGT_ARCHx86win32x64z	win-amd64armr+   arm64r*   )r/   r0   dictr   r2   s    r!   test_get_platformzTestUtil.test_get_platform7   s   ZZ	4( 	50De/LM 1#~00010De/LM 5#~44450De/LM 5#~44450Dg/NO 5#~4445	5 	51 15 55 55 5	5 	5sj   #D=D*D=5D*D=0D%*D=+D1<D=D	D=D"	D=%D.	*D=1D:	6D==Ec                     t         j                  j                  d      }t        d      |k(  sJ t        t	        j
                  d            |k(  sJ t        d      t         j                  k(  sJ y )N) hometomystuffz/home/to/my/stuff.)r   r   r   r   pathlibPathcurdir)r3   expecteds     r!   test_convert_pathzTestUtil.test_convert_pathB   sW    66;;@A/0H<<GLL)<=>(JJC BII---r#   c                 H   dt         _        d }|t         j                  _        d }|t         j                  _        t        dd      dk(  sJ t        dd      dk(  sJ d	t         _        d
t         _        d }|t         j                  _        d }|t         j                  _        d }|t         j                  _        t        dd      dk(  sJ t        dd      dk(  sJ dt         _        t        j                  t              5  t        dd       d d d        y # 1 sw Y   y xY w)Nposixc                     | d   dk(  S )Nr   / r   s    r!   _isabsz)TestUtil.test_change_root.<locals>._isabsL   s    7c>!r#   c                  $    dj                  |       S )NrM   r   rO   s    r!   _joinz(TestUtil.test_change_root.<locals>._joinQ   s    88D>!r#   z/rootz/old/its/herez/root/old/its/herezits/herez/root/its/herer)   \c                 $    | j                  d      S )Nzc:\)
startswithrO   s    r!   rP   z)TestUtil.test_change_root.<locals>._isabs]   s    ??6**r#   c                 T    | j                  d      rd| j                  dd      fS d| fS )Nzc:r?   )rV   replacerO   s    r!   _splitdrivez.TestUtil.test_change_root.<locals>._splitdriveb   s.    t$DLLr233:r#   c                  $    dj                  |       S )NrT   rR   rO   s    r!   rS   z(TestUtil.test_change_root.<locals>._joini   s    99T?"r#   zc:\rootzc:\old\its\herezc:\root\old\its\herezits\herezc:\root\its\here	BugsBunny)r   r   r   r   r   r	   r   r   pytestraisesr   )r3   rP   rS   rY   s       r!   test_change_rootzTestUtil.test_change_rootH   s    	" 	" 7O48LLL7J/3CCC 	+ 	
 )	#  
$89=WW	
 :{37LLL ]]12 	1
K0	1 	1 	1s   DD!c                     t         j                  j                          t        j                  j                  dd        t                t        j                  d   t               k(  sJ y )NHOMEPLAT)r   r
   cache_clearr   environpopr   r2   s    r!   test_check_environzTestUtil.test_check_environz   sD    &&(


vt$zz&!\^333r#   zos.name != 'posix'c                    t         j                  j                          t        j                  j                  dd        dd l}|j                  d      }t        j                  j                  |d|      5  t                t        j                  d   dk(  sJ 	 d d d        t         j                  j                          t        j                  j                  dd        t        j                  j                  |dt              5  t                dt        j                  vsJ 	 d d d        y # 1 sw Y   xY w# 1 sw Y   y xY w)Nr`   r   )NNNNN/home/distutilsNgetpwuid)return_valuerg   )side_effect)r   r
   rb   r   rc   rd   pwdstruct_passwdr/   r0   objectKeyError)r3   rk   results      r!   test_check_environ_getpwuidz$TestUtil.test_check_environ_getpwuid   s    &&(


vt$ "" $
  ZZsJVD 	;O::f%)::::	; 	&&(


vt$ ZZsJHE 	,O+++	, 	,	; 	;	, 	,s   6#D/D;/D8;Ec                 (    t        d      g dk(  sJ y )Nz""one"" "two" 'three' \four)onetwothreefour)r   r2   s    r!   test_split_quotedzTestUtil.test_split_quoted   s     <= B
 
 	
 
r#   c                 \    d}d}|D ]  }t        |      rJ  |D ]  }t        |      sJ  y )N)
yYyesTruettruer{   Onon1)	nnoffalseoff0OffNoN)r   )r3   rz   r   rx   r   s        r!   test_strtoboolzTestUtil.test_strtobool   s@    MD 	 AQ<	   	$A |#	$r#   z        zgiven,wantedzhello
world
zhello
zworld
zhelloworldzhelloworld)r?   r?   zI am a
poor
lonesome
header
zI am a
zpoor
z	lonesome
zheader
c                 `   t        |      }t        j                  j                  ddd      }t	        j
                         5 }d| d}t        j                  |      }t        j                  j                  ||      j                  |       |j                  d       t        j                  |      }ddd       fD ]Y  }	|	j                         d	k(  sJ |	d
   dk(  sJ t        |	d   j                               t        |j                               k(  rYJ  ||k(  sJ y# 1 sw Y   qxY w)a{  
        We want to ensure a multi-line header parses correctly.

        For interoperability, the escaped value should also "round-trip" over
        `email.generator.Generator.flatten` and `email.message_from_*`
        (see pypa/setuptools#4033).

        The main issue is that internally `email.policy.EmailPolicy` uses
        `splitlines` which will split on some control chars. If all the new lines
        are not prefixed with spaces, the parser will interrupt reading
        the current header and produce an incomplete value, while
        incorrectly interpreting the rest of the headers as part of the payload.
        TFr   )utf8mangle_from_max_line_lengthzheader: z
other-header: 42

payload
)policyNzpayload
zother-header42header)r   emailr   EmailPolicyioStringIOmessage_from_string	generator	Generatorflattenseekmessage_from_fileget_payloadset
splitlines)
r3   givenwantedresr   bufferraworigregenmsgs
             r!   test_rfc822_escapezTestUtil.test_rfc822_escape   s   6 E")) * 

 [[] 	4fSE!@AC,,S1DOO%%fV%<DDTJKKN++F3E	4 %= 	LC??$33~&$..s8}//12c#..:J6KKK		L f}}	4 	4s   A2D$$D-c                     t         j                  }dt         _        	 t        j                  t              5  t        g        d d d        |t         _        y # 1 sw Y   xY w# |t         _        w xY w)NT)r   dont_write_bytecoder\   r]   r   r   )r3   old_dont_write_bytecodes     r!   test_dont_write_bytecodez!TestUtil.test_dont_write_bytecode   s\     #&"9"9"&	>89 !R ! '>C#! ! '>C#s"   A" AA" AA" "A/c                 >    t        d      }t        |      }|dk(  sJ y )NzUnable to find batch filez error: Unable to find batch file)OSErrorr   )r3   excr   s      r!   test_grok_environment_errorz$TestUtil.test_grok_environment_error   s&    12$S)8888r#   N)__name__
__module____qualname__r4   r=   rI   r^   re   r\   markskipifrp   rv   r   indentparametrizer   r   r   rN   r#   r!   r&   r&   +   s    J	5..1d4 [[,-, .,8
$ F[[ "Yvhbx#PQ6(%8926(&
6((6(S		
""H	>9r#   r&   )#__doc__r   email.generatoremail.policyr   r   rE   r   r   r1   unittest.mockr/   r   	distutilsr   distutils.errorsr   r   distutils.utilr   r	   r
   r   r   r   r   r   r   r   r\   fixturer"   r   usefixturesr&   rN   r#   r!   <module>r      s        	 	  
 $   % N    Q Q $G9 G9 %G9r#   