Your IP : 216.73.216.213


Current Path : /opt/alt/python39/lib64/python3.9/test/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/test/__pycache__/test_doctest.cpython-39.opt-2.pyc

a

XC?h��@sddlmZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZdd�Z
Gdd�d�ZGdd�de�ZGd	d
�d
�Zdd�Zd
d�ZGdd�d�ZGdd�de	j�Zdd�ZGdd�d�Zdd�Zdd�Zeed��re���sdd�Zdd�Zd d!�Zd"d#�Z d$d%�Z!Gd&d'�d'�Z"e"d(d)��Z#d*d+�Z$d,d-�Z%Gd.d/�d/ej&j'ej&j(�Z)Gd0d1�d1�Z*ej+d2d3��Z,d4d5�Z-d6d7�Z.ze�/d8�Wne0�y�Yn
0d9d:�Z1d;d<�Z2d=d>�Z3d?d@�Z4dAdB�Z5dCdD�Z6e7dEk�rdFej8v�re6dG�ne	�9�dS)H�)�supportNcCs||S�N���vrr�6/opt/alt/python39/lib64/python3.9/test/test_doctest.py�sample_funcs	rc@sreZdZdd�Zdd�Zdd�Zdd�Zee�Zd	d
�Ze	e�Ze
edd�Zd
Ze	e
dd���Z
Gdd�d�ZdS)�SampleClasscCs
||_dSr��val��selfrrrr�__init__4szSampleClass.__init__cCst|j|j�Sr)r	r�r
rrr�double;szSampleClass.doublecCs|jSrr
rrrr�getBszSampleClass.getcCs|dS)N�rrrrr�a_staticmethodIszSampleClass.a_staticmethodcCs|dS)N�r)�clsrrrr�
a_classmethodQszSampleClass.a_classmethodzB
        >>> print(SampleClass(22).a_property)
        22
        )�doc�*cCs|jSr)�a_class_attribute)rrrr�a_classmethod_propertybsz"SampleClass.a_classmethod_propertyc@s&eZdZd	dd�Zdd�Zdd�ZdS)
zSampleClass.NestedClassrcCs
||_dSrr
rrrrrrsz SampleClass.NestedClass.__init__cCst�|j|j�Sr)r	�NestedClassrrrrr�squarexszSampleClass.NestedClass.squarecCs|jSrr
rrrrrzszSampleClass.NestedClass.getN)r)�__name__�
__module__�__qualname__rrrrrrrrks
rN)rrrrrrr�staticmethodr�classmethod�propertyZ
a_propertyrrrrrrrr	$sr	c@s$eZdZdd�Zdd�Zdd�ZdS)�SampleNewStyleClasscCs
||_dSrr
rrrrr�szSampleNewStyleClass.__init__cCst|j|j�Sr)r#rrrrrr�szSampleNewStyleClass.doublecCs|jSrr
rrrrr�szSampleNewStyleClass.getN)rrrrrrrrrrr#}sr#c@seZdZdd�Zdd�ZdS)�
_FakeInputcCs
||_dSr)�lines)r
r%rrrr�sz_FakeInput.__init__cCs|j�d�}t|�|dS)Nr�
)r%�pop�print)r
�linerrr�readline�sz_FakeInput.readlineN)rrrrr*rrrrr$�sr$cCsdSrrrrrr�test_Example��r+cCsdSrrrrrr�test_DocTest)r,r-c@s"eZdZdd�Zejrdd�ZdS)�test_DocTestFindercCsdSrrrrrr�basics�r,ztest_DocTestFinder.basicscCsdSrrrrrr�non_Python_modules�r,z%test_DocTestFinder.non_Python_modulesN)rrrr/�int�__doc__r0rrrrr.�srr.c@seZdZdd�ZdS)�TestDocTestFinderc
Cs�d}t����}tj�||�}t�|�tj�|�z"t�	|�}Wt
�|�tj��nt
�|�tj��0t
jdd�}t
jdd�}|�t|�|��d�|�t|�|��d�Wd�n1s�0YdS)NZdoctest_empty_pkgF)Z
exclude_emptyTrr)�tempfileZTemporaryDirectory�os�path�join�mkdir�sys�append�	importlib�
import_modulerZforgetr'�doctestZ
DocTestFinderZassertEqual�len�find)r
Zpkg_nameZ
parent_dirZpkg_dir�modZinclude_empty_finderZexclude_empty_finderrrr�test_empty_namespace_package�s


