
    vKgG"                         S SK rS SKrS SKrS SKrS SKJr  S SKrS SK	r
S SKr " S S5      r " S S5      r " S S5      r\R                   R#                  S	5      S
 5       rg)    N)cleandocc                   b    \ rS rSrS rS rS rS rS rS r	S r
S	 rS
 rS rS rS rS rSrg)TestPackageIndex   c                     SnUS-  nSR                  5       R                  " S0 [        5       D6n[        R                  R
                  R                  U5      (       d   eg )Nz&http://other_url?:action=show_md5&amp;z'digest=0123456789abcdef0123456789abcdefz
            <a href="http://some_url">Name</a>
            (<a title="MD5 hash"
            href="{hash_url}">md5</a>)
         )lstripformatlocals
setuptoolspackage_indexPYPI_MD5match)selfhash_urldocs      b/var/www/highfloat_scraper/venv/lib/python3.13/site-packages/setuptools/tests/test_packageindex.py
test_regexTestPackageIndex.test_regex   sa    ;== FHVV	 ( %h	(
 ''0066s;;;;    c                 L   [         R                  R                  5       nSn[        R                  " [
        [        R                  " U5      S9   UR                  U5      n[        U[        R                  R                  5      (       d   e S S S 5        g ! , (       d  f       g = f)Nz.http://127.0.0.1:0/nonesuch/test_package_indexr   r   r   PackageIndexpytestraises	Exceptionreescapeopen_url
isinstanceurlliberror	HTTPErrorr   indexurlvs       r   test_bad_url_bad_port&TestPackageIndex.test_bad_url_bad_port   sh    ((557>]]9BIIcN;s#Aa!7!78888 <;;s   =B
B#c                 J   [         R                  R                  SS9nSn[        R                  " [
        [        R                  " U5      S9   UR                  U5      n[        U[        R                  R                  5      (       d   e S S S 5        g ! , (       d  f       g = f)Nzwww.example.comhostszMurl:%20https://svn.plone.org/svn/collective/inquant.contentmirror.plone/trunkr   r   r%   s       r   test_bad_url_typo"TestPackageIndex.test_bad_url_typo    sp     ((55<P5Q]]]9BIIcN;s#Aa!7!78888 <;;s   =B
B"c                     [         R                  R                  SS9nS nX!l        Sn[        R
                  " [        SS9   UR                  U5        S S S 5        g ! , (       d  f       g = f)Nr,   r-   c                  @    [         R                  R                  S5      e)Nline)httpclientBadStatusLine)argss    r   _urlopen?TestPackageIndex.test_bad_url_bad_status_line.<locals>._urlopen/   s    ++++F33r   zhttp://example.comr3   r   )r   r   r   openerr   r   r   r    )r   r&   r8   r'   s       r   test_bad_url_bad_status_line-TestPackageIndex.test_bad_url_bad_status_line,   sS    ((55<P5Q	4  "]]9G4NN3 544s   A
A+c                    [         R                  R                  SS9nSn UR                  U5        [        S5      e! [        R
                  R                   a)  n[        U5      nSU;   d  SU;   d  SU;   d   e SnAgSnAff = f)	z?
A bad URL with a double scheme should raise a DistutilsError.
r,   r-   z2http://http://svn.pythonpaste.org/Paste/wphp/trunkznonnumeric portzgetaddrinfo failedzName or service not knownNzDid not raise)	r   r   r   r    	distutilserrorsDistutilsErrorstrRuntimeError)r   r&   r'   r#   msgs        r   test_bad_url_double_scheme+TestPackageIndex.test_bad_url_double_scheme7   s     ((55<P5Q C		NN3 ?++ .. 	e*C!S('3..#56 	s   = BA??Bc                 t    [         R                  R                  SS9nSnUR                  US5      (       d   eg )Nr,   r-   zfile:///tmp/test_package_indexT)r   r   r   url_ok)r   r&   r'   s      r   test_url_okTestPackageIndex.test_url_okK   s8    ((55<P5Q.||C&&&&r   c                     [         R                  R                  nU" S5      nSnX#:X  d   eU" S5      nSnX#:X  d   eU" S5      nSnX#:X  d   eU" S5      nSnX#:X  d   eg )	Nzreportlab-2.5.win32-py2.4.exe)reportlab-2.5z2.4win32zreportlab-2.5.win32.exe)rK   NrL   z!reportlab-2.5.win-amd64-py2.7.exe)rK   z2.7	win-amd64zreportlab-2.5.win-amd64.exe)rK   NrM   )r   r   parse_bdist_wininst)r   parseactualexpecteds       r   test_parse_bdist_wininst)TestPackageIndex.test_parse_bdist_wininstP   s    ((<<672!!!011!!!:;6!!!455!!!r   c                     [         R                  R                  R                  nU" S5      u  p#US:X  d   eUS:X  d   eg)z1
Test the basic usage of _vcs_split_rev_from_url
zhttps://example.com/bar@2995zhttps://example.com/bar2995N)r   r   r   _vcs_split_rev_from_url)r   vsrfur'   revs       r   test__vcs_split_rev_from_url-TestPackageIndex.test__vcs_split_rev_from_urlc   sC     ((55MM78////f}}r   c                 L   US-  nUR                  S5       nUR                  S5        SSS5        S[        R                  R	                  [        U5      5      -   S-   n[        R                  R                  U5      nSUR                  5       ;   d   eg! , (       d  f       Nr= f)zB
local_open should be able to read an index from the file system.
z
index.htmlwz<div>content</div>Nzfile:/content)
openwriter"   requestpathname2urlrA   r   r   
local_openread)r   tmpdir
index_filefr'   ress         r   test_local_index!TestPackageIndex.test_local_indexl   s     l*
__S!QGG() "33CK@@3F&&11#6CHHJ&&&	 "!s   B
B#c                    SS/n/ SQn/ SQnS/nS/n/ SQnU VVV	V
Vs/ sHN  nU HE  n[        X4U/S/5       H/  n	U H&  n
U
 Vs/ sH  nSR                  XxX/5      PM     snPM(     M1     MG     MP     nn
n	nnnU HZ  u  p[        [        R                  R                  SU-   5      5      nUS	   R                  S:X  d   eUS
   R                  U:X  a  MZ   e   gs  snf s  snn
n	nnf )z&
EGG fragments must comply to PEP 440
 z1!)0z0.0z0.0.0)a0b0rc0z.post0z.dev0))rl   rl   )	+ubuntu.0rq   )z	+ubuntu-0rq   )z	+ubuntu_0rq   z3http://example.com/example-foo.zip#egg=example-foo-r      N)sumjoinlistr   r   distros_for_urlversion)r   epochreleasesprepostdevlocalerplocslocversionsr(   vcdistss                   r   test_egg_fragment"TestPackageIndex.test_egg_fragmentw   s    
 




 z

 
