403Webshell
Server IP : 118.27.122.248  /  Your IP : 216.73.217.130
Web Server : Apache
System : Linux web0264.sh.tyo1 4.18.0-553.79.1.lve.el7h.x86_64 #1 SMP Wed Oct 15 16:34:46 UTC 2025 x86_64
User : c9415830 ( 11735)
PHP Version : 8.4.17
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python36/lib64/python3.6/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python36/lib64/python3.6/test/__pycache__/test_trace.cpython-36.opt-2.pyc
3

�
�^�?�@s~ddlZddlZddlmZmZmZmZddlmZm	Z	ddl
Z
ddlZddlZddlm
Z
ddlmZdd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�ZGdd�de�ZGd d!�d!ej�ZGd"d#�d#ej�Z Gd$d%�d%ej�Z!Gd&d'�d'ej�Z"Gd(d)�d)ej�Z#Gd*d+�d+ej�Z$Gd,d-�d-ej�Z%Gd.d/�d/ej�Z&e'd0k�rzej(�dS)1�N)�TESTFN�rmtree�unlink�captured_stdout)�assert_python_ok�assert_python_failure)�Trace)�testmodcCs|jd�r|dd�}|S)Nz.pyc����)�endswith)�filename�r�//opt/alt/python36/lib64/python3.6/test_trace.py�
fix_ext_pys
rcCs$tjjtjjt��d}tt�|fS)Nr)�os�path�splitext�basename�__file__r)�modnamerrr�my_file_and_modnamesrcCs|jjS)N)�__code__�co_firstlineno)�funcrrr�get_firstlinenosrcCs|}|}||}|S)Nr)�x�y�a�b�crrr�traced_func_linear$sr!cCs"|}xtd�D]}||7}qW|S)N�)�range)rrr �irrr�traced_func_loop*sr%cCs||tjd�S)Nr
)r	r)rrrrr�traced_func_importing0sr&cCst||�}||S)N)r!)rr rrr�traced_func_simple_caller3s
r'cCst|�}|t||�7}|S)N)r'r&)r�krrr�traced_func_importing_caller7sr)ccs$d}xt|�D]}||VqWdS)Nr")r#)�numr r$rrr�traced_func_generator<sr+cCs"d}xtd�D]}||7}qWdS)Nr�
)r+)r(r$rrr�traced_func_calling_generatorAsr-cCs|dS)N�r)r*rrr�traced_doublerFsr/cCsd}dd�t|�D�}|S)Nr,cSsg|]}t|��qSr)r/)�.0r$rrr�
<listcomp>Ksz4traced_caller_list_comprehension.<locals>.<listcomp>)r#)r(Zmylistrrr� traced_caller_list_comprehensionIsr2c@s<eZdZdd�Zdd�Zdd�Zedd��Zed	d
��Z	dS)�TracedClasscCs
||_dS)N)r)�selfrrrr�__init__PszTracedClass.__init__cCs
|j|S)N)r)r4rrrr�inst_method_linearSszTracedClass.inst_method_linearcCs|j|�}|t||�S)N)r6r!)r4rr rrr�inst_method_callingVs
zTracedClass.inst_method_callingcCs|dS)Nr.r)�clsrrrr�class_method_linearZszTracedClass.class_method_linearcCs|dS)Nr.r)rrrr�static_method_linear^sz TracedClass.static_method_linearN)
�__name__�
__module__�__qualname__r5r6r7�classmethodr9�staticmethodr:rrrrr3Os
r3c@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�TestLineCountscCs2|jtjtj��tddddd�|_tt�|_dS)Nr
r)�count�trace�
countfuncs�countcallers)	�
addCleanup�sys�settrace�gettracer�tracerrr�my_py_filename)r4rrr�setUphszTestLineCounts.setUpcCsf|jjtdd�}|j|d�i}tt�}x$tdd�D]}d||j||f<q4W|j|jj�j|�dS)Nr.r"�r
)	rI�runfuncr!�assertEqualrr#rJ�results�counts)r4�result�expected�firstlinenor$rrr�test_traced_func_linearmsz&TestLineCounts.test_traced_func_linearc	Csl|jjtdd�tt�}|j|dfd|j|dfd|j|dfd|j|dfdi}|j|jj�j|�dS)Nr.�r
�r"�)rIrMr%rrJrNrOrP)r4rSrRrrr�test_traced_func_loopysz$TestLineCounts.test_traced_func_loopcCs^|jjtdd�tt�}|j|dfdttj�dfdttj�dfdi}|j|jj	�j
|�dS)Nr.r"r
rU)rIrMr&rrJrr	rrNrOrP)r4rSrRrrr�test_traced_func_importing�sz)TestLineCounts.test_traced_func_importingc
Cs�|jjt�tt�}tt�}|j|dfd|j|dfd|j|dfd|j|dfd|j|dfd|j|dfdi}|j|jj�j|�dS)Nr
r.�rUr,)	rIrMr-rr+rJrNrOrP)r4�firstlineno_callingZfirstlineno_genrRrrr�test_trace_func_generator�sz(TestLineCounts.test_trace_func_generatorc	Csp|jjt�tt�}tt�}|j|dfd|j|dfd|j|dfd|j|dfdi}|j|jj�j|�dS)Nr
r.�rUr,)	rIrMr2rr/rJrNrOrP)r4r[Zfirstlineno_calledrRrrr�test_trace_list_comprehension�sz,TestLineCounts.test_trace_list_comprehensioncCslxfdD]^}tddddd�}td�}t||�}|j|d�t|�}|j|dfdi}|j|j�j|�qWdS)Nr6r
r)rArBrCrD��)r6)	rr3�getattrrMrrJrNrOrP)r4ZmethnamerIZ
traced_obj�methodrSrRrrr�test_linear_methods�s

