Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /opt/cppython/lib/python3.8/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : //opt/cppython/lib/python3.8/test/__pycache__/test_zipimport_support.cpython-38.pyc
U

>��g�)�@s�ddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
Z
mZmZmZmZejjZddlmZmZmZmZdd�ZGdd�dej�Zdd	�Zed
kr�e��dS)�N)�spawn_python�kill_python�assert_python_ok�make_script�make_zip_script)�test_doctest�sample_doctest�sample_doctest_no_doctests�sample_doctest_no_docstringscCs�tjtdd�}tjtd�}zd|j|jf}Wntk
rH|j}YnX|�|||�D]}|�	|�qX|j
|j}}|r�tj
�d||f��tr�td|j|f�||fS)NF)�verboseZrecurse)rz%s.%sz%d of %d doctests failedz,doctest (%s) ... %d tests with zero failures)�doctestZ
DocTestFinderrZ
DocTestRunner�
__module__�__qualname__�AttributeError�__name__�find�runZfailuresZtries�test�supportZ
TestFailed�print)�obj�module�finderZrunner�nameZexample�f�t�r�:/opt/cppython/lib/python3.8/test/test_zipimport_support.py�_run_object_doctest#src@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�ZipSupportTestscCsPt��tj��tjdd�|_tjdd�|_tjdd�|_tj	��dS�N)
�	linecache�
clearcache�	zipimport�_zip_directory_cache�clear�sys�path�	meta_path�
path_hooks�path_importer_cache��selfrrr�setUp@s
zZipSupportTests.setUpcCs>|jtjdd�<|jtjdd�<|jtjdd�<tj��dSr )r'r&r(r)r*r%r+rrr�tearDownHszZipSupportTests.tearDownc	Cs�d}tj���~}t|d|�}tj�dtj�|��}t|d||�\}}t�	|�t
j�d|�ddl}z|�t�|j�|�W5t
j
d=XW5QRXdS)Nzdef foo(): pass
�__init__�zip_pkg�test_zipr)rr�temp_dirr�osr'�join�basenamer�remover&�insertr0�modulesZassertEqual�inspect�	getsourceZfoo)r,�test_src�dZ	init_nameZname_in_zip�zip_name�run_namer0rrr� test_inspect_getsource_issue4223Ns 
��
z0ZipSupportTests.test_inspect_getsource_issue4223cCst�t�}|�dd�}|�dd�}|�dd�}i}tttfD]>}t�|�}|�dd�}|j�d�d}|�d	d
�}|||<q<t	j
����v}t|d|�}t
|d|�\}}	t�|d��(}
|��D]\}}|
�|d
|�q�W5QRXt�rt�|d��}td|�|��W5QRXt�|�tj�d|�ddl}z�|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/|j0|j1|j2|j3g}
|j4|j5|j6g}|
D]}t7||��q�W5tjd=XW5QRXdS)Nzfrom test import test_doctestz*import test_zipped_doctest as test_doctestztest.test_doctest�test_zipped_doctestztest.sample_doctestZsample_zipped_doctest�.���Zsample_Zsample_zipped_r1�az.py�rzContents of %r:r)8r9r:r�replacerr	r
r�splitrrr2rr�zipfile�ZipFile�itemsZwritestrrrZprintdirr3r6r&r'r7r@r8ZSampleClassZNestedClassr/Z
a_classmethodZ
a_propertyZa_staticmethodZdouble�getZSampleNewStyleClassZsample_funcZtest_DocTestZtest_DocTestParserZtest_DocTestRunnerZbasics�
exceptionsZoption_directivesZoptionflagsZverbose_flagZtest_ExampleZ
test_debugZtest_testsourceZtest_trailing_space_in_testZtest_DocTestSuiteZtest_DocTestFinderZtest_DocFileSuiteZ
test_testfileZtest_unittest_reportflagsr)r,r;Zsample_sources�mod�srcZmod_namer<�script_namer=r>�zZzip_filer@Zknown_good_testsZfail_due_to_missing_data_filesrrrr�test_doctest_issue4197^s�
����

��
	� �z&ZipSupportTests.test_doctest_issue4197c	Cs�t�d�}d}tj����}t|d|�}t|�\}}}||df}trbtd|�td�tt	|��|�
|�d�|�t|d|d	�\}	}
t|	�\}}}||
df}tr�td|�td�tt	|��|�
|�d�|�W5QRXdS)
Nz�                    class Test:
                        ">>> 'line 2'"
                        pass

                    import doctest
                    doctest.testmod()
                    zFile "%s", line 2, in %s�scriptz
__main__.Testz
Expected linezGot stdout:�utf-8r1�__main__.py)
�textwrap�dedentrrr2rrrr�ascii�assertIn�encoder)r,r;�patternr<rN�rc�out�errZexpectedr=r>rrr�test_doctest_main_issue4197�s,

�
z+ZipSupportTests.test_doctest_main_issue4197c	Cs�t�d�}tj����}t|d|�}t|�}|j�d�t	|�}|�
tj�
|�d��|�t|d|d�\}}t|�}|j�d�t	|�}|�
tj�
|�d��|�W5QRXdS)Nz�                    def f():
                        pass

                    import pdb
                    pdb.Pdb(nosigint=True).runcall(f)
                    rQsl
rRr1rS)rTrUrrr2rr�stdin�writerrWr3r'�normcaserXr)r,r;r<rN�p�datar=r>rrr�test_pdb_issue4201�s
�z"ZipSupportTests.test_pdb_issue4201N)	rr
rr-r.r?rPr]rcrrrrr7s	[rcCstj��dSr )rr�
reap_childrenrrrr�tearDownModule�sre�__main__)Ztest.supportrr3Zos.pathr&rTrGr#rr9r!ZunittestZtest.support.script_helperrrrrrrrrrr	r
rZTestCaserrer�mainrrrr�<module>s&8

F1le Man4ger