
    ^j                        d Z ddlmc m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Zej                  j                  e      Zej$                  d        Zd Zd Zej,                   G d d	ej.                               Zy)
z"Tests for distutils.command.check.    N)DistutilsSetupError)supportc                     t        |        | j                  t        j                  dd       t	                |j                  t               y)z;
    Clear docutils and hide the presence of pygments.
    pygmentsN)clear_docutilssetitemsysmodulesreload_checkaddfinalizer)monkeypatchrequests     q/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/setuptools/_distutils/tests/test_check.pyhide_pygmentsr      s5    
 ;Z6N&    c                     t         j                  D cg c]  }|j                  d      d   dk(  s| }}|D ]"  }| j                  t         j                  |       $ y c c}w )N.r   docutils)r	   r
   	partitiondelitem)r   namedocutils_namess      r   r   r      s_    s(;A(>*(LN   /CKK./s
   AAc                  6    t        j                  t               y)zH
    Reload the 'check' command module to reflect the import state.
    N)	importlibreload_check r   r   r   r   $   s     Vr   c            
       @   e Zd ZddZd Zd Zd Zd ZdD  cg c])  }t        j                  d| d	      j                         + c}}} Zd
 Zej                  j                  de      d        Zej                  j                  de      d        Zd Zyc c}}} w )	TestCheckNc                    |i }|)t        j                         }t        j                  |        | j                  di |\  }}t	        j
                  |      }|j                          |j                         D ]  \  }}	t        |||	        |j                          |j                          |t        j                         |S )Nr   )osgetcwdchdircreate_distr   checkinitialize_optionsitemssetattrensure_finalizedrun)
selfmetadatacwdoptionsold_dirpkg_infodistcmdr   values
             r   _runzTestCheck._run-   s    H?iikGHHSM)))5H5$ll4  "==? 	&KD%Cu%	&	?HHW
r   c                    | j                         }|j                  dk(  sJ dddddd}| j                  |      }|j                  dk(  sJ t        j                  t              5   | j                   i fi ddi d d d        | j                  |d      }|j                  dk(  sJ dddddd	d
d}| j                  |      }|j                  dk(  sJ y # 1 sw Y   ZxY w)N   xxx)urlauthorauthor_emailr   versionr   strictT)r<   u   Éricu   Something about esszet ßu   More things about esszet ß)r8   r9   r:   r   r;   descriptionlong_description)r4   	_warningspytestraisesr   )r+   r2   r,   s      r   test_check_metadatazTestCheck.test_check_metadata>   s     iik}}!!! !
 ii!}}!!! ]]./ 	+DIIb*XqM*	+ iii.}}!!! !!: A
 ii!}}!!!%	+ 	+s   %CCc           	         dD ]  }dd|dz   dddddi}| j                  |      }|j                  dk(  sJ d	||dz   <   | j                  |      }|j                  dk(  sJ d
||<   ||dz   = | j                  |      }|j                  dk(  rJ  y )N)r9   
maintainerr8   r7   _emailzName <name@email.com>r   r;   r   zname@email.comName)r4   r?   )r+   kindr,   r2   s       r   test_check_author_maintainerz&TestCheck.test_check_author_maintainerh   s    , 	&D ux!85	H ))H%C==A%%% )9HTH_%))H%C==A%%% $HTN)))H%C==A%%%+	&r   c                     | j                         \  }}t        j                  |      }d}|j                  |      }t	        |      dk(  sJ d}|j                  |      }t	        |      dk(  sJ y )Ntitle
===

testr6   ztitle
=====

testr   )r$   r   r%   _check_rst_datalen)r+   r0   r1   r2   broken_restmsgsrests          r   test_check_documentzTestCheck.test_check_document   sp    ))+$ll4  +"";/4yA~~ &""4(4yA~~r   c                    d}| j                  |      \  }}t        j                  |      }|j                          |j                  dk(  sJ ddddd|d}t        j                  t              5   | j                  |fi ddd d d d        d|d<   | j                  |d	d	      }|j                  d
k(  sJ d|d<   | j                  |t        d	d	      }|j                  d
k(  sJ y # 1 sw Y   cxY w)NrJ   r>   r6   r7   )r8   r9   r:   r   r;   r>   r<   restructuredtextu   title
=====

test ßr>   Tr   z)title
=====

.. include:: includetest.rst)r-   r<   rT   )
r$   r   r%   check_restructuredtextr?   r@   rA   r   r4   HERE)r+   rM   r0   r1   r2   r,   s         r   test_check_restructuredtextz%TestCheck.test_check_restructuredtext   s   *));)G$ll4 ""$}}!!! ! +
 ]]./ 	HDIIhGQA"FG	H (E#$iiiE}}!!! (V#$iid4$iO}}!!!	H 	Hs   0C))C2)codez
code-blockz/
            Here's some code:

            .. zK:: python

                def foo():
                    pass
            c                     | j                  |      \  }}t        j                  |      }|j                          |j	                  |      S )NrR   )r$   r   r%   rU   rK   )r+   descrr0   r1   r2   s        r   check_rst_datazTestCheck.check_rst_data   sD    ))5)A$ll4 ""$""5))r   rZ   c                 0    | j                  |      g k(  sJ y )N)r[   )r+   rZ   s     r   -test_check_rst_with_syntax_highlight_pygmentsz7TestCheck.test_check_rst_with_syntax_highlight_pygments   s    ""5)R///r   c                 X    | j                  |      \  }|\  }}}}t        |      dk(  sJ y )Nz0Cannot analyze code. Pygments package not found.)r[   str)r+   rZ   r   msg_excs         r   0test_check_rst_with_syntax_highlight_no_pygmentsz:TestCheck.test_check_rst_with_syntax_highlight_no_pygments   s4    $$U+313xMMMMr   c                     t        j                  t              5   | j                  i fi ddd d d d        y # 1 sw Y   y xY w)Nr6   rS   )r@   rA   r   r4   )r+   s    r   test_check_allzTestCheck.test_check_all   s@    ]]./ 	BDIIbAqa@A	B 	B 	Bs	   :A)NN)__name__
__module____qualname__r4   rB   rH   rP   rW   textwrapdedentlstripcode_examplesr[   r@   markparametrizer]   rc   re   ).0	directiveri   s   000r   r   r   +   s    "("T&0"R 0   	 { 		
 &(		M* [[Wm40 50 [[Wm4N 5N
B=s   .Br   )__doc__distutils.command.checkcommandr%   r   r   r!   r	   ri   distutils.errorsr   distutils.testsr   r@   pathdirname__file__rV   fixturer   r   r   combine_markersTempdirManagerr   r   r   r   <module>r|      s    ( ( (  	 
  0 # 	wwx  ' '/ 	`B&& `B `Br   