z"TestLineCounts.test_linear_methodsN)
r;r<r=rKrTrXrYr\r^rcrrrrr@fsr@c@seZdZdd�Zdd�ZdS)�TestRunExecCountscCs tt�|_|jtjtj��dS)N)rrrJrErFrGrH)r4rrrrK�s
zTestRunExecCounts.setUpc	Cs�tddddd�|_d}t|td�}|jj|t�t��tt�}|j	|dfd|j	|dfd|j	|dfd	|j	|d
fdi}x,|j
�D] }|j|jj�j
|||�q�WdS)Nr
r)rArBrCrDztraced_func_loop(2, 5)�execr.rVrUr"rW)rrI�compilerZrunctx�globals�varsrr%rJ�keysrNrOrP)r4�coderSrRr(rrr�test_exec_counts�sz"TestRunExecCounts.test_exec_countsN)r;r<r=rKrkrrrrrd�srdc@sNeZdZdd�Zdd�Zdd�Zdd�Zeje	e
d	�o<e
j�d
�dd��Zd
S)�	TestFuncscCs8|jtjtj��tdddd�|_t�|_tj�|_dS)Nrr
)rArBrC)	rErFrGrHrrIr�filemod�_saved_tracefunc)r4rrrrK�szTestFuncs.setUpcCs|jdk	rtj|j�dS)N)rnrFrG)r4rrr�tearDown�s
zTestFuncs.tearDowncCs>|jjtd�|jdd|jddi}|j|jj�j|�dS)Nr
r'r!)r')r!)rIrMr'rmrNrO�calledfuncs)r4rRrrr�test_simple_caller�s
zTestFuncs.test_simple_callercCsb|jjtd�|jdd|jd	d|jd
d|jddttj�ddfdi}|j|jj�j	|�dS)Nr
r'r!r)r&r	r)r')r!)r))r&)
rIrMr)rmrr	rrNrOrp)r4rRrrr�test_loop_caller_importing�s