#S)B40	 155RWWaA^$5 	 6 1 6 6 	 
 EA((88IAME
 8##r)))8##r)))  6
s   %CC CCc                 "   Sn[         R                  R                  5       nUS-  nUR                  SSSSU/5        UR                  SSUSSS	/5        UR	                  X15      nU[        U5      :X  d   e[        UR                  5      S
:X  d   eg )Nz7git+https://github.example/group/project@master#egg=foozproject@mastergitclone--quiet$https://github.example/group/projectz-Ccheckoutmaster   )r   r   r   registerdownloadrA   lencalls)r   tmp_pathfpr'   r&   expected_dirresults          r   test_download_git_with_rev+TestPackageIndex.test_download_git_with_rev   s    G((557"22
2
 	 	UD,
IxPQ.\****288}!!!r   c                     Sn[         R                  R                  5       nUS-  nUR                  SSSSU/5        UR	                  X15        g )Nz0git+https://github.example/group/project#egg=fooprojectr   r   r   r   )r   r   r   r   r   )r   r   r   r'   r&   r   s         r   test_download_git_no_rev)TestPackageIndex.test_download_git_no_rev   sS    @((557)+
2
 	 	s%r   c                     Sn[         R                  R                  5       nSn[        R                  " [
        R                  R                  US9   UR                  X!5        S S S 5        g ! , (       d  f       g = f)Nz'svn+https://svn.example/project#egg=fooz!.*SVN download is not supported.*r   )	r   r   r   r   r   r>   r?   r@   r   )r   r   r'   r&   rC   s        r   test_download_svn"TestPackageIndex.test_download_svn   sS    7((5572]]9++::#FNN3) GFFs   A++
A9r   N)__name__
__module____qualname____firstlineno__r   r)   r/   r;   rD   rH   rR   rY   ri   r   r   r   r   __static_attributes__r   r   r   r   r      sD    <9
9	 ,('
"&	'**X"&&*r   r   c                   2    \ rS rSrS rS rS rS rS rSr	g)	TestContentCheckers   c                    [         R                  R                  R                  S5      nUR	                  SR                  S5      5        UR                  R                  5       S:X  d   eUR                  5       (       d   eg )N3http://foo/bar#md5=f12895fdffbd45007040d2e44df98478z$You should probably not be using MD5ascii f12895fdffbd45007040d2e44df98478)	r   r   HashCheckerfrom_urlfeedencodehash	hexdigestis_validr   checkers     r   test_md5TestContentCheckers.test_md5   sl    **66??A
 	;BB7KL||%%'+MMMM!!!!r   c                     [         R                  R                  R                  S5      nUR	                  SR                  S5      5        UR                  5       (       d   eg)z<Content checks should succeed silently if no hash is presentz1http://foo/bar#something%20completely%20differentanythingr   Nr   r   r   r   r   r   r   r   s     r   test_other_fragment'TestContentCheckers.test_other_fragment   sO    **66???
 	Z&&w/0!!!!r   c                     [         R                  R                  R                  S5      nUR	                  SR                  S5      5        UR                  5       (       d   eg)z0Content checks should succeed if a hash is emptyzhttp://foo/bar#md5=r   r   Nr   r   s     r   test_blank_md5"TestContentCheckers.test_blank_md5   sK    **66??@UVZ&&w/0!!!!r   c                 z    [         R                  R                  R                  S5      nUR                  S:X  d   eg )Nr   md5)r   r   r   r   	hash_namer   s     r   test_get_hash_name_md5*TestContentCheckers.test_get_hash_name_md5   s7    **66??A
   E)))r   c                     [         R                  R                  R                  S5      nUR	                  S S5      nUS:X  d   eg )Nr   c                     U $ )Nr   )xs    r   <lambda>1TestContentCheckers.test_report.<locals>.<lambda>   s    qr   zMy message about %szMy message about md5)r   r   r   r   report)r   r   reps      r   test_reportTestContentCheckers.test_report   sC    **66??A
 nn[*?@,,,,r   r   N)
