Current File : //usr/local/apps/python3/lib/python3.11/distutils/tests/__pycache__/test_filelist.cpython-311.pyc
�

�Ke�,��,�dZddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZmZm
Z
ddlmZddlmZdd	lmZmZdd
lmZdZd�ZGd
�dejej��ZGd�dej��Zd�Zedkree����dSdS)zTests for distutils.filelist.�N)�debug)�WARN)�DistutilsTemplateError)�
glob_to_re�translate_pattern�FileList)�filelist)�	os_helper)�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
c�B�|�dtj��S)z"Converts '/' in a string to os.sep�/)�replace�os�sep)�ss �G/usr/local/apps/python3/lib/python3.11/distutils/tests/test_filelist.py�make_local_pathrs���9�9�S�"�&�!�!�!�c�P�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
dS)
�FileListTestCasec��|�|�t��g��|���dS�N)�assertEqual�get_logsr�
clear_logs��selfs r�assertNoWarningsz!FileListTestCase.assertNoWarnings's:��������t�,�,�b�1�1�1��������rc��|�t|�t����d��|���dS)Nr)�
assertGreater�lenrrrrs r�assertWarningszFileListTestCase.assertWarnings+sB�����3�t�}�}�T�2�2�3�3�Q�7�7�7��������rc���tj}tjdkrtjtj��}dD]/\}}|d|iz}|�t|��|���0dS)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)rr�glob�regexs    r�test_glob_to_rez FileListTestCase.test_glob_to_re/sv���f��
�6�T�>�>��)�B�F�#�#�C�	A�	6�	6�K�D�%��U�C�L�(�E����Z��-�-�u�5�5�5�5�	6�	6rc�^�t��}t}ddddd|d��|d��|d��|d	��|d
��|d��|d��|d
��|d��|d��g|_t�d��D]0}|���dkr�|�|���1ddd|d��|d��|d��|d��|d��|d
��g	}|�|j|��dS)Nzfoo.tmp�ok�xozfour.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�line�wanteds     r�test_process_template_linez+FileListTestCase.test_process_template_lineAs{���J�J�	���(��t�Z�,� �a� 6�7�7��a� 0�1�1��a� 0�1�1��a� 0�1�1��a� 1�2�2��a�
�m�m��a��0�0��a� 1�2�2��a�	�l�l��a� 1�2�2��	��  �%�%�d�+�+�	2�	2�D��z�z�|�|�r�!�!���+�+�D�1�1�1�1�� ���!�*�+�+��!�$�%�%��!�$�%�%��!�J�-�-��!�O�$�$��!�%�&�&�	��	
�����&�1�1�1�1�1rc��t��}t��5}|�d��ddd��n#1swxYwY|�|���d��dt
_	t��5}|�d��ddd��n#1swxYwY|�|���d��dt
_dS#dt
_wxYw)N�xxxr0Tzxxx
F)rr�debug_printr�getvaluer�DEBUG)rr7�stdouts   r�test_debug_printz!FileListTestCase.test_debug_printisY���J�J�	�
�
�
�	)�&��!�!�%�(�(�(�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)����	)�	)�	)�	)�������*�*�B�/�/�/����	 � �"�"�
-�f��%�%�e�,�,�,�
-�
-�
-�
-�
-�
-�
-�
-�
-�
-�
-����
-�
-�
-�
-����V�_�_�.�.��8�8�8��E�K�K�K��%�E�K����s?�?�A�A�?C0�
B/�#C0�/B3�3C0�6B3�7+C0�0C>c��t��}gd�}|�|��|�|j|��dS)N)�a�b�c)r�set_allfilesrr1)rr7r6s   r�test_set_allfilesz"FileListTestCase.test_set_allfileswsG���J�J�	��������u�%�%�%�����+�U�3�3�3�3�3rc��t��}gd�|_|���|���|�|jgd���dS)N)rDrErD�grFrJ)rDrErFrJ)rr6�sort�remove_duplicatesr�rr7s  r�test_remove_duplicatesz'FileListTestCase.test_remove_duplicates}s_���J�J�	�8�8�8�	���������#�#�%�%�%������*>�*>�*>�?�?�?�?�?rc	��|�ttddd���d����tjd��}|�t|dd���|��|�ttddd���d����|�tddd����d����dS)NrDTF)�anchor�is_regex�search�*.pyzfilelist.py)�
assertTrue�hasattrrr'�compilerrR)rr*s  r�test_translate_patternz'FileListTestCase.test_translate_pattern�s��������c�$��?�?�?����	�	�	�
�
�3��������e�D�4�@�@�@��	�	�	�
	
