HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/test/__pycache__/test_zipimport_support.cpython-37.opt-1.pyc
B

��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�}yd|j|jf}Wntk
rH|j}YnXx |�|||�D]}|�	|�qZW|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�7/usr/local/lib/python3.7/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��dS)N)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�|�Wdt
jd=XWdQRXdS)Nzdef foo(): pass
�__init__�zip_pkg�test_zipr)rr�temp_dirr�osr&�join�basenamer�remover%�insertr.ZassertEqual�inspect�	getsourceZfoo�modules)r*�test_src�dZ	init_nameZname_in_zip�zip_name�run_namer.rrr� test_inspect_getsource_issue4223Ns
z0ZipSupportTests.test_inspect_getsource_issue4223cCst�t�}|�dd�}|�dd�}|�dd�}i}xLtttgD]>}t�|�}|�dd�}|j�d�d}|�d	d
�}|||<q>Wt	j
����v}t|d|�}t
|d|�\}}	t�|d�}
x$|��D]\}}|
�|d
|�q�W|
��t�rt�|d�}td|�|��|��t�|�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}x|
D]}t7||��q�WWdtj8d=XWdQRXdS)Nzfrom test import test_doctestz*import test_zipped_doctest as test_doctestztest.test_doctest�test_zipped_doctestztest.sample_doctestZsample_zipped_doctest�.���Zsample_Zsample_zipped_r/�az.py�rzContents of %r:r)9r6r7r�replacerr	r
r�splitrrr0rr�zipfileZZipFile�itemsZwritestr�closerrZprintdirr1r4r%r&r5r>ZSampleClassZNestedClassr-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_reportflagsrr8)r*r9Zsample_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�|�WdQRXdS)
Nz�                    class Test:
                        ">>> 'line 2'"
                        pass

                    import doctest
                    doctest.testmod()
                    zFile "%s", line 2, in %s�scriptz
__main__.Testz
Expected linezGot stdout:zutf-8r/z__main__.py)
�textwrap�dedentrrr0rrrr�ascii�assertIn�encoder)r*r9�patternr:rLZrc�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��|�WdQRXdS)Nz�                    def f():
                        pass

                    import pdb
                    pdb.Pdb(nosigint=True).runcall(f)
                    rOsl
zutf-8r/z__main__.py)rPrQrrr0rr�stdin�writerrSr1r&�normcaserTr)r*r9r:rL�p�datar;r<rrr�test_pdb_issue4201�sz"ZipSupportTests.test_pdb_issue4201N)	rr
rr+r,r=rNrXr^rrrrr7s	]rcCstj��dS)N)rrZ
reap_childrenrrrr�tearDownModule�sr_�__main__)Ztest.supportrr1Zos.pathr%rPrEr"rr6r ZunittestZtest.support.script_helperrrrrrrrrrr	r
rZTestCaserr_r�mainrrrr�<module>s&: