Your IP : 216.73.216.196


Current Path : /opt/alt/python310/lib64/python3.10/test/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/test/__pycache__/test_doctest.cpython-310.opt-2.pyc

o

0�ih��@s>	ddlmZddlmZddlmZddlZddlZddlZddlZddl	Z	ddl
Z	ddlZ	ddlZddl
Z
ddlZddlZddlZdd�ZGdd�d�ZGd	d
�d
e�ZGdd�d�Zd
d�Zdd�ZGdd�d�ZGdd�dej�Zdd�ZGdd�d�Zdd�Zdd�Zeed�r�e� �s�dd�Z!d d!�Z"d"d#�Z#d$d%�Z$d&d'�Z%Gd(d)�d)�Z&e&d*d+��Z'd,d-�Z(d.d/�Z)Gd0d1�d1e	j*j+e	j*j,�Z-Gd2d3�d3�Z.ej/d4d5��Z0d6d7�Z1d8d9�Z2ze�3d:�Wn	e4y�Ynwd;d<�Z5d=d>�Z6d?d@�Z7dAdB�Z8dCdD�Z9dEdF�Z:e;dGk�rdHej<v�re:dI�dSe�=�dSdS)J�)�support)�
import_helper)�	os_helperNcCs
	||S�N���vrr�8/opt/alt/python310/lib64/python3.10/test/test_doctest.py�sample_funcsr
c@steZdZ	dd�Zdd�Zdd�Zdd�Zee�Zd	d
�Ze	e�Ze
edd�Zd
Ze	e
dd���Z
Gdd�d�ZdS)�SampleClasscC�	||_dSr��val��selfrrrr	�__init__8�
zSampleClass.__init__cC�	t|j|j�Sr)rr�rrrr	�double?�zSampleClass.doublecC�	|jSrr
rrrr	�getF�zSampleClass.getcCs
	|dS)N�rrrrr	�a_staticmethodMszSampleClass.a_staticmethodcCs
	|dS)N�r)�clsrrrr	�
a_classmethodUszSampleClass.a_classmethodzB
        >>> print(SampleClass(22).a_property)
        22
        )�doc�*cCrr)�a_class_attribute)rrrr	�a_classmethod_propertyfsz"SampleClass.a_classmethod_propertyc@s(eZdZ	d	dd�Zdd�Zdd�ZdS)
zSampleClass.NestedClassrcCrrr
rrrr	rvrz SampleClass.NestedClass.__init__cCst�|j|j�Sr)r�NestedClassrrrrr	�square|�zSampleClass.NestedClass.squarecCs|jSrr
rrrr	r~szSampleClass.NestedClass.getN)r)�__name__�
__module__�__qualname__rr$rrrrr	r#os

r#N)r&r'r(rrrr�staticmethodr�classmethod�propertyZ
a_propertyr!r"r#rrrr	r(src@s&eZdZ	dd�Zdd�Zdd�ZdS)�SampleNewStyleClasscCrrr
rrrr	r�rzSampleNewStyleClass.__init__cCrr)r,rrrrr	r�rzSampleNewStyleClass.doublecCrrr
rrrr	r�rzSampleNewStyleClass.getN)r&r'r(rrrrrrr	r,�s
r,c@seZdZ	dd�Zdd�ZdS)�
_FakeInputcCs
||_dSr)�lines)rr.rrr	r�s
z_FakeInput.__init__cCs|j�d�}t|�|dS)Nr�
)r.�pop�print)r�linerrr	�readline�sz_FakeInput.readlineN)r&r'r(rr3rrrr	r-�sr-cC�dSrrrrrr	�test_Example��r5cCr4rrrrrr	�test_DocTest-r6r7c@s&eZdZdd�Zejrdd�ZdSdS)�test_DocTestFindercCr4rrrrrr	�basics�r6ztest_DocTestFinder.basicscCr4rrrrrr	�non_Python_modules�r6z%test_DocTestFinder.non_Python_modulesN)r&r'r(r9�int�__doc__r:rrrr	r8�s�r8c@�eZdZdd�Zdd�ZdS)�TestDocTestFinderc
CsZddlm}t�d�}||jd<z
tj|dd�WdSty,}zt�d�|�d}~ww)Nr)�callZdummyZinject_callT)�	verbosityzDoctest unwrap failed)	Z
unittest.mockr?�types�
ModuleType�__dict__rZrun_doctest�
ValueErrorZ
TestFailed)rr?Zdummy_module�errr	�test_issue35753�s

��z!TestDocTestFinder.test_issue35753c
Cs�d}t���Z}tj�||�}t�|�tj�|�zt�	|�}Wt
�|�tj��nt
�|�tj��wt
jdd�}t
jdd�}|�t|�|��d�|�t|�|��d�Wd�dS1scwYdS)NZdoctest_empty_pkgF)Z
exclude_emptyTrr)�tempfileZTemporaryDirectory�os�path�join�mkdir�sys�append�	importlib�
import_modulerZforgetr0�doctestZ
DocTestFinderZassertEqual�len�find)rZpkg_nameZ
parent_dirZpkg_dir�modZinclude_empty_finderZexclude_empty_finderrrr	�test_empty_namespace_package�s 



