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.10/test/__pycache__/test_zipimport_support.cpython-310.opt-1.pyc
o

�i�)�@s�ddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlmZddl
mZmZmZmZmZejjZddlmZmZmZmZdd�ZGdd�dej�Zd	d
�Zedkrke��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_docstringscCs�tjtdd�}tjtd�}z
d|j|jf}Wnty#|j}Ynw|�|||�D]}|�	|�q+|j
|j}}|rFtj
�d||f��trQtd|j|f�||fS)NF)�verboseZrecurse)rz%s.%sz%d of %d doctests failedz,doctest (%s) ... %d tests with zero failures)�doctestZ
DocTestFinderrZ
DocTestRunner�
__module__�__qualname__�AttributeError�__name__�find�runZfailuresZtries�test�supportZ
TestFailed�print)�obj�module�finderZrunner�nameZexample�f�t�r�8/usr/local/lib/python3.10/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�setUpAs
zZipSupportTests.setUpcCs>|jtjdd�<|jtjdd�<|jtjdd�<tj��dSr!)r(r'r)r*r+r&r,rrr�tearDownIszZipSupportTests.tearDownc	Cs�d}t���I}t|d|�}tj�dtj�|��}t|d||�\}}t�|�t	j�
d|�ddl}z|�t
�|j�|�Wt	jd=nt	jd=wWd�dS1sRwYdS)Nzdef foo(): pass
�__init__�zip_pkg�test_zipr)r�temp_dirr�osr(�join�basenamer�remover'�insertr1ZassertEqual�inspect�	getsourceZfoo�modules)r-�test_src�dZ	init_nameZname_in_zip�zip_name�run_namer1rrr� test_inspect_getsource_issue4223Os 

��
"�z0ZipSupportTests.test_inspect_getsource_issue4223cCsHt�t�}|�dd�}|�dd�}|�dd�}i}tttfD]}t�|�}|�dd�}|j�d�d}|�d	d
�}|||<qt	�
���}t|d|�}t|d|�\}}	t
�|d��}
|��D]\}}|
�|d
|�q\Wd�n1sswYtr�t
�|d��}td|�|��Wd�n1s�wYt�|�tj�d|�ddl}za|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]}t5||�q�Wtj6d=ntj6d=wWd�dS1�swYdS)Nzfrom test import test_doctestz*import test_zipped_doctest as test_doctestztest.test_doctest�test_zipped_doctestztest.sample_doctestZsample_zipped_doctest�.���Zsample_Zsample_zipped_r2�az.py�rzContents of %r:r)7r9r:r�replacer	r
rr�splitrr3rr�zipfile�ZipFile�itemsZwritestrrrZprintdirr4r7r'r(r8rAZSampleClassZNestedClassr0Z
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_reportflagsrr;)r-r<Zsample_sources�mod�srcZmod_namer=�script_namer>r?�zZzip_filerAZknown_good_testsZfail_due_to_missing_data_filesrrrr�test_doctest_issue4197_s�
����


����
�
	� ��$�z&ZipSupportTests.test_doctest_issue4197cCs�t�d�}d}t���f}t|d|�}t|�\}}}||df}tr0td|�td�tt|��|�	|�
d�|�t|d|d	�\}	}
t|	�\}}}||
df}tr`td|�td�tt|��|�	|�
d�|�Wd�dS1stwYdS)
Nz�                    class Test:
                        ">>> 'line 2'"
                        pass

                    import doctest
                    doctest.testmod()
                    zFile "%s", line 2, in %s�scriptz
__main__.Testz
Expected linezGot stdout:�utf-8r2�__main__.py)�textwrap�dedentrr3rrrr�ascii�assertIn�encoder)r-r<�patternr=rO�rc�out�errZexpectedr>r?rrr�test_doctest_main_issue4197�s,


�
"�z+ZipSupportTests.test_doctest_main_issue4197cCs�t�d�}t���N}t|d|�}t|�}|j�d�t|�}|�	t
j�|�
d��|�t|d|d�\}}t|�}|j�d�t|�}|�	t
j�|�
d��|�Wd�dS1sZwYdS)Nz�                    def f():
                        pass

                    import pdb
                    pdb.Pdb(nosigint=True).runcall(f)
                    rRsl
rSr2rT)rUrVrr3rr�stdin�writerrXr4r(�normcaserYr)r-r<r=rO�p�datar>r?rrr�test_pdb_issue4201�s

�"�z"ZipSupportTests.test_pdb_issue4201N)	rrrr.r/r@rQr^rdrrrrr 8s	[r cCstj��dSr!)rr�
reap_childrenrrrr�tearDownModule�srf�__main__)Ztest.supportrr4Zos.pathr'rUrHr$r
r9r"ZunittestrZtest.support.script_helperrrrrrrrrr	r
rrZTestCaser rfr�mainrrrr�<module>s,8