z$TestFuncs.test_loop_caller_importingrHz3pre-existing trace function throws off measurementscCsRtd�}|jj|jd�|jdd|jdd|jddi}|j|jj�j|�dS)	Nr`r
�TracedClass.inst_method_calling�TracedClass.inst_method_linearr!)rs)rt)r!)r3rIrMr7rmrNrOrp)r4�objrRrrr�test_inst_method_calling�s

z"TestFuncs.test_inst_method_callingN)
r;r<r=rKrorqrr�unittest�skipIf�hasattrrFrHrvrrrrrl�s	rlc@s6eZdZdd�Zejeed�o$ej�d�dd��Z	dS)�TestCallerscCs.|jtjtj��tdddd�|_t�|_dS)Nrr
)rArBrD)rErFrGrHrrIrrm)r4rrrrK
szTestCallers.setUprHz3pre-existing trace function throws off measurementscCs�|jjtd�tjjtj�ddddf|jdfd|jd
|jdfd|jd|jdfd|jd|jdfd|jdt	t
j�d
dffdi}|j|jj�j
|�dS)Nr
rz.pyrBz
Trace.runfuncr)r'r!r&r	r)r))r')r!)r))r')r))r&)r&)rIrMr)rrrrBrrmrr	rNrOZcallers)r4rRrrrrrsz&TestCallers.test_loop_caller_importingN)
r;r<r=rKrwrxryrFrHrrrrrrrzsrzc@s>eZdZdd�Zdd�Zddd�Zdd	�Zd
d�Zdd
�ZdS)�TestCoveragecCs|jtjtj��dS)N)rErFrGrH)r4rrrrK(szTestCoverage.setUpcCstt�tt�dS)N)rrr)r4rrrro+szTestCoverage.tearDown�_import test.support, test.test_pprint;test.support.run_unittest(test.test_pprint.QueryTestCase)cCs&|j|�|j�}|jddtd�dS)NT)Zshow_missingZsummaryZcoverdir)ZrunrOZ
write_resultsr)r4rI�cmd�rrrr�	_coverage/s
zTestCoverage._coveragec
Csptjddd�}t��}|j|�WdQRX|j�}|jd|�|jd|�tjt�}|jd|�|jd|�dS)Nrr
)rBrAz	pprint.pyzcase.pyzpprint.coverzunittest.case.cover)	rBrrr�getvalue�assertInr�listdirr)r4rI�stdout�filesrrr�
test_coverage6s
zTestCoverage.test_coveragec
Csttjjtjjtj��}tjtjtj	|gddd�}t
��}|j|�WdQRXtjjt
�rptjt
�}|j|dg�dS)Nrr
)Z
ignoredirsrBrAz_importlib.cover)rr�normpath�dirnamerrBrrF�base_prefix�base_exec_prefixrr�existsrr�rN)r4ZlibpathrIr�r�rrr�test_coverage_ignoreAs
z!TestCoverage.test_coverage_ignorec

Cs�tjddd�}d}|tjkr$tj|=d}t��}|j||�WdQRX|jd�|j�i}x>|D]6}|j�dd�\}}}	t	|�t	|dd	��f||	<qbWtj
tj|j�}|j||�|j
||d
�dS)Nrr
)rBrAztest.tracedmodules.testmodz<import test.tracedmodules.testmod as t;t.func(0); t.func2();rUr"�dr)r"r�)rBrrF�modulesrr�seek�readline�split�intZ_fullmodnamerr�rN)
r4rIrr}r�Zcoverage�line�linesZcov�modulerrr�test_issue9936Ms 


 zTestCoverage.test_issue9936N)r|)	r;r<r=rKrorr�r�r�rrrrr{'s
r{c@seZdZdd�ZdS)�Test_IgnorecCs�tjj}tjddg|dd�g�}|j|jdd��|j|jdd��|j|jdd	��|j|j|ddd
�d��|j|j|dd�d
��|j|j|dd
�d��dS)Nrzy.zZfooZbarzx.pyzxy.pyZxyzy.pyrzbaz.pyZbazzz.py�z)rr�joinrBZ_Ignore�
assertTrue�namesZassertFalse)r4Zjn�ignorerrr�test_ignoredfszTest_Ignore.test_ignoredN)r;r<r=r�rrrrr�esr�c@s4eZdZdZdZdd�Zdd�Zdd�Zd	d
�ZdS)�TestCoverageCommandLineOutputztmp.pyz	tmp.coverc
Cs,t|jd��}|jtjd��WdQRXdS)N�wzc                x = 42
                if []:
                    print('unreachable')
            )�open�codefile�write�textwrap�dedent)r4�frrrrKwsz#TestCoverageCommandLineOutput.setUpcCst|j�t|j�dS)N)rr��	coverfile)r4rrrros
z&TestCoverageCommandLineOutput.tearDownc
Cs\dj�|jg}t|�\}}}|jtjj|j��t|j��}|j	|j
�d�WdQRXdS)Nz-m trace --countz<    1: x = 42
    1: if []:
           print('unreachable')
)r�r�rr�rrr�r�r�rN�read)r4�argv�statusr��stderrr�rrr�%test_cover_files_written_no_highlight�s
zCTestCoverageCommandLineOutput.test_cover_files_written_no_highlightcCsbdj�|jg}t|�\}}}|jtjj|j��t|j��}|j	|j
�tjd��WdQRXdS)Nz-m trace --count --missingzx                    1: x = 42
                    1: if []:
                >>>>>>     print('unreachable')
            )
r�r�rr�rrr�r�r�rNr�r�r�)r4r�r�r�r�r�rrr�'test_cover_files_written_with_highlight�szETestCoverageCommandLineOutput.test_cover_files_written_with_highlightN)	r;r<r=r�r�rKror�r�rrrrr�rsr�c@s$eZdZdd�Zdd�Zdd�ZdS)�TestCommandLinecCs8d}x.|D]&^}}td|���^}}|j||�q
WdS)N�3filename is missing: required with the main options�-l�-T�8cannot specify both --listfuncs and (--trace or --count)�-lc�>argument -R/--no-report: not allowed with argument -r/--report�-rR�Lmust specify one of --trace, --count, --report, --listfuncs, or --trackcalls�-g�-r/--report requires -f/--file�-r�3--summary can only be used with --count or --report�-sT�unrecognized arguments: -y�-y�-mrB�r�r�r��r�r��r�r��r�r��r�r��r�r��r�r�)r�r�r�r�r�r�r�)r�rB)rr�)r4�_errors�message�args�_r�rrr�
test_failures�szTestCommandLine.test_failurescCsPttd��<}|jtt�|jd�tdddt�\}}}|jd|�WdQRXdS)Nr�za = 1
z-mrBz-lsfunctions called:)r�rrErr�rr�)r4�fdr�r�r�rrr�test_listfuncs_flag_success�s

z+TestCommandLine.test_listfuncs_flag_successcCslttd��&}|jtt�|jd�|jd�WdQRXtt�\}}}tdddt�\}}}|j|j�|�dS)Nr�zimport sys
zprint(type(sys.argv))
z-mrBz-l)r�rrErr�rr��strip)r4r�r�Z
direct_stdoutr�Ztrace_stdoutrrr�test_sys_argv_list�s
z"TestCommandLine.test_sys_argv_listN)r;r<r=r�r�r�rrrrr��s
r��__main__))rrFZtest.supportrrrrZtest.support.script_helperrrr�rwrBrZtest.tracedmodulesr	rrrr!r%r&r'r)r+r-r/r2�objectr3ZTestCaser@rdrlrzr{r�r�r�r;�mainrrrr�<module>s>
Z/>
' 


Youez - 2016 - github.com/yon3zu
LinuXploit