HEX
Server: Apache
System: Linux p3plzcpnl506847.prod.phx3.secureserver.net 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: slfopp7cb1df (5698090)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/python38/lib/python3.8/distutils/tests/__pycache__/test_filelist.cpython-38.pyc
U

�i�_�,�@s�dZddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZmZm
Z
ddlmZddlZddlmZmZdd	lmZd
Zdd�ZGd
d�dejej�ZGdd�dej�Zdd�Zedkr�ee��dS)zTests for distutils.filelist.�N)�debug)�WARN)�DistutilsTemplateError)�
glob_to_re�translate_pattern�FileList)�filelist)�captured_stdout�run_unittest)�supportz�include ok
include xo
exclude xo
include foo.tmp
include buildout.cfg
global-include *.x
global-include *.txt
global-exclude *.tmp
recursive-include f *.oo
recursive-exclude global *.x
graft dir
prune dir3
cCs|�dtj�S)z"Converts '/' in a string to os.sep�/)�replace�os�sep)�s�r�</opt/python38/lib/python3.8/distutils/tests/test_filelist.py�make_local_pathsrc@sdeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�FileListTestCasecCs|�|�t�g�|��dS�N)�assertEqual�get_logsr�
clear_logs��selfrrr�assertNoWarnings'sz!FileListTestCase.assertNoWarningscCs"|�t|�t��d�|��dS)Nr)Z
assertGreater�lenrrrrrrr�assertWarnings+szFileListTestCase.assertWarningscCsJtj}tjdkrt�tj�}dD]$\}}|d|i}|�t|�|�q dS)N�\))zfoo*z(?s:foo[^%(sep)s]*)\Z)zfoo?z(?s:foo[^%(sep)s])\Z)zfoo??z(?s:foo[^%(sep)s][^%(sep)s])\Z)zfoo\\*z(?s:foo\\\\[^%(sep)s]*)\Z)zfoo\\\*z(?s:foo\\\\\\[^%(sep)s]*)\Z)zfoo????z2(?s:foo[^%(sep)s][^%(sep)s][^%(sep)s][^%(sep)s])\Z)zfoo\\??z"(?s:foo\\\\[^%(sep)s][^%(sep)s])\Zr)rr�re�escaperr)rrZglob�regexrrr�test_glob_to_re/s

z FileListTestCase.test_glob_to_recCs�t�}t}ddddd|d�|d�|d�|d	�|d
�|d�|d�|d
�|d�|d�g|_t�d�D]}|��dkrrq`|�|�q`ddd|d�|d�|d�|d�|d�|d
�g	}|�|j|�dS)Nzfoo.tmp�okZxozfour.txtzbuildout.cfgz.hg/last-message.txtzglobal/one.txtzglobal/two.txtzglobal/files.xzglobal/here.tmpzf/o/f.ooz
dir/graft-onezdir/dir2/graft2zdir3/okzdir3/sub/ok.txt�
�)	rr�allfiles�MANIFEST_IN�split�strip�process_template_liner�files)r�	file_list�l�lineZwantedrrr�test_process_template_lineAs<��z+FileListTestCase.test_process_template_linec	Csvt�}t��}|�d�W5QRX|�|��d�dt_z0t��}|�d�W5QRX|�|��d�W5dt_XdS)NZxxxr%TFzxxx
)rr	Zdebug_printr�getvaluer�DEBUG)rr,�stdoutrrr�test_debug_printisz!FileListTestCase.test_debug_printcCs,t�}dddg}|�|�|�|j|�dS)N�a�b�c)r�set_allfilesrr&)rr,r+rrr�test_set_allfilesws

z"FileListTestCase.test_set_allfilescCsBt�}ddddddg|_|��|��|�|jddddg�dS)Nr4r5�gr6)rr+�sortZremove_duplicatesr�rr,rrr�test_remove_duplicates}s
z'FileListTestCase.test_remove_duplicatescCsr|�ttdddd�d��t�d�}|�t|ddd�|�|�ttdddd�d��|�tdddd��d��dS)Nr4TF)ZanchorZis_regex�search�*.pyzfilelist.py)�
assertTrue�hasattrrr�compilerr=)rr!rrr�test_translate_pattern�s(�
����z'FileListTestCase.test_translate_patterncCsdt�}|�|�d��t�}ddg|_|�|�d��t�}ddg|_|�d�|�|jdg�dS)Nr>�a.pyzb.pyza.txt)r�assertFalseZexclude_patternr+r?rr;rrr�test_exclude_pattern�s


z%FileListTestCase.test_exclude_patterncCs�t�}|�g�|�|�d��t�}|�ddg�|�|�d��t�}|�|j�|�ddg�|�d�|�|jddg�dS)Nr>rC�b.txt�*)rr7rDZinclude_patternr?ZassertIsNoner&rr;rrr�test_include_pattern�s