�����c�$��>�>�>����	�	�	�
	
���)��4�%�1�1�1�17��
�1F�1F�	H�	H�	H�	H�	Hrc��t��}|�|�d����t��}ddg|_|�|�d����t��}ddg|_|�d��|�|jdg��dS)NrS�a.pyzb.pyza.txt)r�assertFalse�exclude_patternr6rTrrMs  r�test_exclude_patternz%FileListTestCase.test_exclude_pattern�s����J�J�	�����2�2�6�:�:�;�;�;��J�J�	�!�6�*�	�����	�1�1�&�9�9�:�:�:��J�J�	�!�7�+�	���!�!�&�)�)�)������7�)�4�4�4�4�4rc��t��}|�g��|�|�d����t��}|�ddg��|�|�d����t��}|�|j��|�ddg��|�d��|�|jddg��dS)NrSrY�b.txt�*)rrGrZ�include_patternrT�assertIsNoner1rrMs  r�test_include_patternz%FileListTestCase.test_include_pattern�s����J�J�	����r�"�"�"�����2�2�6�:�:�;�;�;��J�J�	������0�1�1�1����	�1�1�&�9�9�:�:�:��J�J�	����)�,�-�-�-������0�1�1�1��!�!�#�&�&�&�����+�f�g�->�?�?�?�?�?rc�l
�t}t��}dD]#}|�t|j|���$t��}|�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)	�include�excludezglobal-includezglobal-excludezrecursive-includezrecursive-exclude�graft�prune�blargrYr^zd/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)
rr�assertRaisesrr5rGrr6r r$)rr8r7�actions    r�test_process_templatez&FileListTestCase.test_process_template�s������J�J�	�G�	G�	G�F�
���4�'�=�v�
G�
G�
G�
G��J�J�	��������8���=�>�>�>��'�'��7�7�7������6�(�3�3�3��������'�'��7�7�7������6�(�3�3�3��������J�J�	�!�7�A�A�h�K�K�8�	���'�'��7�7�7������7�A�A�h�K�K�*@�A�A�A��������'�'��7�7�7������7�A�A�h�K�K�*@�A�A�A��������J�J�	��������8���=�>�>�>��'�'�(=�>�>�>������6�1�1�X�;�;�*?�@�@�@��������'�'�(=�>�>�>������6�1�1�X�;�;�*?�@�@�@��������J�J�	�!�7�A�A�h�K�K�8�	���'�'�(=�>�>�>������7�)�4�4�4��������'�'�(=�>�>�>������7�)�4�4�4��������J�J�	�������(���Q�Q�y�\�\� !��*�
�
� /�	0�	0�	0�	�'�'�(B�C�C�C������1�1�X�;�;���*�
�
�*F�G�G�G��������'�'�(B�C�C�C������1�1�X�;�;���*�
�
�*F�G�G�G��������J�J�	�!�1�1�X�;�;���)���a�a�
�m�m�L�	���'�'�(B�C�C�C������6�1�1�Y�<�<�*@�A�A�A��������'�'�(B�C�C�C������6�1�1�Y�<�<�*@�A�A�A��������J�J�	�������(���Q�Q�z�]�]� !��(��� -�	.�	.�	.�	�'�'�	�2�2�2������1�1�X�;�;���*�
�
�*F�G�G�G��������'�'�	�2�2�2������1�1�X�;�;���*�
�
�*F�G�G�G��������J�J�	�!�1�1�X�;�;���*�
�
�q�q��{�{�K�	���'�'�	�2�2�2������6�1�1�X�;�;�*?�@�@�@��������'�'�	�2�2�2������6�1�1�X�;�;�*?�@�@�@��������rN)�__name__�
__module__�__qualname__r r$r+r;rBrHrNrWr\rbrk�rrrr$s�������������6�6�6�$&2�&2�&2�P � � �4�4�4�@�@�@�H�H�H�*5�5�5� @�@�@�$j�j�j�j�jrrc�:�eZdZejd���Zd�Zd�ZdS)�FindAllTestCasec���tj��5tjdd��|�tj��g��ddd��dS#1swxYwYdS)N�foo�bar)r
�temp_cwdr�symlinkrr	�findallrs r�test_missing_symlinkz$FindAllTestCase.test_missing_symlink*s���
�
�
!�
!�	5�	5��J�u�e�$�$�$����X�-�/�/��4�4�4�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5����	5�	5�	5�	5�	5�	5s�=A�A"�%A"c���tj��5tjd��tj�dd��}tj|��tjd��tj�dd��}tj|��||g}|�ttj
����|��ddd��dS#1swxYwYdS)z�
        When findall is called with no parameters or with
        '.' as the parameter, the dot should be omitted from
        the results.
        rs�	file1.txtrtz	file2.txtN)r
rur�mkdir�path�join�create_empty_filer�sortedr	rw)r�file1�file2�expecteds    r�test_basic_discoveryz$FindAllTestCase.test_basic_discovery0s!���
�
!�
!�	C�	C��H�U�O�O�O��G�L�L���4�4�E��'��.�.�.��H�U�O�O�O��G�L�L���4�4�E��'��.�.�.��u�~�H����V�H�$4�$6�$6�7�7��B�B�B�	C�	C�	C�	C�	C�	C�	C�	C�	C�	C�	C�	C����	C�	C�	C�	C�	C�	Cs�C	C*�*C.�1C.c��tj��5}tj�|d��}tj|��|g}|�tj|��|��ddd��dS#1swxYwYdS)zj
        When findall is called with another path, the full
        path name should be returned.
        rzN)	r