�
z.TestDocTestFinder.test_empty_namespace_packageN)rrrrArrrrr3�sr3cCsdSrrrrrr�test_DocTestParser�r,rBc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�test_DocTestRunnercCsdSrrrrrrr/r,ztest_DocTestRunner.basicscCsdSrrrrrr�verbose_flagPr,ztest_DocTestRunner.verbose_flagcCsdSrrrrrr�
exceptions�r,ztest_DocTestRunner.exceptionscCsdSrrrrrr�displayhook�r,ztest_DocTestRunner.displayhookcCsdSrrrrrr�optionflags�r,ztest_DocTestRunner.optionflagscCsdSrrrrrr�option_directivesOr,z$test_DocTestRunner.option_directivesN)	rrrr/rDrErFrGrHrrrrrCs=Co4rCcCsdSrrrrrr�test_testsource'r,rIcCsdSrrrrrr�
test_debugOr,rJ�gettracecCsdSrrrrrr�test_pdb_set_tracensrLcCsdSrrrrrr�test_pdb_set_trace_nested�srMcCsdSrrrrrr�test_DocTestSuiteJsrNcCsdSrrrrrr�test_DocFileSuite�srOcCsdSrrrrrr�test_trailing_space_in_teste	srPc@seZdZdd�Zdd�ZdS)�WrappercCs||_t�||�dSr)�func�	functools�update_wrapper)r
rRrrrro	szWrapper.__init__cOs|j|i|��dSr)rR)r
�args�kwargsrrr�__call__s	szWrapper.__call__N)rrrrrWrrrrrQn	srQcCsdSrrrrrr�test_look_in_unwrappedv	srXcCsdSrrrrrr�test_unittest_reportflags	srYcCsdSrrrrrr�
test_testfile�	r,rZc@seZdZddd�Zdd�ZdS)�TestImporterNcCstjj|||d�S)N)�loader)r;�util�spec_from_file_location)r
�fullnamer6�targetrrr�	find_spec�
szTestImporter.find_speccCs8t|dd��}|��Wd�S1s*0YdS)N�rb)�mode)�open�read)r
r6�frrr�get_data�
szTestImporter.get_data)N)rrrrargrrrrr[~
s
r[c@seZdZdd�Zdd�ZdS)�TestHookcCsltjdd�|_tjdd�|_tjdd�|_tj�|�tj��tj�	�|_
t�|_tj�|j�dSr)
r9r6�sys_path�	meta_path�
path_hooksr:�path_importer_cache�clear�modules�copy�modules_beforer[Zimporter)r
�pathdirrrrr�
s
zTestHook.__init__cCsV|jtjdd�<|jtjdd�<|jtjdd�<tj��tj��tj�|j	�dSr)
rir9r6rjrkrlrmrn�updaterprrrr�remove�
s

zTestHook.removeN)rrrrrsrrrrrh�
s
rhccs*t|�}z|VW|��n
|��0dSr)rhrs)rq�hookrrr�	test_hook�
srucCsdSrrrrrr�test_lineendings�
r,rvcCsdSrrrrrr�test_testmod�
r,rwufoo-bär@baz.pycCsdSrrrrrr�test_unicode�
r,rxcCsdSrrrrrr�test_CLIr,rycCsdSrrrrrr�%test_no_trailing_whitespace_stripping�srzcCsdSrrrrrr�$test_run_doctestsuite_multiple_times&sr{cCs"|�t�t��|�t���|Sr)ZaddTestr=ZDocTestSuite)r\Ztests�patternrrr�
load_tests6sr}cCsPt�d�}|jtjtjgddd�}|�d�|��}td�|j	dd|d�dS)	N�tracerr)Z
ignoredirsr~�countztest_main()zWriting coverage results...T)Zshow_missingZsummary�coverdir)
rr<ZTracer9�base_prefix�base_exec_prefix�runZresultsr(Z
write_results)r�r~Ztracer�rrrr�
test_coverage<s
�
�r��__main__z-cz/tmp/doctest.cover):�testrr=rSr5r9r;�
importlib.abc�importlib.utilZunittestr4Zshutil�
contextlibrr	�objectr#r$r+r-r.ZTestCaser3rBrCrIrJ�hasattrrKrLrMrNrOrPrQrXrYrZ�abc�MetaPathFinder�ResourceLoaderr[rh�contextmanagerrurvrw�fsencode�UnicodeEncodeErrorrxryrzr{r}r�r�argv�mainrrrr�<module>s�	Y y7(Vu'	
O1	
Hd*