z%FileListTestCase.test_include_patterncCs�t}t�}dD]}|�t|j|�qt�}|�dd|d�g�|�d�|�|jdg�|��|�d�|�|jdg�|�	�t�}dd|d�g|_|�d�|�|jd|d�g�|��|�d�|�|jd|d�g�|�	�t�}|�dd|d�g�|�d	�|�|jd|d�g�|��|�d
�|�|jd|d�g�|�	�t�}dd|d�g|_|�d�|�|jdg�|��|�d�|�|jdg�|�	�t�}|�d|d
�|d�|d�g�|�d�|�|j|d
�|d�g�|��|�d�|�|j|d
�|d�g�|�	�t�}d|d
�|d�|d�g|_|�d�|�|jd|d�g�|��|�d�|�|jd|d�g�|�	�t�}|�d|d
�|d�|d�g�|�d�|�|j|d
�|d�g�|��|�d�|�|j|d
�|d�g�|�	�t�}d|d
�|d�|d�g|_|�d�|�|jd|d�g�|��|�d�|�|jd|d�g�|�	�dS)N)	ZincludeZexcludezglobal-includezglobal-excludezrecursive-includezrecursive-excludeZgraftZpruneZblargrCrFzd/c.pyzinclude *.pyzinclude *.rbzexclude *.pyzexclude *.rbzglobal-include *.pyzglobal-include *.rbzglobal-exclude *.pyzglobal-exclude *.rbzd/b.pyzd/c.txtzd/d/e.pyzrecursive-include d *.pyzrecursive-include e *.pyzrecursive-exclude d *.pyzrecursive-exclude e *.pyzf/f.pyzgraft dzgraft ezprune dzprune e)
rrZassertRaisesrr*r7rr+rr)rr-r,�actionrrr�test_process_template�s��







�



�



z&FileListTestCase.test_process_templateN)�__name__�
__module__�__qualname__rrr"r/r3r8r<rBrErHrJrrrrr$s(rc@s,eZdZejjdd��Zdd�Zdd�ZdS)�FindAllTestCasec	Cs6tj���"t�dd�|�t��g�W5QRXdS)N�foo�bar)�testr�temp_cwdr�symlinkrr�findallrrrr�test_missing_symlink*sz$FindAllTestCase.test_missing_symlinkc	Cs~tj���jt�d�tj�dd�}tj�|�t�d�tj�dd�}tj�|�||g}|�t	t
���|�W5QRXdS)z�
        When findall is called with no parameters or with
        '.' as the parameter, the dot should be omitted from
        the results.
        rO�	file1.txtrPz	file2.txtN)rQrrRr�mkdir�path�join�create_empty_filer�sortedrrT)r�file1Zfile2�expectedrrr�test_basic_discovery0s

z$FindAllTestCase.test_basic_discoveryc	CsLtj���8}tj�|d�}tj�|�|g}|�t�	|�|�W5QRXdS)zj
        When findall is called with another path, the full
        path name should be returned.
        rVN)
rQr�temp_dirrrXrYrZrrrT)rr_r\r]rrr�test_non_local_discovery@s
z(FindAllTestCase.test_non_local_discoveryN)	rKrLrMrQrZskip_unless_symlinkrUr^r`rrrrrN)s
rNcCst�t�t�t�t�g�Sr)�unittestZ	TestSuiteZ	makeSuiterrNrrrr�
test_suiteLs�rb�__main__)�__doc__rrraZ	distutilsrZ
distutils.logrZdistutils.errorsrZdistutils.filelistrrrrZtest.supportrQr	r
Zdistutils.testsrr'rZLoggingSilencerZTestCaserrNrbrKrrrr�<module>s,�#