Current File : //usr/local/apps/python3/lib/python3.11/test/__pycache__/test_zipimport_support.cpython-311.pyc
�

�Ke�)���ddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlmZddl
mZmZmZmZmZejjZddlmZmZmZmZd�ZGd�dej��Zd�Zed	krej��dSdS)
�N)�	os_helper)�spawn_python�kill_python�assert_python_ok�make_script�make_zip_script)�test_doctest�sample_doctest�sample_doctest_no_doctests�sample_doctest_no_docstringsc���tjtd���}tjt���}	|j�d|j��}n#t$r
|j}YnwxYw|�|||��D]}|�	|���|j
|j}}|r$tj
�d||fz���trtd|j|fz��||fS)NF)�verbose�recurse)r�.z%d of %d doctests failedz,doctest (%s) ... %d tests with zero failures)�doctest�
DocTestFinderr�
DocTestRunner�
__module__�__qualname__�AttributeError�__name__�find�run�failures�tries�test�support�
TestFailed�print)�obj�module�finder�runner�name�example�f�ts        �E/usr/local/apps/python3/lib/python3.11/test/test_zipimport_support.py�_run_object_doctestr)$s��
�
"�7�E�
B�
B�
B�F�
�
"�7�
3�
3�
3�F���.�.�.�#�*:�*:�;������������������;�;�s�D�&�1�1�����
�
�7������?�F�L�q�A��K��l�%�%�&@�A�q�6�&I�J�J�J��V�
�=���RS�@T�T�U�U�U��a�4�Ks�A	�	A�Ac�2�eZdZd�Zd�Zd�Zd�Zd�Zd�ZdS)�ZipSupportTestsc�:�tj��tj���t
jdd�|_t
jdd�|_t
jdd�|_t
j	���dS�N)
�	linecache�
clearcache�	zipimport�_zip_directory_cache�clear�sys�path�	meta_path�
path_hooks�path_importer_cache��selfs r(�setUpzZipSupportTests.setUpAsv��������&�,�,�.�.�.��H�Q�Q�Q�K��	���q�q�q�)����.����+�����%�%�'�'�'�'�'�c���|jtjdd�<|jtjdd�<|jtjdd�<tj���dSr-)r4r3r5r6r7r2r8s r(�tearDownzZipSupportTests.tearDownIsR���i��������>��
�a�a�a�� �O���q�q�q����%�%�'�'�'�'�'r;c�6�d}tj��5}t|d|��}tj�dtj�|����}t|d||��\}}tj|��tj�
d|��ddl}	|�tj|j��|��tjd=n#tjd=wxYw	ddd��dS#1swxYwYdS)Nzdef foo(): pass
�__init__�zip_pkg�test_zipr)r�temp_dirr�osr4�join�basenamer�remover3�insertr@�assertEqual�inspect�	getsource�foo�modules)r9�test_src�d�	init_name�name_in_zip�zip_name�run_namer@s        r(� test_inspect_getsource_issue4223z0ZipSupportTests.test_inspect_getsource_issue4223OsP��&��
�
�
!�
!�	+�Q�#�A�z�8�<�<�I��'�,�,�y�')�w�'7�'7�	�'B�'B�D�D�K�!0��J�09�;�"H�"H��H�h��I�i� � � ��H�O�O�A�x�(�(�(��N�N�N�
+�� � ��!2�7�;�!?�!?��J�J�J��K�	�*�*��C�K�	�*�*�*�*�*�*�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+����	+�	+�	+�	+�	+�	+s*�BD�3-C.� D�.C=�=D�D�Dc���tjt��}|�dd��}|�dd��}|�dd��}i}tt
tfD]g}tj|��}|�dd��}|j�d��d}|�d	d
��}|||<�htj
��5}t|d|��}t|d|��\}}	tj|d��5}
|���D]\}}|
�|d
z|���	ddd��n#1swxYwYt"rStj|d��5}t%d|z��|���ddd��n#1swxYwYt)j|��t,j�d|��ddl}	|j|jj|jjj|jj|jj|jj|jj|jj |jj!|j"|j"j|j"j |j"j!|j#|j$|j%|j&j'|j&j(|j&j)|j&j*|j&j+|j,|j-|j.|j/|j0|j1g}
|j2|j3|j4g}|
D]}tk||���	t,j6d=n#t,j6d=wxYw	ddd��dS#1swxYwYdS)Nzfrom test import test_doctestz*import test_zipped_doctest as test_doctestztest.test_doctest�test_zipped_doctestztest.sample_doctest�sample_zipped_doctestr����sample_�sample_zipped_rA�az.py�rzContents of %r:r)7rIrJr	�replacer
rrr�splitrrBrr�zipfile�ZipFile�items�writestrrr�printdirrCrFr3r4rGrU�SampleClass�NestedClassr?�
a_classmethod�
a_property�a_staticmethod�double�get�SampleNewStyleClass�sample_func�test_DocTest�test_DocTestParser�test_DocTestRunner�basics�
exceptions�option_directives�optionflags�verbose_flag�test_Example�
test_debug�test_testsource�test_trailing_space_in_test�test_DocTestSuite�test_DocTestFinder�test_DocFileSuite�
test_testfile�test_unittest_reportflagsr)rL)r9rM�sample_sources�mod�src�mod_namerN�script_namerQrR�z�zip_filerU�known_good_tests�fail_due_to_missing_data_filesr s                r(�test_doctest_issue4197z&ZipSupportTests.test_doctest_issue4197_sU���$�\�2�2���#�#�8�E�G�G���#�#�$7�$9�;�;���#�#�$9�$;�=�=����"�$>�0�2�	+�	+�C��#�C�(�(�C��+�+�1�3H�I�I�C��|�)�)�#�.�.�r�2�H��'�'�	�3C�D�D�H�'*�N�8�$�$�
�
�
!�
!�?	7�Q�%�a�)>�,4�6�6�K�!0��J�0;�"=�"=��H�h����3�/�/�
6�1�%3�%9�%9�%;�%;�6�6�M�H�c��J�J�x�%�/��5�5�5�5�6�
6�
6�
6�
6�
6�
6�
6�
6�
6�
6�
6����
6�
6�
6�
6��
(��_�X�s�3�3�(�x��,�x�7�8�8�8��%�%�'�'�'�(�(�(�(�(�(�(�(�(�(�(����(�(�(�(�
�I�k�"�"�"��H�O�O�A�x�(�(�(�&�&�&�&�0
7�(�3�'�3�?�'�3�?�H�'�3�<�'�3�A�'�3�>�'�3�B�'�3�:�'�3�7�'�;�'�;�D�'�;�B�'�;�?�'�3�'�4�'�:�'�:�A�'�:�E�'�:�L�'�:�F�'�:�G�'�4�'�2�'�7�'�C�'�9�'�:�7$� �@(�9�'�5�'�A�2�.�,�B�B�C�'��-@�A�A�A�A�B��K� 5�6�6��C�K� 5�6�6�6�6�6�6�?	7�?	7�?	7�?	7�?	7�?	7�?	7�?	7�?	7�?	7�?	7�?	7����?	7�?	7�?	7�?	7�?	7�?	7ss�-;M�(4E)�M�)E-	�-M�0E-	�1M�'G�7M�G	�M�
G	�;M�D"L8�*M�8M�M�M�Mc���tjd��}d}tj��5}t	|d|��}t|��\}}}||dfz}tr;td|��td��tt|����|�	|�
d��|��t|d|d	��\}	}
t|	��\}}}||
dfz}tr;td|��td��tt|����|�	|�
d��|��ddd��dS#1swxYwYdS)
Nz�                    class Test:
                        ">>> 'line 2'"
                        pass

                    import doctest
                    doctest.testmod()
                    zFile "%s", line 2, in %s�scriptz