�temp_dirrr|r}r~rr	rw)rr�r�r�s    r�test_non_local_discoveryz(FindAllTestCase.test_non_local_discovery@s���
�
�
!�
!�	C�X��G�L�L��;�7�7�E��'��.�.�.��w�H����X�-�h�7�7��B�B�B�		C�	C�	C�	C�	C�	C�	C�	C�	C�	C�	C�	C����	C�	C�	C�	C�	C�	Cs�A B�B�BN)rlrmrnr
�skip_unless_symlinkrxr�r�rorrrqrq)sW�������"�5�5�#�"�5�
C�C�C� 	C�	C�	C�	C�	Crrqc���tjtj���t��tj���t
��g��Sr)�unittest�	TestSuite�
TestLoader�loadTestsFromTestCaserrqrorr�
test_suiter�LsQ��������3�3�4D�E�E�����3�3�O�D�D����r�__main__)�__doc__rr'r��	distutilsr�
distutils.logr�distutils.errorsr�distutils.filelistrrrr	�test.supportr
rr�distutils.testsr
r2r�LoggingSilencer�TestCaserrqr�rlrorr�<module>r�s���#�#�	�	�	�	�	�	�	�	�����������������3�3�3�3�3�3�F�F�F�F�F�F�F�F�F�F�������"�"�"�"�"�"�6�6�6�6�6�6�6�6�#�#�#�#�#�#�
�� "�"�"�
B�B�B�B�B�w�.��(�B�B�B�J C� C� C� C� C�h�'� C� C� C�F����z����L�����������r