�"�z.TestDocTestFinder.test_empty_namespace_packageN)r&r'r(rFrTrrrr	r>�sr>cCr4rrrrrr	�test_DocTestParserr6rUc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�test_DocTestRunnercCr4rrrrrr	r98r6ztest_DocTestRunner.basicscCr4rrrrrr	�verbose_flagur6ztest_DocTestRunner.verbose_flagcCr4rrrrrr	�
exceptions�r6ztest_DocTestRunner.exceptionscCr4rrrrrr	�displayhook�r6ztest_DocTestRunner.displayhookcCr4rrrrrr	�optionflags�r6ztest_DocTestRunner.optionflagscCr4rrrrrr	�option_directivestr6z$test_DocTestRunner.option_directivesN)	r&r'r(r9rWrXrYrZr[rrrr	rV7s=Co4rVcCr4rrrrrr	�test_testsourceLr6r\cCr4rrrrrr	�
test_debugtr6r]�gettracecCr4rrrrrr	�test_pdb_set_trace��r_cCr4rrrrrr	�test_pdb_set_trace_nestedr`racCr4rrrrrr	�test_DocTestSuiteor`rbcCr4rrrrrr	�test_DocFileSuite�r`rccCr4rrrrrr	�test_trailing_space_in_test�	r`rdc@r=)�WrappercCs||_t�||�dSr)�func�	functools�update_wrapper)rrfrrr	r�	szWrapper.__init__cOs|j|i|��dSr)rf)r�args�kwargsrrr	�__call__�	szWrapper.__call__N)r&r'r(rrkrrrr	re�	srecCr4rrrrrr	�test_look_in_unwrapped�	srlcCr4rrrrrr	�test_unittest_reportflags�	r`rmcCr4rrrrrr	�
test_testfile�	r6rnc@seZdZddd�Zdd�ZdS)�TestImporterNcCstjj|||d�S)N)�loader)rN�util�spec_from_file_location)r�fullnamerI�targetrrr	�	find_spec�
r%zTestImporter.find_speccCs8t|dd��}|��Wd�S1swYdS)N�rb)�mode)�open�read)rrI�frrr	�get_data�
s$�zTestImporter.get_datar)r&r'r(rur{rrrr	ro�
s
roc@r=)�TestHookcCsltjdd�|_tjdd�|_tjdd�|_tj�|�tj��tj�	�|_
t�|_tj�|j�dSr)
rLrI�sys_path�	meta_path�
path_hooksrM�path_importer_cache�clear�modules�copy�modules_beforeroZimporter)r�pathdirrrr	r�
s
zTestHook.__init__cCsV|jtjdd�<|jtjdd�<|jtjdd�<tj��tj��tj�|j	�dSr)
r}rLrIr~rr�r�r��updater�rrrr	�remove�
s

zTestHook.removeN)r&r'r(rr�rrrr	r|�
s
r|ccs*�t|�}z
|VW|��dS|��wr)r|r�)r��hookrrr	�	test_hook�
s
�r�cCr4rrrrrr	�test_lineendings�
r6r�cCr4rrrrrr	�test_testmodr6r�ufoo-bär@baz.pycCr4rrrrrr	�test_unicode#r6r�cCr4rrrrrr	�test_CLI>r6r�cCs	dSrrrrrr	�%test_no_trailing_whitespace_stripping$sr�cCr4rrrrrr	�$test_run_doctestsuite_multiple_timesNr`r�cCs"|�t�t��|�t���|Sr)ZaddTestrPZDocTestSuite)rpZtests�patternrrr	�
load_tests^sr�cCsPt�d�}|jtjtjgddd�}|�d�|��}td�|j	dd|d�dS)	N�tracerr)Z
ignoredirsr��countztest_main()zWriting coverage results...T)Zshow_missingZsummary�coverdir)
rrOZTracerL�base_prefix�base_exec_prefix�runZresultsr1Z
write_results)r�r�Ztracer�rrrr	�
test_coverageds
�

�r��__main__z-cz/tmp/doctest.cover)>�testrZtest.supportrrrPrgrHrLrNZ
importlib.abc�importlib.utilZunittestrGZshutilrA�
contextlibr
r�objectr,r-r5r7r8ZTestCaser>rUrVr\r]�hasattrr^r_rarbrcrdrerlrmrn�abcZMetaPathFinderZResourceLoaderror|�contextmanagerr�r�r��fsencode�UnicodeEncodeErrorr�r�r�r�r�r�r&�argv�mainrrrr	�<module>s�
Y y0 7(Vu'	
O1	
H�g*