__main__.Testz
Expected linezGot stdout:�utf-8rA�__main__.py)�textwrap�dedentrrBrrrr�ascii�assertIn�encoder)r9rM�patternrNr��rc�out�err�expectedrQrRs           r(�test_doctest_main_issue4197z+ZipSupportTests.test_doctest_main_issue4197�s����?�$����-��
�
�
!�
!�	9�Q�%�a��8�<�<�K�+�K�8�8�L�B��S��+��!?�?�H��
#����1�1�1��}�%�%�%��u�S�z�z�"�"�"��M�M�(�/�/�'�2�2�C�8�8�8�!0��J�0;�]�"L�"L��H�h�+�H�5�5�L�B��S��(�O�!<�<�H��
#����1�1�1��}�%�%�%��u�S�z�z�"�"�"��M�M�(�/�/�'�2�2�C�8�8�8�#	9�	9�	9�	9�	9�	9�	9�	9�	9�	9�	9�	9����	9�	9�	9�	9�	9�	9s�D1E(�(E,�/E,c���tjd��}tj��5}t	|d|��}t|��}|j�d��t|��}|�	tj�|�
d����|��t|d|d��\}}t|��}|j�d��t|��}|�	tj�|�
d����|��ddd��dS#1swxYwYdS)Nz�                    def f():
                        pass

                    import pdb
                    pdb.Pdb(nosigint=True).runcall(f)
                    r�sl
r�rAr�)r�r�rrBrr�stdin�writerr�rCr4�normcaser�r)r9rMrNr��p�datarQrRs        r(�test_pdb_issue4201z"ZipSupportTests.test_pdb_issue4201�s����?�$�����
�
!�
!�
	L�Q�%�a��8�<�<�K��[�)�)�A�
�G�M�M�&�!�!�!��q�>�>�D��M�M�"�'�*�*�;�+=�+=�g�+F�+F�G�G��N�N�N�!0��J�0;�]�"L�"L��H�h��X�&�&�A�
�G�M�M�&�!�!�!��q�>�>�D��M�M�"�'�*�*�8�?�?�7�+C�+C�D�D�d�K�K�K�
	L�
	L�
	L�
	L�
	L�
	L�
	L�
	L�
	L�
	L�
	L�
	L����
	L�
	L�
	L�
	L�
	L�
	Ls�D#E�E�EN)	rrrr:r=rSr�r�r��r;r(r+r+8sw������(�(�(�(�(�(�+�+�+� Y7�Y7�Y7�v9�9�9�:L�L�L�L�Lr;r+c�B�tj���dSr-)rr�
reap_childrenr�r;r(�tearDownModuler��s���L��� � � � � r;�__main__)�test.supportrrC�os.pathr3r�r^r0rrIr.�unittestr�test.support.script_helperrrrrrrrr	r
rrr)�TestCaser+r�r�mainr�r;r(�<module>r�s���
����	�	�	�	�����
�
�
�
�����������������������������"�"�"�"�"�"�F�F�F�F�F�F�F�F�F�F�F�F�F�F��,�
��0�0�0�0�0�0�0�0�0�0�0�0����(tL�tL�tL�tL�tL�h�'�tL�tL�tL�n!�!�!��z����H�M�O�O�O�O�O��r;