r   r   r   r   r   r   r   r   r   r   r   r   r   r   r      s    """*-r   r   c                       \ rS rSrS rSrg)TestPyPIConfig   c                     US-  nUR                  [        S5      SS9  [        R                  R	                  5       nUR
                  S   nUR                  S:X  d   eUR                  S:X  d   eg )Nz.pypircz
                [pypi]
                repository=https://pypi.org
                username=jaraco
                password=pity%
                zutf-8)encodingzhttps://pypi.orgjaracozpity%)
write_textr   r   r   
PyPIConfigcreds_by_repositoryusernamepassword)r   tmp_home_dirpypirccfgcreds        r   test_percent_in_password'TestPyPIConfig.test_percent_in_password   s|    	)  	 
	
 &&113&&'9:}}(((}}'''r   r   N)r   r   r   r   r   r   r   r   r   r   r      s    (r   r   rr   c                  V    [         R                  R                  R                  S5        g)z3
REL should not hang on a contrived attack string.
a  < rel=                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                N)r   r   RELsearchr   r   r   test_REL_DoSr     s    
   ''(>?r   )http.clientr4   r   urllib.errorr"   urllib.requestinspectr   r   setuptools.package_indexr   distutils.errorsr>   r   r   r   marktimeoutr   r   r   r   <module>r      sd     	      |* |*~"- "-J( (( Q@ @r   